Authored by 郝肖肖

头部购物车 列表数据修复

@@ -1315,45 +1315,78 @@ class CartModel @@ -1315,45 +1315,78 @@ class CartModel
1315 $cartType = array('advance_cart_data', 'ordinary_cart_data'); 1315 $cartType = array('advance_cart_data', 'ordinary_cart_data');
1316 $cartData = CartData::cartData($uid, $shoppingKey); 1316 $cartData = CartData::cartData($uid, $shoppingKey);
1317 foreach ($cartType as $dataKey) { 1317 foreach ($cartType as $dataKey) {
1318 - if (!isset($cartData['data'][$dataKey]['goods_list']) || empty($cartData['data'][$dataKey]['goods_list'])) {  
1319 - continue;  
1320 - }  
1321 //购物车商品 1318 //购物车商品
1322 - foreach ($cartData['data'][$dataKey]['goods_list'] as $val) {  
1323 - $goods['product_url'] = Helpers::getUrlBySkc($val['product_id'], $val['goods_id'], $val['cn_alphabet']);  
1324 - $goods['is_advance'] = $val['is_advance'];  
1325 - $goods['default_img'] = Helpers::getImageUrl($val['goods_images'], 46, 62);  
1326 - $goods['product_name'] = $val['product_name'];  
1327 - $goods['color_name'] = $val['color_name'];  
1328 - $goods['size_name'] = $val['size_name'];  
1329 - $goods['show_price'] = $val['real_price'];  
1330 - $goods['buy_number'] = $val['buy_number'];  
1331 - $goods['goods_incart_id'] = $val['shopping_cart_id'];  
1332 - $goods['product_sku'] = $val['product_sku'];  
1333 - $goods['promotion_id'] = $val['promotion_id'];  
1334 - $result['main_goods'][] = $goods;  
1335 - }  
1336 - if (empty($cartData['data'][$dataKey]['promotion_info'])) {  
1337 - continue; 1319 + if (isset($cartData['data'][$dataKey]['goods_list']) && !empty($cartData['data'][$dataKey]['goods_list'])) {
  1320 + foreach ($cartData['data'][$dataKey]['goods_list'] as $val) {
  1321 + $goods['product_url'] = Helpers::getUrlBySkc($val['product_id'], $val['goods_id'], $val['cn_alphabet']);
  1322 + $goods['is_advance'] = $val['is_advance'];
  1323 + $goods['default_img'] = Helpers::getImageUrl($val['goods_images'], 46, 62);
  1324 + $goods['product_name'] = $val['product_name'];
  1325 + $goods['color_name'] = $val['color_name'];
  1326 + $goods['size_name'] = $val['size_name'];
  1327 + $goods['show_price'] = $val['real_price'];
  1328 + $goods['buy_number'] = $val['buy_number'];
  1329 + $goods['goods_incart_id'] = $val['shopping_cart_id'];
  1330 + $goods['product_sku'] = $val['product_sku'];
  1331 + $goods['promotion_id'] = $val['promotion_id'];
  1332 + $result['main_goods'][] = $goods;
  1333 + }
1338 } 1334 }
1339 - //活动  
1340 - foreach ($cartData['data'][$dataKey]['promotion_info'] as $key => $val) {  
1341 - //包邮  
1342 - if ($val['promotion_type'] == 'FreeShippingCost') {  
1343 - preg_match('/\d+/', $val['promotion_title'], $arr);  
1344 - $result['fit_free_shipping'] = $arr[0];  
1345 - continue; 1335 + //下架购物车商品
  1336 + if (isset($cartData['data'][$dataKey]['off_shelves_goods_list']) && !empty($cartData['data'][$dataKey]['off_shelves_goods_list'])) {
  1337 + foreach ($cartData['data'][$dataKey]['off_shelves_goods_list'] as $val) {
  1338 + $goods['product_url'] = Helpers::getUrlBySkc($val['product_id'], $val['goods_id'], $val['cn_alphabet']);
  1339 + $goods['is_advance'] = $val['is_advance'];
  1340 + $goods['default_img'] = Helpers::getImageUrl($val['goods_images'], 46, 62);
  1341 + $goods['product_name'] = $val['product_name'];
  1342 + $goods['color_name'] = $val['color_name'];
  1343 + $goods['size_name'] = $val['size_name'];
  1344 + $goods['show_price'] = $val['real_price'];
  1345 + $goods['buy_number'] = $val['buy_number'];
  1346 + $goods['goods_incart_id'] = $val['shopping_cart_id'];
  1347 + $goods['product_sku'] = $val['product_sku'];
  1348 + $goods['promotion_id'] = $val['promotion_id'];
  1349 + $result['main_goods'][] = $goods;
1346 } 1350 }
1347 - //打折  
1348 - if (!isset($result['first_promotions'])) {  
1349 - $result['has_promotion'] = true;  
1350 - $result['has_first_promotion'] = true;  
1351 - $result['first_promotions']['promotion_id'] = $val['promotion_id'];  
1352 - $result['first_promotions']['promotion_title'] = $val['promotion_title'];  
1353 - } else {  
1354 - $result['has_other_promotion'] = true;  
1355 - $result['other_promotions'][$key]['promotion_id'] = $val['promotion_id'];  
1356 - $result['other_promotions'][$key]['promotion_title'] = $val['promotion_title']; 1351 + }
  1352 + //售罄购物车商品
  1353 + if (isset($cartData['data'][$dataKey]['sold_out_goods_list']) && !empty($cartData['data'][$dataKey]['sold_out_goods_list'])) {
  1354 + foreach ($cartData['data'][$dataKey]['sold_out_goods_list'] as $val) {
  1355 + $goods['product_url'] = Helpers::getUrlBySkc($val['product_id'], $val['goods_id'], $val['cn_alphabet']);
  1356 + $goods['is_advance'] = $val['is_advance'];
  1357 + $goods['default_img'] = Helpers::getImageUrl($val['goods_images'], 46, 62);
  1358 + $goods['product_name'] = $val['product_name'];
  1359 + $goods['color_name'] = $val['color_name'];
  1360 + $goods['size_name'] = $val['size_name'];
  1361 + $goods['show_price'] = $val['real_price'];
  1362 + $goods['buy_number'] = $val['buy_number'];
  1363 + $goods['goods_incart_id'] = $val['shopping_cart_id'];
  1364 + $goods['product_sku'] = $val['product_sku'];
  1365 + $goods['promotion_id'] = $val['promotion_id'];
  1366 + $result['main_goods'][] = $goods;
  1367 + }
  1368 + }
  1369 +
  1370 + //活动
  1371 + if (isset($cartData['data'][$dataKey]['promotion_info']) && !empty($cartData['data'][$dataKey]['promotion_info'])) {
  1372 + foreach ($cartData['data'][$dataKey]['promotion_info'] as $key => $val) {
  1373 + //包邮
  1374 + if ($val['promotion_type'] == 'FreeShippingCost') {
  1375 + preg_match('/\d+/', $val['promotion_title'], $arr);
  1376 + $result['fit_free_shipping'] = $arr[0];
  1377 + continue;
  1378 + }
  1379 + //打折
  1380 + if (!isset($result['first_promotions'])) {
  1381 + $result['has_promotion'] = true;
  1382 + $result['has_first_promotion'] = true;
  1383 + $result['first_promotions']['promotion_id'] = $val['promotion_id'];
  1384 + $result['first_promotions']['promotion_title'] = $val['promotion_title'];
  1385 + } else {
  1386 + $result['has_other_promotion'] = true;
  1387 + $result['other_promotions'][$key]['promotion_id'] = $val['promotion_id'];
  1388 + $result['other_promotions'][$key]['promotion_title'] = $val['promotion_title'];
  1389 + }
1357 } 1390 }
1358 } 1391 }
1359 } 1392 }