Authored by 毕凯

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

... ... @@ -153,8 +153,9 @@ class DetailModel
// 商品信息
if (!empty($baseInfo['goodsList'])) {
$colorGroup = array();
$sizeList = array();
$sizeGroup = array();
$goodsGroup = array();
$sizeList = array();
$thumbImageList = array();
$colorStorageGroup = array(); // 颜色分组的库存总数集合, 多个之间用/分隔
$sizeStorageStr = ''; // 尺码库存总数集合, 多个之间用/分隔
... ... @@ -177,7 +178,7 @@ class DetailModel
// 商品的尺码列表
if (isset($value['goodsSizeBoList'])) {
foreach ($value['goodsSizeBoList'] as $size) {
$sizeList[] = array(
$sizeList[ $value['colorId'] ][] = array(
'id' => $size['id'],
'skuId' => $size['goodsSizeSkuId'],
'goodsId' => $size['goodsId'],
... ... @@ -189,7 +190,6 @@ class DetailModel
$sizeStorageStr .= $size['goodsSizeStorageNum'] . '/';
$colorStorageGroup[ $size['sizeName'] ][ $value['colorName'] ] = $size['goodsSizeStorageNum'];
}
}
// 颜色分组
$colorGroup[] = array(
... ... @@ -200,11 +200,11 @@ class DetailModel
'colorNum' => $colorStorageNum,
'sizeNumStr' => rtrim($sizeStorageStr, '/'),
);
}
// 缩略图
$thumbImageList[] = array('img' => Helpers::getImageUrl($value['colorImage'], 60, 60) );
// 统计尺码对应的各个颜色的库存量
foreach ($sizeList as &$sizeArr) {
$sizeArr['colorNumStr'] = implode('/', array_values($colorStorageGroup[ $sizeArr['name'] ]) );
}
... ... @@ -213,6 +213,11 @@ class DetailModel
$totalStorageNum += $colorStorageNum;
}
// 统计尺码对应的各个颜色的库存量
foreach ($colorGroup as $value) {
$sizeGroup[]['size'] = $sizeList[ $value['colorId'] ];
}
// 商品图: 多个
if (isset($goodsGroup[1])) {
foreach ($goodsGroup as $value) {
... ... @@ -247,7 +252,7 @@ class DetailModel
$result['cartInfo']['salePrice'] = isset($result['goodsPrice']['currentPrice']) ? $result['goodsPrice']['currentPrice'] : '';
$result['cartInfo']['totalNum'] = $totalStorageNum;
$result['cartInfo']['colors'] = $colorGroup;
$result['cartInfo']['sizes'] = $sizeList;
$result['cartInfo']['sizes'] = $sizeGroup;
}
// 非卖品
elseif ($notForSale) {
... ...