简体   繁体   English

如何将每个产品作为新商品添加到购物车

[英]How can I add every product as a new item into cart

If we talk about default functionality of Magento . 如果我们谈论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. 当客户两次将具有新属性设置的产品添加到购物车中时,购物车必须将这些产品显示为单独的项目,而不更新数量。

This functionality is located in Mage_Sales_Model_Quote::_addCatalogProduct(). 此功能位于Mage_Sales_Model_Quote :: _ addCatalogProduct()中。 You can see that this method calls $this->getItemByProduct(); 您可以看到此方法调用$ this-> getItemByProduct();。 So You need to rewrite Mage_Sales_Model_Quote::getItemByProduct() to solve the issue. 因此,您需要重写Mage_Sales_Model_Quote :: getItemByProduct()来解决此问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在图像中添加产品永久链接标记woocommerce购物车项目? - How can add product permalink in image a tag woocommerce cart item? Virtuemart 2-我怎样才能通过venuemart_product_id将商品添加到购物车会话中? - Virtuemart 2 - How i can add item into cart session with virtuemart_product_id? 如何将购物车商品产品重定向到Woocommerce中的特定页面? - How can i redirect cart item product to specific page in Woocommerce? 如何将新产品包添加到购物车? - How to add new product packs to cart? 如何在不刷新产品列表的情况下将产品添加到购物车? - how can i add products to the cart wihtout refreshing the product list? Magento | 我如何在自定义模块中的购物车中添加产品? - Magento | How i can add a product in shopping cart in a custom module? 我如何直接将特定产品添加到Wordpress中的持久购物车 - How can i directly add particular product to persistent cart in wordpress 如何在购物车中添加两个产品?点击添加到购物车按钮? - How can i add two product in cart onlclick add to cart buton? 我如何才能将Magento添加到购物车ajax推送正确的网址并将产品添加到购物车? - How can I get Magento add to cart ajax push the right url and add the product to cart? **更新**如何在表sales_flat_quote_item中创建新列并使用$ cart-> addProduct添加数据 - **update** How i can create new column in table sales_flat_quote_item and add data with $cart->addProduct
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM