Authored by Rock Zhang

修复未登录、未添加商品到购物车的情况下进入购物车页面,显示普通和预售商品tab的bug,同时添加随便逛逛和为您优选

Code Review By Rock Zhang
framework @ e9d066dd
Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
Subproject commit e9d066dd88a8e7e37103021c427a205a5cfcdcec
... ...
... ... @@ -50,7 +50,7 @@ class CartModel
*/
public static function getCartData($uid, $shoppingKey, $cartType = 'all', $onlyGift = false, $onlyAdvanceBuy = false)
{
$result = array('cartNav' => true);
$result = array();
// 用户是否登录
if (empty($uid)) {
... ... @@ -63,11 +63,14 @@ class CartModel
// 处理普通购物车和预售购物车的数据
do {
if (!isset($cartData['data']) || empty($cartData['data'])) {
$result['isEmptyCart'] = true;
break;
}
$cart = $cartData['data'];
$result['cartNav'] = true;
if ($cartType !== 'all') { // 加价购或者赠品数据
$result = self::procCartData($cart['ordinary_cart_data'], $onlyGift, $onlyAdvanceBuy);
break;
... ...
... ... @@ -45,6 +45,7 @@ class IndexController extends AbstractAction
'shoppingCartPage' => true,
'shoppingCart' => CartModel::getCartData($uid, $shoppingKey)
);
// 渲染模板
$this->_view->display('index', $data);
}
... ...