I have enabled my products visibility for both list page and search. But when I use


the products does not displayed.

What does addVisibleInSiteFilterToCollection do?



I have installed a module. I think that module checks the products visibility with function addVisibleInSiteFilterToCollection. But no products are displayed. I have checked my all products are visible in both catalog and search. I am curious what exactly this function does? Because when I comment this function I can see my products.

2 Answers 2


What happens in the function addVisibleInSiteFilterToCollection is that the appropriate visibility filters are added to the collection.

When calling addVisibleInSiteFilterToCollection you need to pass in a collection. This collection then gets used as follows.


The function getVisibleInSiteIds returns an array containing the constants for each type of visibility.


Now the function setVisibility us slightly more complex. What it does is set these values to a protected array of all collection limitations and then sets all limitations against the collection.

$this->_productLimitationFilters['visibility'] = $visibility;

But what this really boils down to is simply adding a filter to the collection.

if (isset($filters['visibility']) && !isset($filters['store_table'])) {
    $conditions[] = $this->getConnection()
        ->quoteInto('cat_index.visibility IN(?)', $filters['visibility']);

Puiysh,Please use the below

$collection->setVisibility(Mage::getSingleton('catalog/product_visibility') ->getVisibleInSiteIds());

I Suggestion please set current product collection Visibility using ;


Which will only filter ('Catalog, Search') and ('Search') visibility status Products


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.