Authored by 郝肖肖

头部购物车 列表数据修复

... ... @@ -1315,10 +1315,8 @@ class CartModel
$cartType = array('advance_cart_data', 'ordinary_cart_data');
$cartData = CartData::cartData($uid, $shoppingKey);
foreach ($cartType as $dataKey) {
if (!isset($cartData['data'][$dataKey]['goods_list']) || empty($cartData['data'][$dataKey]['goods_list'])) {
continue;
}
//购物车商品
if (isset($cartData['data'][$dataKey]['goods_list']) && !empty($cartData['data'][$dataKey]['goods_list'])) {
foreach ($cartData['data'][$dataKey]['goods_list'] as $val) {
$goods['product_url'] = Helpers::getUrlBySkc($val['product_id'], $val['goods_id'], $val['cn_alphabet']);
$goods['is_advance'] = $val['is_advance'];
... ... @@ -1333,10 +1331,44 @@ class CartModel
$goods['promotion_id'] = $val['promotion_id'];
$result['main_goods'][] = $goods;
}
if (empty($cartData['data'][$dataKey]['promotion_info'])) {
continue;
}
//下架购物车商品
if (isset($cartData['data'][$dataKey]['off_shelves_goods_list']) && !empty($cartData['data'][$dataKey]['off_shelves_goods_list'])) {
foreach ($cartData['data'][$dataKey]['off_shelves_goods_list'] as $val) {
$goods['product_url'] = Helpers::getUrlBySkc($val['product_id'], $val['goods_id'], $val['cn_alphabet']);
$goods['is_advance'] = $val['is_advance'];
$goods['default_img'] = Helpers::getImageUrl($val['goods_images'], 46, 62);
$goods['product_name'] = $val['product_name'];
$goods['color_name'] = $val['color_name'];
$goods['size_name'] = $val['size_name'];
$goods['show_price'] = $val['real_price'];
$goods['buy_number'] = $val['buy_number'];
$goods['goods_incart_id'] = $val['shopping_cart_id'];
$goods['product_sku'] = $val['product_sku'];
$goods['promotion_id'] = $val['promotion_id'];
$result['main_goods'][] = $goods;
}
}
//售罄购物车商品
if (isset($cartData['data'][$dataKey]['sold_out_goods_list']) && !empty($cartData['data'][$dataKey]['sold_out_goods_list'])) {
foreach ($cartData['data'][$dataKey]['sold_out_goods_list'] as $val) {
$goods['product_url'] = Helpers::getUrlBySkc($val['product_id'], $val['goods_id'], $val['cn_alphabet']);
$goods['is_advance'] = $val['is_advance'];
$goods['default_img'] = Helpers::getImageUrl($val['goods_images'], 46, 62);
$goods['product_name'] = $val['product_name'];
$goods['color_name'] = $val['color_name'];
$goods['size_name'] = $val['size_name'];
$goods['show_price'] = $val['real_price'];
$goods['buy_number'] = $val['buy_number'];
$goods['goods_incart_id'] = $val['shopping_cart_id'];
$goods['product_sku'] = $val['product_sku'];
$goods['promotion_id'] = $val['promotion_id'];
$result['main_goods'][] = $goods;
}
}
//活动
if (isset($cartData['data'][$dataKey]['promotion_info']) && !empty($cartData['data'][$dataKey]['promotion_info'])) {
foreach ($cartData['data'][$dataKey]['promotion_info'] as $key => $val) {
//包邮
if ($val['promotion_type'] == 'FreeShippingCost') {
... ... @@ -1357,6 +1389,7 @@ class CartModel
}
}
}
}
return $result;
}
... ...