code review by fei.hong: fixes bug to lifestyle show goods images
Showing
2 changed files
with
23 additions
and
4 deletions
@@ -756,6 +756,8 @@ class Process | @@ -756,6 +756,8 @@ class Process | ||
756 | $goodsList = empty($goodsList) ? array() : $goodsList['data']['product_list']; | 756 | $goodsList = empty($goodsList) ? array() : $goodsList['data']['product_list']; |
757 | $pos = 0; | 757 | $pos = 0; |
758 | $url = ''; | 758 | $url = ''; |
759 | + $img = ''; | ||
760 | + $flag = false; | ||
759 | $oneGoods = array(); | 761 | $oneGoods = array(); |
760 | foreach ($goodsList as $goods) { | 762 | foreach ($goodsList as $goods) { |
761 | $oneGoods = array(); | 763 | $oneGoods = array(); |
@@ -763,11 +765,28 @@ class Process | @@ -763,11 +765,28 @@ class Process | ||
763 | if ($pos > 12) { | 765 | if ($pos > 12) { |
764 | break; | 766 | break; |
765 | } | 767 | } |
766 | - if (empty($goods)) { | 768 | + if (empty($goods['goods_list'])) { |
767 | continue; | 769 | continue; |
768 | } | 770 | } |
771 | + | ||
772 | + // 判别默认的商品是否将默认的图片URL赋值到skn | ||
773 | + $flag = false; | ||
774 | + // 如果设置了默认图片,就取默认的图片 | ||
775 | + foreach ($goods['goods_list'] as $value) { | ||
776 | + // 此skc是默认的,则将图片赋值给skn | ||
777 | + if ($value['is_default'] === 'Y') { | ||
778 | + $img = Helpers::procProductImg($value); | ||
779 | + $flag = true; | ||
780 | + break; | ||
781 | + } | ||
782 | + } | ||
783 | + // 如果还未赋值,则取第一个skc产品的默认图片 | ||
784 | + if (!$flag) { | ||
785 | + $img = Helpers::procProductImg($goods['goods_list'][0]); | ||
786 | + } | ||
769 | $url = Helpers::getUrlBySkc($goods['product_id'], $goods['goods_list'][0]['goods_id'], $goods['cn_alphabet']); | 787 | $url = Helpers::getUrlBySkc($goods['product_id'], $goods['goods_list'][0]['goods_id'], $goods['cn_alphabet']); |
770 | - $oneGoods['img'] = Images::getImageUrl($goods['goods_list'][0]['images_url'], 280, 373, 1); | 788 | + |
789 | + $oneGoods['img'] = Images::getImageUrl($img, 280, 373, 1); | ||
771 | $oneGoods['name'] = $goods['product_name']; | 790 | $oneGoods['name'] = $goods['product_name']; |
772 | $oneGoods['price'] = $goods['sales_price']; | 791 | $oneGoods['price'] = $goods['sales_price']; |
773 | $oneGoods['href'] = Helpers::transUrl($url, $type); | 792 | $oneGoods['href'] = Helpers::transUrl($url, $type); |
@@ -8,12 +8,12 @@ use WebPlugin\Cache; | @@ -8,12 +8,12 @@ use WebPlugin\Cache; | ||
8 | use LibModels\Web\Home\IndexData; | 8 | use LibModels\Web\Home\IndexData; |
9 | use LibModels\Web\Product\SearchData; | 9 | use LibModels\Web\Product\SearchData; |
10 | use WebPlugin\DataProcess\Channel as ChannelProcess; | 10 | use WebPlugin\DataProcess\Channel as ChannelProcess; |
11 | - | 11 | + |
12 | // define('CODE_BOYS_CHANNEL_TMP', (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'preview') ? '79372627eee75d73afe7f9bac91e5ce6' : 'c15bf0cbfbd4893fd70c869c991f6d3d'); | 12 | // define('CODE_BOYS_CHANNEL_TMP', (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'preview') ? '79372627eee75d73afe7f9bac91e5ce6' : 'c15bf0cbfbd4893fd70c869c991f6d3d'); |
13 | // define('CODE_GIRLS_CHANNEL_TMP', (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'preview') ? '75215008957605c05e8cd375eac4f817' : 'a519ba44ef3a85cf3c05e405c6ba8e53'); | 13 | // define('CODE_GIRLS_CHANNEL_TMP', (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'preview') ? '75215008957605c05e8cd375eac4f817' : 'a519ba44ef3a85cf3c05e405c6ba8e53'); |
14 | // define('CODE_KIDS_CHANNEL_TMP', (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'preview') ? 'd71f4b27f2a7229fbb31a4bc490a6f36' : 'a7741b94e8bb9d56d0d36e00c05956f7'); | 14 | // define('CODE_KIDS_CHANNEL_TMP', (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'preview') ? 'd71f4b27f2a7229fbb31a4bc490a6f36' : 'a7741b94e8bb9d56d0d36e00c05956f7'); |
15 | // define('CODE_LIFESTYLE_CHANNEL_TMP', (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'preview') ? '8a341ca7eacc069ba80f02dec80eaf34' : '1b053fd044834f5c86d5eb15fb237af9'); | 15 | // define('CODE_LIFESTYLE_CHANNEL_TMP', (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'preview') ? '8a341ca7eacc069ba80f02dec80eaf34' : '1b053fd044834f5c86d5eb15fb237af9'); |
16 | - | 16 | + |
17 | 17 | ||
18 | /** | 18 | /** |
19 | * web首页模板数据模型 | 19 | * web首页模板数据模型 |
-
Please register or login to post a comment