...
|
...
|
@@ -160,17 +160,15 @@ class DetailModel |
|
|
$colorGroup = array();
|
|
|
$sizeList = array();
|
|
|
$goodsGroup = array();
|
|
|
$coverImage = '';
|
|
|
$colorStorageNum = 0; // 颜色的库存总数
|
|
|
$thumbImageList = array();
|
|
|
$colorStorageGroup = array(); // 颜色分组的库存总数集合, 多个之间用/分隔
|
|
|
$sizeStorageStr = ''; // 尺码库存总数集合, 多个之间用/分隔
|
|
|
$colorStorageNum = 0;
|
|
|
$totalStorageNum = 0; // 总库存数
|
|
|
foreach ($baseInfo['goodsList'] as $i => $value) {
|
|
|
foreach ($baseInfo['goodsList'] as $value) {
|
|
|
$sizeList = array();
|
|
|
$colorStorageNum = 0;
|
|
|
|
|
|
// 获取默认的封面图
|
|
|
if ($i === 0) {
|
|
|
$coverImage = Helpers::getImageUrl($value['colorImage'], 60, 60);
|
|
|
}
|
|
|
$sizeStorageStr = '';
|
|
|
|
|
|
// 商品分组
|
|
|
if (isset($value['goodsImagesList'])) {
|
...
|
...
|
@@ -189,10 +187,13 @@ class DetailModel |
|
|
'id' => $size['id'],
|
|
|
'skuId' => $size['goodsSizeSkuId'],
|
|
|
'goodsId' => $size['goodsId'],
|
|
|
'colorId' => $value['colorId'],
|
|
|
'name' => $size['sizeName'],
|
|
|
'sizeNum' => $size['goodsSizeStorageNum'],
|
|
|
);
|
|
|
$colorStorageNum += intval($size['goodsSizeStorageNum']);
|
|
|
$sizeStorageStr .= $size['goodsSizeStorageNum'] . '/';
|
|
|
$colorStorageGroup[ $size['sizeName'] ][ $value['colorName'] ] = $size['goodsSizeStorageNum'];
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -202,11 +203,19 @@ class DetailModel |
|
|
'skcId' => $value['productSkc'],
|
|
|
'name' => $value['colorName'],
|
|
|
'goodsName' => $value['goodsName'],
|
|
|
'shortUrl' => Helpers::getImageUrl($value['colorImage'], 60, 60),
|
|
|
'colorNum' => $colorStorageNum,
|
|
|
'sizes' => $sizeList,
|
|
|
'sizeNumStr' => rtrim($sizeStorageStr, '/'),
|
|
|
);
|
|
|
|
|
|
// 缩略图
|
|
|
$thumbImageList[] = array('img' => Helpers::getImageUrl($value['colorImage'], 60, 60) );
|
|
|
|
|
|
// 统计尺码对应的各个颜色的库存量
|
|
|
foreach ($sizeList as &$sizeArr) {
|
|
|
$sizeArr['colorNumStr'] = implode('/', array_values($colorStorageGroup[ $sizeArr['name'] ]) );
|
|
|
}
|
|
|
|
|
|
// 商品库存总数
|
|
|
$totalStorageNum += $colorStorageNum;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -238,12 +247,13 @@ class DetailModel |
|
|
if (!$soldOut && !$notForSale) {
|
|
|
$result['cartInfo']['addToCartUrl'] = Helpers::url('/product/buy_' . $productId . '_' . $goodsId . '.html');
|
|
|
$result['cartInfo']['productId'] = $productId;
|
|
|
$result['cartInfo']['thumb'] = $coverImage;
|
|
|
$result['cartInfo']['thumbs'] = $thumbImageList;
|
|
|
$result['cartInfo']['name'] = isset($result['goodsName']) ? $result['goodsName'] : '';
|
|
|
$result['cartInfo']['price'] = isset($result['goodsPrice']['currentPrice']) ? $result['goodsPrice']['currentPrice'] : '';
|
|
|
$result['cartInfo']['salePrice'] = isset($result['goodsPrice']['previousPrice']) ? $result['goodsPrice']['previousPrice'] : '';
|
|
|
$result['cartInfo']['totalNum'] = $totalStorageNum;
|
|
|
$result['cartInfo']['colors'] = $colorGroup;
|
|
|
$result['cartInfo']['sizes'] = $sizeList;
|
|
|
}
|
|
|
// 非卖品
|
|
|
elseif ($notForSale) {
|
...
|
...
|
@@ -336,7 +346,7 @@ class DetailModel |
|
|
|
|
|
$referenceList = array();
|
|
|
// 判断是否显示参考尺码
|
|
|
$showReference = !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['referenceSize']) && ($sizeInfo['sizeInfoBo']['sizeBoList'][0]['referenceSize']['gender'] == $gender || $sizeInfo['sizeInfoBo']['sizeBoList'][0]['referenceSize']['gender'] == 3);
|
|
|
$showReference = !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['referenceSize']);
|
|
|
if ($showReference) {
|
|
|
$referenceList[0] = array('param' => $referenceName);
|
|
|
}
|
...
|
...
|
@@ -351,7 +361,10 @@ class DetailModel |
|
|
foreach ($sizeInfo['sizeInfoBo']['sizeBoList'] as $value) {
|
|
|
$item = array();
|
|
|
$sizeNameList[] = array('param' => $value['sizeName']);
|
|
|
if (!empty($value['referenceSize']['gender']) && ($value['referenceSize']['gender'] == $gender || $value['referenceSize']['gender'] == 3)) {
|
|
|
if (!empty($value['referenceSize']['gender']) && $boyReference && ($value['referenceSize']['gender'] == 1 || $value['referenceSize']['gender'] == 3)) {
|
|
|
$referenceList[] = array('param' => empty($value['referenceSize']['referenceName']) ? ' ' : $value['referenceSize']['referenceName']);
|
|
|
}
|
|
|
elseif (!empty($value['referenceSize']['gender']) && $girlReference && ($value['referenceSize']['gender'] == 2 || $value['referenceSize']['gender'] == 3)) {
|
|
|
$referenceList[] = array('param' => empty($value['referenceSize']['referenceName']) ? ' ' : $value['referenceSize']['referenceName']);
|
|
|
}
|
|
|
foreach ($value['sortAttributes'] as $attr) {
|
...
|
...
|
|