Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Disable Cache For Certain Blocks Or Parts? Rate Topic   - - - - -

 

Posted 22 June 2015 - 02:38 PM #1

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

the block type is HTML with Smarty support,

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

So a "Secure checkout" banner popups up whenever a user is inside the Cart or Checkout of my store.

Problem is that I have Caching on, and im on CS Cart version 4.3.2 now.

And this part is stored in the Cache, so It will not change according to a users "mode" location.

It will show the cached version. So "Secure checkout" only pops up when I entirely disable or empty the Cache.

Is there any way of disabling the Cache for certain parts of code or certain TPL files?

What is a better way of achieving this?

Thanks for thinking along!

Attached Thumbnails

  • secure checkout.PNG


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21726 posts

Posted 22 June 2015 - 03:32 PM #2

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
GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 

Posted 22 June 2015 - 07:41 PM #3

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!

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 21726 posts

Posted 23 June 2015 - 08:58 AM #4

You are welcome!
GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)