Magento 1.9 Cache – How to Disable Cache for Static Block

cachemagento-1.9menupricestatic-block

I have one file that called from static block in which i display product information on menu.

{{block type="core/template" title="BEST SELER!!!" sku="ASS030530010" template="catalog/product/menuproduct.phtml"}}

Price changed by Geo ip(country wise). But as it call from static block it cant change price when i change country flag, it display cached price on menu but on detail page it changes.

I have enable cache from admin
enter image description here

I want to exclude it from cache.

<reference name="head">
            <block type="catalog/product" name="menu.product" as="related_cat" template="catalog/product/menuproduct.phtml">
                <action method="unsetData"><key>cache_lifetime</key></action>
                <action method="unsetData"><key>cache_tags</key></action>
            </block>
        </reference>

Above Solution doesn't work any more.

Best Answer

Judging by your admin screenshot, is there any reason you are using two FPCs? Lesti_FPC and Evolved Caching? Normally only one FPC is needed, and judging by Evolved caching documents it has more support for things like Varnish, etc. compared to Lesti_FPC.

Basically you are doubling the work of the caching mechanisms and over complicating caching by having two FPCs you are having to manage for expiration and hole punching.

Normally the below XML layout on your static blocks will handle the hole punching:

<reference name="myblock"><action method="unsCacheLifetime"></action></reference>

But this also depends if the FPCs you are using rely on Magento Blocks caching for hole punching and entire page expiration. I would recommend disabling one of the FPC's you are using and refer to the documentation on the one planning on leaving in place in regards to hole punching a dynamically created block.

You can also specify each of the usual cache details for each block:

{{block type="core/template"
        template="template/category-block.phtml"
        block_id="my-block"
        cache_lifetime=0 
        cache_tags="CACHE_TAG_MY_BLOCK"
        cache_key="my-block"}}

More details:

You can also use AOE_TemplateHints to help identify blocks and see the caching details of each block in question: https://github.com/fbrnc/Aoe_TemplateHints

Related Topic