Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop
Showing
1 changed file
with
20 additions
and
15 deletions
@@ -153,8 +153,9 @@ class DetailModel | @@ -153,8 +153,9 @@ class DetailModel | ||
153 | // 商品信息 | 153 | // 商品信息 |
154 | if (!empty($baseInfo['goodsList'])) { | 154 | if (!empty($baseInfo['goodsList'])) { |
155 | $colorGroup = array(); | 155 | $colorGroup = array(); |
156 | - $sizeList = array(); | 156 | + $sizeGroup = array(); |
157 | $goodsGroup = array(); | 157 | $goodsGroup = array(); |
158 | + $sizeList = array(); | ||
158 | $thumbImageList = array(); | 159 | $thumbImageList = array(); |
159 | $colorStorageGroup = array(); // 颜色分组的库存总数集合, 多个之间用/分隔 | 160 | $colorStorageGroup = array(); // 颜色分组的库存总数集合, 多个之间用/分隔 |
160 | $sizeStorageStr = ''; // 尺码库存总数集合, 多个之间用/分隔 | 161 | $sizeStorageStr = ''; // 尺码库存总数集合, 多个之间用/分隔 |
@@ -177,7 +178,7 @@ class DetailModel | @@ -177,7 +178,7 @@ class DetailModel | ||
177 | // 商品的尺码列表 | 178 | // 商品的尺码列表 |
178 | if (isset($value['goodsSizeBoList'])) { | 179 | if (isset($value['goodsSizeBoList'])) { |
179 | foreach ($value['goodsSizeBoList'] as $size) { | 180 | foreach ($value['goodsSizeBoList'] as $size) { |
180 | - $sizeList[] = array( | 181 | + $sizeList[ $value['colorId'] ][] = array( |
181 | 'id' => $size['id'], | 182 | 'id' => $size['id'], |
182 | 'skuId' => $size['goodsSizeSkuId'], | 183 | 'skuId' => $size['goodsSizeSkuId'], |
183 | 'goodsId' => $size['goodsId'], | 184 | 'goodsId' => $size['goodsId'], |
@@ -189,22 +190,21 @@ class DetailModel | @@ -189,22 +190,21 @@ class DetailModel | ||
189 | $sizeStorageStr .= $size['goodsSizeStorageNum'] . '/'; | 190 | $sizeStorageStr .= $size['goodsSizeStorageNum'] . '/'; |
190 | $colorStorageGroup[ $size['sizeName'] ][ $value['colorName'] ] = $size['goodsSizeStorageNum']; | 191 | $colorStorageGroup[ $size['sizeName'] ][ $value['colorName'] ] = $size['goodsSizeStorageNum']; |
191 | } | 192 | } |
193 | + | ||
194 | + // 颜色分组 | ||
195 | + $colorGroup[] = array( | ||
196 | + 'id' => $value['colorId'], | ||
197 | + 'skcId' => $value['productSkc'], | ||
198 | + 'name' => $value['colorName'], | ||
199 | + 'goodsName' => $value['goodsName'], | ||
200 | + 'colorNum' => $colorStorageNum, | ||
201 | + 'sizeNumStr' => rtrim($sizeStorageStr, '/'), | ||
202 | + ); | ||
192 | } | 203 | } |
193 | - | ||
194 | - // 颜色分组 | ||
195 | - $colorGroup[] = array( | ||
196 | - 'id' => $value['colorId'], | ||
197 | - 'skcId' => $value['productSkc'], | ||
198 | - 'name' => $value['colorName'], | ||
199 | - 'goodsName' => $value['goodsName'], | ||
200 | - 'colorNum' => $colorStorageNum, | ||
201 | - 'sizeNumStr' => rtrim($sizeStorageStr, '/'), | ||
202 | - ); | ||
203 | 204 | ||
204 | // 缩略图 | 205 | // 缩略图 |
205 | $thumbImageList[] = array('img' => Helpers::getImageUrl($value['colorImage'], 60, 60) ); | 206 | $thumbImageList[] = array('img' => Helpers::getImageUrl($value['colorImage'], 60, 60) ); |
206 | - | ||
207 | - // 统计尺码对应的各个颜色的库存量 | 207 | + |
208 | foreach ($sizeList as &$sizeArr) { | 208 | foreach ($sizeList as &$sizeArr) { |
209 | $sizeArr['colorNumStr'] = implode('/', array_values($colorStorageGroup[ $sizeArr['name'] ]) ); | 209 | $sizeArr['colorNumStr'] = implode('/', array_values($colorStorageGroup[ $sizeArr['name'] ]) ); |
210 | } | 210 | } |
@@ -212,6 +212,11 @@ class DetailModel | @@ -212,6 +212,11 @@ class DetailModel | ||
212 | // 商品库存总数 | 212 | // 商品库存总数 |
213 | $totalStorageNum += $colorStorageNum; | 213 | $totalStorageNum += $colorStorageNum; |
214 | } | 214 | } |
215 | + | ||
216 | + // 统计尺码对应的各个颜色的库存量 | ||
217 | + foreach ($colorGroup as $value) { | ||
218 | + $sizeGroup[]['size'] = $sizeList[ $value['colorId'] ]; | ||
219 | + } | ||
215 | 220 | ||
216 | // 商品图: 多个 | 221 | // 商品图: 多个 |
217 | if (isset($goodsGroup[1])) { | 222 | if (isset($goodsGroup[1])) { |
@@ -247,7 +252,7 @@ class DetailModel | @@ -247,7 +252,7 @@ class DetailModel | ||
247 | $result['cartInfo']['salePrice'] = isset($result['goodsPrice']['currentPrice']) ? $result['goodsPrice']['currentPrice'] : ''; | 252 | $result['cartInfo']['salePrice'] = isset($result['goodsPrice']['currentPrice']) ? $result['goodsPrice']['currentPrice'] : ''; |
248 | $result['cartInfo']['totalNum'] = $totalStorageNum; | 253 | $result['cartInfo']['totalNum'] = $totalStorageNum; |
249 | $result['cartInfo']['colors'] = $colorGroup; | 254 | $result['cartInfo']['colors'] = $colorGroup; |
250 | - $result['cartInfo']['sizes'] = $sizeList; | 255 | + $result['cartInfo']['sizes'] = $sizeGroup; |
251 | } | 256 | } |
252 | // 非卖品 | 257 | // 非卖品 |
253 | elseif ($notForSale) { | 258 | elseif ($notForSale) { |
-
Please register or login to post a comment