Authored by Rock Zhang

添加异步获取购物车数据的接口

Code Review By Rock Zhang
... ... @@ -13,7 +13,6 @@ class ShoppingCartController extends AbstractAction
/*
* 购物车首页
*/
public function indexAction()
{
$this->setTitle('购物车');
... ... @@ -30,6 +29,26 @@ class ShoppingCartController extends AbstractAction
// 渲染模板
$this->_view->display('index', $data);
}
/*
* 异步获取购物车数据
*/
public function getCartDataAction()
{
$result = array();
if ($this->isAjax()) {
$shoppingKey = Helpers::getShoppingKeyByCookie();
$uid = $this->getUid(true);
$result = CartModel::getCartData($uid, $shoppingKey);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 购物车商品选择与取消
... ...