如何将每个产品作为新商品添加到购物车 [英] How can I add every product as a new item into cart

查看:55
本文介绍了如何将每个产品作为新商品添加到购物车的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我们谈论Magento的默认功能.当我们将产品添加到购物车中时,它作为一项添加;当我们将同一产品添加到购物车中时,它只是更新同一项目的产品数量,而不是添加具有新数量的新项目.现在,我想将每个产品作为新商品添加到购物车中.还是有任何观察者事件可用于具有特定属性集的那些产品.

If we talk about default functionality of Magento . when we add product into cart it added as an item and when we add same product into cart, it just update the quantity of product for same item instead of adding a new item with new quantity . now i want to add every product into cart as a new item. or is there any observer event to do so which i can use for those product , who have specific attribute set .

示例我必须输入产品类型,第一个是使用默认属性集创建的,第二个是使用新属性集创建的.

Example i have to type of product first one are created with default attribute set and second one are created with new attribute set.

现在,我希望客户将具有默认属性的商品两次添加到购物车中时,设置购物车显示更新的数量而不添加新商品.

now i want when customer add a product two times into cart who has default attribute set the cart show updated quantity without adding new item.

并且当客户两次将具有新属性集的产品添加到购物车中时,购物车必须将这些产品显示为单独的项目,而不更新数量.

and when customer add a product two time into cart who has new attribute set ,cart must be display those product as separate items without updating the quantity.

推荐答案

此功能位于Mage_Sales_Model_Quote :: _ addCatalogProduct()中.您可以看到此方法调用$ this-> getItemByProduct();.因此,您需要重写Mage_Sales_Model_Quote :: getItemByProduct()来解决该问题.

This functionality is located in Mage_Sales_Model_Quote::_addCatalogProduct(). You can see that this method calls $this->getItemByProduct(); So You need to rewrite Mage_Sales_Model_Quote::getItemByProduct() to solve the issue.

这篇关于如何将每个产品作为新商品添加到购物车的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆