-
Notifications
You must be signed in to change notification settings - Fork 7
Description
I noticed a problem after enabling "IsAnchor" on our root category (with thousands of products). It caused the Advanced Search page to seem to lock up / consume all ram (til it reached PHP memory_limit).
Currently debugging, but it looks as though in this case, when on the advanced search page (before a search is made) a large collection is created by digital_data_layer_after_content.phtml
This is caused by
// Grab product list data (from category and search pages)
$that = Mage::getBlockSingleton('catalog/product_list');
if (!$that) return;
$_productCollection = $that->getLoadedProductCollection();
which on our advanced search page before a search is done is the code above is making a collection from this query
SELECT `e`.*, `cat_index`.`position` AS `cat_index_position`, price_index.price AS `indexed_price`, `price_index`.`price`, `price_index`.`tax_class_id`, `price_index`.`final_price`, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS `minimal_price`, `price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price` FROM `catalog_product_entity` AS `e` INNER JOIN `catalog_category_product_index` AS `cat_index` ON cat_index.product_id=e.entity_id AND cat_index.store_id=1 AND cat_index.visibility IN(2, 4) AND cat_index.category_id = '2' INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0
which ends up with 2000+ products being loaded etc when it is later looped through. I cannot rule out another extension being involved in this, as I have not checked on a vanilla magento install, but the template should include some additional checks perhaps to see if we are on the actual search results page.