4
votes

Problem : Product count is not correct on Layered Navigation in List Page for all attribute but category product counts are fine.

Magento Version : 1.7.0.2

I have removed all override of catalog file and folder and also uploaded magento core catalog file to check that is it problem of core file but Still i am not getting issue.

Example :

Manufacturer

Manufacture 1 (90)

Manufacture 2 (82)

Manufacture 3 (223)

But when i click on Manufacture 1 there will be 3 products.

One thing i found, in below mentioned code if I change Mage::getSingleton('catalog/layer'); to Mage::getModel('catalog/layer'); than product count is fine but product are not display according to filter.

app/code/core/Mage/Catalog/Block/Layer/View.php Line no - 149

public function getLayer()
{
   return Mage::getSingleton('catalog/layer');
}

I appreciate for any help.

Thanks in advance.

1
+1 for the question. did you manage to fix it? I am getting same issue and not sure how to fix it :( - Damodar Bashyal

1 Answers

0
votes

That's wrong to change layer singleton to the model. If it helps for you it means you break layer somewhere in your custom code... So this seems to be a problem in your local code. But first did you try to do reindex? Please start with reindexing product flat data and attributes. Then try to debug. Counts for attributes are calculated here: app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Attribute.php:83 in method getCount(). Try to catch select object and review what actually it selects. xDebug is very useful for cases like this. If you don't use it then you can do in specified method just before return smth like

$a = (string) $select;
die($a);

Then you would have counts select and you can analyze it. Good luck!