修复各种购物车结算页面当商品为空时的处理逻辑
Showing
1 changed file
with
8 additions
and
2 deletions
@@ -275,14 +275,20 @@ class IndexController extends AbstractAction | @@ -275,14 +275,20 @@ class IndexController extends AbstractAction | ||
275 | $this->setNavHeader('确认订单', Helpers::url('/cart/index/index'), false); // 不显示右上角home按钮 | 275 | $this->setNavHeader('确认订单', Helpers::url('/cart/index/index'), false); // 不显示右上角home按钮 |
276 | 276 | ||
277 | // 购物车商品为空跳转到购物车页面 | 277 | // 购物车商品为空跳转到购物车页面 |
278 | + $cartType = $this->get('cartType', 'ordinary'); | ||
279 | + $cartKey = 'commonCart'; | ||
280 | + if ($cartType === 'advance') { | ||
281 | + $cartKey = 'preSellCart'; | ||
282 | + } | ||
283 | + | ||
278 | $shoppingKey = Helpers::getShoppingKeyByCookie(); | 284 | $shoppingKey = Helpers::getShoppingKeyByCookie(); |
279 | $uid = $this->getUid(true); | 285 | $uid = $this->getUid(true); |
280 | $cartGoods = CartModel::getCartData($uid, $shoppingKey); | 286 | $cartGoods = CartModel::getCartData($uid, $shoppingKey); |
281 | - if (empty($cartGoods) || isset($cartGoods['isEmptyCart'])) { | 287 | + if (isset($cartGoods['isEmptyCart']) || empty($cartGoods[$cartKey])) { |
282 | $this->go(Helpers::url('/cart/index/index')); | 288 | $this->go(Helpers::url('/cart/index/index')); |
283 | } | 289 | } |
284 | 290 | ||
285 | - $cartType = $this->get('cartType', 'ordinary'); | 291 | + |
286 | $cookieData = $this->getCookie('order-info', null); | 292 | $cookieData = $this->getCookie('order-info', null); |
287 | $uid = $this->getUid(true); | 293 | $uid = $this->getUid(true); |
288 | $data = array( | 294 | $data = array( |
-
Please register or login to post a comment