Magento 2, Magento Development, Customization, Extension Development and Integration, Optimization, SEO and Responsive Design

Magento 2, Magento Development, Customization, Extension Development and Integration, Optimization, SEO and Responsive Design

Related product disappear after adding to Cart [Fixed]

I have noticed that after adding a product to cart, it disappears in list of related products. It's a default Magento feature that after adding an item to cart, it disappears under the related products of a specific product. If you want to still show that specific product even if already added it to cart You need to rewrite the block Mage_Catalog_Block_Product_List_Related and from the method _prepareData comment following line

Mage::getResourceSingleton('checkout/cart')->addExcludeProductFilter($this->_itemCollection, 
    Mage::getSingleton('checkout/session')->getQuoteId()
);

It is a good practice to not change any core file. Better to over write this file in your local folder. Create directory like

/app/code/local/Mage/Catalog/Block/Product/List and copy Related.php file in this directory.


Please support us, Like us on Facebook.

0 comments:

Post a Comment

 

Copyright @ 2017 HKBlog.