[magento2]magento 购物车仿京东勾选下单实现教程

时间:2019-11-04  来源:magento  阅读:

gouxuan

 

jd-gouxuan


该功能仿照了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);
}

[magento2]magento 购物车仿京东勾选下单实现教程

http://m.bbyears.com/wangyezhizuo/77180.html

推荐访问:magento如何注销重新登录 magento的数据库配置文件 magento+ magento免费模板 magento官网 magento2安装 magento2的sql语句在哪里
相关阅读 猜你喜欢
本类排行 本类最新