Authored by Rock Zhang

当只有失效商品时,购物车的显示逻辑的判断

... ... @@ -80,19 +80,21 @@ class CartModel
$ordinaryCount = strval($cart['ordinary_cart_data']['shopping_cart_data']['goods_count']);
$advanceCount = strval($cart['advance_cart_data']['shopping_cart_data']['goods_count']);
$ordinarySoldOut = empty($cart['ordinary_cart_data']['sold_out_goods_list']);
$advanceSoldOut = empty($cart['advance_cart_data']['sold_out_goods_list']);
// 普通购物车和预售购物车都为空
if ($ordinaryCount === '0' && $advanceCount === '0') {
if ($ordinaryCount === '0' && $advanceCount === '0' && $ordinarySoldOut && $advanceSoldOut) {
$result['isEmptyCart'] = true;
break;
}
// 普通购物车空,则显示预售购物车
if ($ordinaryCount === '0') {
if ($ordinaryCount === '0' && $ordinaryCount) {
$result['cartNav'] = false;
$result['cartType'] = 'advance';
}
// 预售购物车空,则显示普通购物车
elseif ($advanceCount === '0') {
elseif ($advanceCount === '0' && $advanceSoldOut) {
$result['cartNav'] = false;
$result['cartType'] = 'ordinary';
}
... ... @@ -734,7 +736,7 @@ class CartModel
do {
// 数据为空时返回空的标志
if (empty($data['goods_list'])) {
if (empty($data['goods_list']) && empty($data['sold_out_goods_list'])) {
break;
}
... ...