Authored by hf

code review by fei.hong: fixes bug to lifestyle show goods images

... ... @@ -756,6 +756,8 @@ class Process
$goodsList = empty($goodsList) ? array() : $goodsList['data']['product_list'];
$pos = 0;
$url = '';
$img = '';
$flag = false;
$oneGoods = array();
foreach ($goodsList as $goods) {
$oneGoods = array();
... ... @@ -763,11 +765,28 @@ class Process
if ($pos > 12) {
break;
}
if (empty($goods)) {
if (empty($goods['goods_list'])) {
continue;
}
// 判别默认的商品是否将默认的图片URL赋值到skn
$flag = false;
// 如果设置了默认图片,就取默认的图片
foreach ($goods['goods_list'] as $value) {
// 此skc是默认的,则将图片赋值给skn
if ($value['is_default'] === 'Y') {
$img = Helpers::procProductImg($value);
$flag = true;
break;
}
}
// 如果还未赋值,则取第一个skc产品的默认图片
if (!$flag) {
$img = Helpers::procProductImg($goods['goods_list'][0]);
}
$url = Helpers::getUrlBySkc($goods['product_id'], $goods['goods_list'][0]['goods_id'], $goods['cn_alphabet']);
$oneGoods['img'] = Images::getImageUrl($goods['goods_list'][0]['images_url'], 280, 373, 1);
$oneGoods['img'] = Images::getImageUrl($img, 280, 373, 1);
$oneGoods['name'] = $goods['product_name'];
$oneGoods['price'] = $goods['sales_price'];
$oneGoods['href'] = Helpers::transUrl($url, $type);
... ...
... ... @@ -8,12 +8,12 @@ use WebPlugin\Cache;
use LibModels\Web\Home\IndexData;
use LibModels\Web\Product\SearchData;
use WebPlugin\DataProcess\Channel as ChannelProcess;
// define('CODE_BOYS_CHANNEL_TMP', (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'preview') ? '79372627eee75d73afe7f9bac91e5ce6' : 'c15bf0cbfbd4893fd70c869c991f6d3d');
// define('CODE_GIRLS_CHANNEL_TMP', (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'preview') ? '75215008957605c05e8cd375eac4f817' : 'a519ba44ef3a85cf3c05e405c6ba8e53');
// define('CODE_KIDS_CHANNEL_TMP', (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'preview') ? 'd71f4b27f2a7229fbb31a4bc490a6f36' : 'a7741b94e8bb9d56d0d36e00c05956f7');
// define('CODE_LIFESTYLE_CHANNEL_TMP', (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'preview') ? '8a341ca7eacc069ba80f02dec80eaf34' : '1b053fd044834f5c86d5eb15fb237af9');
/**
* web首页模板数据模型
... ...