In a multi-store Magento build each store view will have a corresponding cache folder in /media/catalog/product/cache, e.g. '1' for store '1'.

In the website I am currently working on we have an ever-growing list of store views and I can't help but thinking I need to do something about the ever expanding list of cache image folders. The images are always the same regardless of the store view, so the extra cache folders really are duplicates. I would prefer just the one set of cached images, in part because this will make the product quicker and the bandwidth lower (a customer swapping a store view will not require an extra set of images to be loaded).

So far I have done little to 'fix' the per-store product image cache. I have also not found any other writing online about this 'problem' and how to fix it. Does anyone have any idea?


The cache file url, is build in the method Mage_Catalog_Model_Product_Image::setBaseFile, by this piece of code:

   $path = array(
        $path[] = $this->getDestinationSubdir()

Later, the$path array is imploded into a string that becomes the path.
As you can see, the store id is part of the array.
You can rewrite this method and remove the line Mage::app()->getStore()->getId(),.
This should solve your problem and you will have the same cache for all store views.

  • Thankyou for that, oddly enough I found that I had already had the extended code with the store id commented out of the array! This was on a module from a previous project, but I had totally forgotten I knew how to do this. Thanks again! – Henry's Cat Aug 4 '15 at 14:30
  • I also needed to reindex, clear caches and those normal Magento things. – Henry's Cat Aug 4 '15 at 15:05

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.