Question

I'd like to load products by IDs, but ignore the product visibility. So when loading a product collection I'd like to even have products in the collection that have visibility "Search".

On a related note: I am using a custom Catalog Block extending Mage_Catalog_Block_Product_List so I can get the product list by calling

Mage::app()->getLayout()->createBlock('catalog/product_list_xyz')->setTemplate('catalog/product/list.phtml')

Inside my custom catalog type block I'm using Mage::getModel('catalog/layer')->prepareProductCollection($collection); Is there any way to "reset" the visibility filter?

Was it helpful?

Solution

This question is related to collection - Load visible and invisible products at once.

To reset the visiblity filter, try this:

$_productCollection->setVisibility(null);

You can change the filter using the following code:

$_productCollection->setVisibility(array(
    Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
    Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG,
    Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE
);
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top