Show only included products in magento my wishlist

When users log in and click on my wishlist link, they display the products. But it also displays disabled products. I want to display only included products in my wishlist. Can anyone suggest me how to modify the code so that it only shows allowed products in my wishlist area.

+3


source to share


1 answer


You will probably have to extend this class Mage_Wishlist_Model_Wishlist

and override the method getItemCollection

by adding a filter by status. Something like this (untested, just added the last method call):

$this->_itemCollection =  Mage::getResourceModel('wishlist/item_collection')
             ->setStoreId($this->getStore()->getId())
             ->addWishlistFilter($this)
             ->addAttributeToFilter(
                 'status',
                  array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
             );

      



Note that this would exclude disabled products every time you download a collection of wishlist items, not only from the wishlist page, but from potentially anywhere you display it, which I think is what you want.

+1


source







All Articles