...
|
...
|
@@ -184,6 +184,7 @@ class DetailModel |
|
|
}
|
|
|
|
|
|
// 商品的尺码列表
|
|
|
$colorStorageGroup[$value['productSkc']] = array();
|
|
|
if (isset($value['goodsSizeBoList'])) {
|
|
|
foreach ($value['goodsSizeBoList'] as $size) {
|
|
|
$sizeList[$value['productSkc']][] = array(
|
...
|
...
|
@@ -196,7 +197,7 @@ class DetailModel |
|
|
);
|
|
|
$colorStorageNum += intval($size['goodsSizeStorageNum']);
|
|
|
$sizeStorageStr .= $size['goodsSizeStorageNum'] . '/';
|
|
|
$colorStorageGroup[$size['sizeName']][$value['productSkc']] = $size['goodsSizeStorageNum'];
|
|
|
$colorStorageGroup[$value['productSkc']][$size['sizeName']] = $size['goodsSizeStorageNum'];
|
|
|
}
|
|
|
|
|
|
// 颜色分组
|
...
|
...
|
@@ -213,20 +214,28 @@ class DetailModel |
|
|
// 缩略图
|
|
|
$thumbImageList[] = array('img' => Helpers::getImageUrl($value['colorImage'], 60, 60));
|
|
|
|
|
|
// 添加尺码对应的各个颜色的库存量
|
|
|
// 商品库存总数
|
|
|
$totalStorageNum += $colorStorageNum;
|
|
|
}
|
|
|
|
|
|
// 遍历所有尺码,统计出该尺码的每个颜色的库存量,没有时添0,不能空着,因为JS中需要判断
|
|
|
foreach ($sizeList as $skc => $sizeArr) {
|
|
|
foreach ($sizeArr as $key => $value) {
|
|
|
$sizeList[$skc][$key]['colorNumStr'] = implode('/', array_values($colorStorageGroup[$value['name']]));
|
|
|
$sizeStorageStr = '';
|
|
|
foreach ($colorStorageGroup as $colorArr) {
|
|
|
if (isset($colorArr[ $value['name'] ])) {
|
|
|
$sizeStorageStr .= $colorArr[ $value['name'] ] . '/';
|
|
|
} else {
|
|
|
$sizeStorageStr .= '0/';
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 商品库存总数
|
|
|
$totalStorageNum += $colorStorageNum;
|
|
|
$sizeList[$skc][$key]['colorNumStr'] = rtrim($sizeStorageStr, '/');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 格式化尺码对应的各个颜色分组
|
|
|
foreach ($colorGroup as $value) {
|
|
|
$sizeGroup[]['size'] = $sizeList[ $value['skcId'] ];
|
|
|
$sizeGroup[]['size'] = $sizeList[$value['skcId']];
|
|
|
}
|
|
|
|
|
|
// 商品图: 多个
|
...
|
...
|
@@ -284,6 +293,13 @@ class DetailModel |
|
|
$result['introUrl'] = Helpers::url('/product/intro_' . $baseInfo['erpProductId'] . '/' . $baseInfo['cnAlphabet'] . '.html', null, '');
|
|
|
$result['id'] = $productId;
|
|
|
|
|
|
// 清空变量,释放内存
|
|
|
$baseInfo = array();
|
|
|
$goodsGroup = array();
|
|
|
$sizeGroup = array();
|
|
|
$colorGroup = array();
|
|
|
$sizeList = array();
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -488,6 +504,9 @@ class DetailModel |
|
|
);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 清空变量,释放内存
|
|
|
$sizeInfo = array();
|
|
|
}
|
|
|
|
|
|
return $result;
|
...
|
...
|
|