我检查了 system -> config -> Inventory 中的选项,它设置为1000 Maximum Qty Allowed in Shopping Cart 我可以添加相同的产品,因此它补充了该产品的数量一个,但如果我添加另一个产品我得到这个 Maximum Qty Allowed in Shopping Cart ,任何想法我怎么能修复购物车所以我可以在购物车中添加更多商品吗?
if ($cartItems >= 1) {
Mage::getSingleton('core/session')->addError($this->__('Maximum one item to add the shopping cart.'));
$this->_goBack();
return;
}
和
if ($params['product'] != $productId) {
if ($cartItems >= 1) {
$this->_getSession()->addError($this->__('Maximum one item to add the shopping cart.'));
$this->_goBack();
return;
}
}
和
if ($params['product'] != $productId) {
if ($cartItems > 1) {
Mage::getSingleton('checkout/session')->addError($this->__('Maximum one product to add the shopping cart.'));
$this->_redirect('checkout/cart');
return;
}
}
和
if ($item->getProductId() != $productId) {
if ($cartItems >= 1) {
$this->_getSession()->addError($this->__('Maximum one item to add the shopping cart.'));
$this->_goBack();
return;
}
}
您可能会在 /app/code/local/{Name}/{Module}/controllers/Checkout/CartController.php/app/code/local/{Name}/{Module}/controllers/Checkout/OnepageController.php/app/code/local/{Name}/{Module}/controllers/Sales/OrderController.php 中找到它们 . 可选地,不一定限于一个扩展名...我在 if ($cartItems > 1) { 中将've found it in multiple, perform a search all through all the files in /app/code/local to be sure. In order to '修复' it, either change the ' 1'转换为其他(更高)数字,或者注释if语句输出和用 if(false) { 替换它 .
-1
if ($params['product'] != $productId) {
if ($cartItems > 1) {
Mage::getSingleton('checkout/session')->addError($this->__('Maximum one product to add the shopping cart.'));
$this->_redirect('checkout/cart');
return;
}
}
3 回答
我想建议您执行以下操作:
首先检查系统 - >配置 - >所有商店的库存设置 . 通常,当设置在不同的商店级别上不合适时,用户会收到此类错误 .
但是如果您在添加其他产品时出现此错误,请转到产品的“库存”选项卡,然后检查购物车中允许的最大数量是否正确填充 .
您的错误'最多可添加一个购物车的商品 . '是非常独特的,它实际上是Magento不是原生的自定义错误 . 我在我的客户的一些代码中找到了它 . 您必须在几个文件中查找以下代码块:
和
和
和
您可能会在
/app/code/local/{Name}/{Module}/controllers/Checkout/CartController.php
/app/code/local/{Name}/{Module}/controllers/Checkout/OnepageController.php
/app/code/local/{Name}/{Module}/controllers/Sales/OrderController.php
中找到它们 . 可选地,不一定限于一个扩展名...我在if ($cartItems > 1) {
中将've found it in multiple, perform a search all through all the files in /app/code/local to be sure. In order to '修复' it, either change the ' 1'转换为其他(更高)数字,或者注释if语句输出和用if(false) {
替换它 .