Disable Cache For Certain Blocks Or Parts?

In my Default Header, i placed a Grid, with a block in there,



the block type is HTML with Smarty support,



with the code:

<br />
{if $mode eq 'cart' or $mode eq 'checkout'}<br />
<div class="secure-icon">Secure checkout</div><br />
{/if}<br />

```<br />
<br />
So a "Secure checkout" banner popups up whenever a user is inside the Cart or Checkout of my store.<br />
<br />
Problem is that I have Caching on, and im on CS Cart version 4.3.2 now.<br />
<br />
And this part is stored in the Cache, so It will not change according to a users "mode" location.<br />
<br />
It will show the cached version. So "Secure checkout" only pops up when I entirely disable or empty the Cache.<br />
<br />
Is there any way of disabling the Cache for certain parts of code or certain TPL files? <br />
<br />
What is a better way of achieving this?<br />
<br />
Thanks for thinking along!<p><a href="127.0.0.1/uploads/monthly_06_2015/post-24790-0-50380100-1434983878.png">secure checkout.PNG</a></p>

Try open the app\schemas\block_manager\blocks.php file and replace:



'smarty_block' => array (
'content' => array (
'content' => array (
'type' => 'simple_text',
'required' => true,
)
),
'templates' => 'blocks/smarty_block.tpl',
'wrappers' => 'blocks/wrappers',
'multilanguage' => true,
'cache' => true
),




with



'smarty_block' => array (
'content' => array (
'content' => array (
'type' => 'simple_text',
'required' => true,
)
),
'templates' => 'blocks/smarty_block.tpl',
'wrappers' => 'blocks/wrappers',
'multilanguage' => true,
'cache' => false
),




Then clear the cache and check the result

Perfect fix! And luckely without having to shut down the cache for a big part of the webshop, only Smarty Blocks are not cached now,

So performance is still super.



This is the second time in 2 days the eComLabs saves the day, thanks everyone for reading!

You are welcome!