实现仿京东magento购物车勾选下单仿京东
该功能仿照了Wishlist功能,构造了一个新的购物车系统,用户更新删除购物车item ,操作新的数据库表
两个方法
public function removeCancelByAjaxAction()
{
$result = array();
$itemId = (int) $this->getRequest()->getParam('itemId');
if($itemId){
try{
$newQuoteItemId = Mage::getModel("newshoppingcart/simulation")->addNCItemToCart($itemId);
$result['status'] = "success";
$result['content'] = $this->getLayout()->createBlock('checkout/cart_totals')->setTemplate('checkout/cart/totals.phtml')->toHtml();
$result['newQuoteId'] = $newQuoteItemId;
}catch (Exception $e){
$result['status'] = "fail";
$result['error'] = "Exception when call addNItemToCart function,Msg:".$e->getMessage();
}
}
echo json_encode($result);
}
public function removeCancelByAjaxAction()
{
$result = array();
$itemId = (int) $this->getRequest()->getParam('itemId');
if($itemId){
try{
$newQuoteItemId = Mage::getModel("newshoppingcart/simulation")->addNCItemToCart($itemId);
$result['status'] = "success";
$result['content'] = $this->getLayout()->createBlock('checkout/cart_totals')->setTemplate('checkout/cart/totals.phtml')->toHtml();
$result['newQuoteId'] = $newQuoteItemId;
}catch (Exception $e){
$result['status'] = "fail";
$result['error'] = "Exception when call addNItemToCart function,Msg:".$e->getMessage();
}
}
echo json_encode($result);
}
(责任编辑:最模板) |