When I generate a Magento sitemap.xml, all the "not visible individually" products are showing up in the xml file. I indexed and refreshed my cache multiple times and this is not by default this way. Any ideas how to fix this? Thanks in advance.


This shouldn't happen.

The code that retrieves the product collection for sitemap is Mage_Sitemap_Model_Resource_Catalog_Product::getCollection().
In that method there is this filter that should exclude the products that are not visible and not active:

$this->_addFilter($storeId, 'visibility', Mage::getSingleton('catalog/product_visibility')->getVisibleInSiteIds(), 'in');
$this->_addFilter($storeId, 'status', Mage::getSingleton('catalog/product_status')->getVisibleStatusIds(), 'in');

Maybe you have a visibility set at the global level and a different one set at the store view level.
Check how a product looks like on the store view level that should not appear in the sitemap but does.

Also check if the code that retrieves the product collection is not overwritten.

| improve this answer | |
  • Ah I see, our client has indeed configured visibility wrong at the store level. Thanks for your help! – Benidorm Nov 21 '14 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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