Question

We currently use a "workaround" to cache our product view pages, as we have only a couple of configurable products with big collections it made sense to us at the time to create a couple of templates with the below code in to achieve caching on the product page.

<block type="catalog/product_view" name="product.info" template="catalog/product/view.phtml">
                    <action method="setCacheLifetime">
                        <lifetime>86400</lifetime>
                    </action>
    <block type="review/product_view_list" name="product.info.product_additional_data" as="product_review" template="review/product/view/list.phtml">
    <block type="review/form" name="product.review.form" as="review_form"/>
</block>

This as I say works fine at the time but we're changing our product offering making this workaround messy and more incorrect than what it was to start with. I don't want to go installing hefty FPC apps and modules just for 1 page, so can anyone advise on a sensible way to cache the product_view block to ensure that each time I load a different product the same cached block isn't shown for each?

Cheers

Was it helpful?

Solution

I managed to solve this with help from http://inchoo.net/ecommerce/magento/magento-block-caching/ which basically does what I wanted.

I created a new module, extended the core Mage_Catalog_Block_Product_View and added the functions provided in the module from Inchoo. This then on loading of the page creates a cache entry in var/cache like this mage---d9a_PRODUCT_INFO_STORE1_PRODUCT2663 which prevents the problem I had before of the same cache file being called for all product views.

Hope this helps someone else.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top