...
|
...
|
@@ -582,18 +582,14 @@ class CartModel |
|
|
{
|
|
|
$data = array();
|
|
|
|
|
|
// 品牌信息
|
|
|
if (isset($productData['brand_info']) && !empty($productData['brand_info'])) {
|
|
|
$data['thumb'] = Helpers::getImageUrl($productData['brand_info']['brand_ico'], 120, 120);
|
|
|
}
|
|
|
|
|
|
$data['name'] = $productData['product_name'];
|
|
|
$data['price'] = $productData['market_price'];
|
|
|
$data['salePrice'] = $productData['sales_price'];
|
|
|
$data['price'] = Helpers::transPrice($productData['market_price']);
|
|
|
$data['salePrice'] = Helpers::transPrice($productData['sales_price']);
|
|
|
|
|
|
if (isset($productData['storage_sum'])) {
|
|
|
$data['storage'] = $productData['storage_sum'];
|
|
|
}
|
|
|
$data['num'] = 1;
|
|
|
if ($num !== null) {
|
|
|
$data['num'] = $num;
|
|
|
}
|
...
|
...
|
@@ -606,25 +602,62 @@ class CartModel |
|
|
$oneColor = array();
|
|
|
$sizes = array();
|
|
|
$oneSize = array();
|
|
|
$thumbImageList = array();
|
|
|
$colorNum = 0;
|
|
|
$totalStorageNum = 0; // 总库存数
|
|
|
$colorStorageGroup = array(); // 颜色分组的库存总数集合, 多个之间用/分隔
|
|
|
foreach ($goodsList as $val) {
|
|
|
// 颜色
|
|
|
$oneColor = array();
|
|
|
$oneColor['id'] = $val['color_id'];
|
|
|
$oneColor['name'] = $val['color_name'];
|
|
|
$colorNum = 0;
|
|
|
$sizeStorageStr = '';
|
|
|
|
|
|
// 尺码
|
|
|
foreach ($val['size_list'] as $one) {
|
|
|
$oneSize = array();
|
|
|
$oneSize['id'] = $one['size_id'];
|
|
|
$oneSize['skuId'] = $one['product_sku'];
|
|
|
$oneSize['goodsId'] = $val['goods_id'];
|
|
|
$oneSize['colorId'] = $val['color_id'];
|
|
|
$oneSize['name'] = $one['size_name'];
|
|
|
$oneSize['sizeNum'] = $one['storage_number'];
|
|
|
|
|
|
$colorNum += $one['storage_number'];
|
|
|
$sizeStorageStr .= $one['storage_number'] . '/';
|
|
|
|
|
|
$sizes[] = $oneSize;
|
|
|
|
|
|
$colorStorageGroup[$one['size_name']][$val['color_name']] = $one['storage_number'];
|
|
|
}
|
|
|
$sizes[] = $oneSize;
|
|
|
|
|
|
$oneColor['sizes'] = $sizes;
|
|
|
// 统计尺码对应的各个颜色的库存量
|
|
|
foreach ($sizes as &$sizeArr) {
|
|
|
$sizeArr['colorNumStr'] = implode('/', array_values($colorStorageGroup[ $sizeArr['name'] ]) );
|
|
|
}
|
|
|
|
|
|
// 颜色
|
|
|
$oneColor = array();
|
|
|
$oneColor['id'] = $val['color_id'];
|
|
|
$oneColor['skcId'] = $val['product_skc'];
|
|
|
$oneColor['name'] = $val['color_name'];
|
|
|
$oneColor['goodsName'] = $productData['product_name'];
|
|
|
$oneColor['colorNum'] = $colorNum;
|
|
|
$oneColor['sizeNumStr'] = rtrim($sizeStorageStr, '/');
|
|
|
$colors[] = $oneColor;
|
|
|
|
|
|
// 缩略图
|
|
|
foreach ($val['images_list'] as $image) {
|
|
|
$thumbImageList[] = array(
|
|
|
'img' => Helpers::getImageUrl($image['image_url'], 60, 60)
|
|
|
);
|
|
|
}
|
|
|
|
|
|
// 商品库存总数
|
|
|
$totalStorageNum += $colorNum;
|
|
|
}
|
|
|
|
|
|
$data['thumbs'] = $thumbImageList;
|
|
|
$data['colors'] = $colors;
|
|
|
$data['sizes'] = $sizes;
|
|
|
$data['totalNum'] = $totalStorageNum;
|
|
|
}
|
|
|
|
|
|
return $data;
|
...
|
...
|
@@ -668,7 +701,7 @@ class CartModel |
|
|
// 失效商品列表
|
|
|
$notValidGoods = Helpers::formatCartGoods($data['sold_out_goods_list']);
|
|
|
if (!empty($notValidGoods)) {
|
|
|
$result['$notValidGoods'] = $notValidGoods;
|
|
|
$result['notValidGoods'] = $notValidGoods;
|
|
|
}
|
|
|
|
|
|
// 赠品和加价购商品
|
...
|
...
|
|