3

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.

  • Are you sure that the issue is related to the Blocks Caching? More likely, it is related to Full Page Caching – MagestyApps Dec 14 '16 at 12:31
  • Yes it may be. i have used Lesti FPC from here github.com/GordonLesti/Lesti_Fpc – Ketan Borada Dec 14 '16 at 12:39
  • Please suggest me hint,if you know regarding it – Ketan Borada Dec 14 '16 at 12:40
7
+50

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

  • i have tried this code it braek my page {{block type="core/template" cache_lifetime=0 cache_tags="CACHE_TAG_MY_BLOCK" cache_key="my-block" title="BEST SELER!!!" sku="ASS030530010" template="catalog/product/menuproduct.phtml"}} – Ketan Borada Dec 23 '16 at 5:44
  • I'm Configuring Hussy_Coding extension once it configured Lesti_FPC will removed. – Ketan Borada Dec 23 '16 at 5:47
  • @KetanKpBorada the code posted was really just an example that methods/variables can be set sometimes with the Block CMS Widget directives {{...}}. Referring to the Hussy_Coding extension documentation what have you tried hole punch wise for this particular anonymous/generated block? If you pass the block_id in and have a <reference name="(insert block_id)">... you should be able to control the caching of the block, give AOE_TemplateHints a try to help determine block names, and cache directive set on the block or not. – B00MER Dec 23 '16 at 5:56
  • My demo site is solaireshop.fr/devsite/index.php(evolved installed).NO,it's not Hussy Coding issue.This issue occurs before i have installed this extension.I have paste my block code above in comment.please reply me after insert cache variable that you have set in answer – Ketan Borada Dec 23 '16 at 6:20
  • If it is pre-existing issue, then perhaps this may help with what you are needing: stackoverflow.com/a/7972059/158325 It is a means of adding store & currency to the cache_key. Also be sure to disable the Lesti_FPC when testing to avoid false positives. Obviously perform in a dev/local environment if possible. – B00MER Dec 23 '16 at 6:37
4

that worked for me magento 1.9.2.3, tried for cms_menu cms block (file app/design/frontend/rwd/default/layout/cms.xml)

<cms_menu>
    <reference name="left_first">
        <block type="cms/block" name="cms_menu" >
            <action method="setBlockId"><block_id>cms_menu</block_id></action>
            <action method="setCacheLifetime"><lifetime>null</lifetime></action>                                                                                              
        </block>
    </reference>
</cms_menu>

then change

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

to

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

notice cache_lifetime variable

Update: inside cms_menu static block I have

<div class="block block-cms-menu">
<div class="block-title">
    <strong><span>Company</span></strong>
</div>
<div class="block-content">
    <ul>
        <li><a href="{{store url="about-magento-demo-store"}}"><span>About Us</span></a></li>
        <li><a href="{{store url="contacts"}}"><span>Contact us</span></a></li>
        <li><a href="{{store url="customer-service"}}"><span>Customer Service</span></a></li>
        <li><a href="{{store url="privacy-policy-cookie-restriction-mode"}}"><span>Privacy Policy</span></a></li>
    </ul>
</div>
</div>{{block type="core/template" cache_lifetime="null" title="BEST SELER!!!" sku="ASS030530010" template="catalog/product/menuproduct.phtml"}}

now if I change app/design/frontend/rwd/default/template/catalog/product/menuproduct.phtml i don't need cache flush for changes to be visible on frontend - see http://magento1.8.goivvy.com:8081/about-magento-demo-store/ gibberish at the left is my menuproduct.phtml

  • In my situation i need to except both static block and .phtml file. i have tried it already. – Ketan Borada Dec 14 '16 at 12:37
  • see updated answer – Konstantin Gerasimov Dec 14 '16 at 12:53
  • Thanks Konstantin Gerasimov, this menu is comes from static block,please update your answer. – Ketan Borada Dec 14 '16 at 13:02

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.