Jump to content

Prestashop + Smarty Cache is a sham?


Recommended Posts

Alright, so we all know there's pretty little trigger on the back-office Preferences > Performance tab. It's called "Cache" (inside the Smarty box). You have the option for Yes and No, and a cute note that says "Should be enabled except for debugging.".

 

BUT, in Prestashop out-of-the-box file structure, /config/smarty.config.inc.php has $smarty->caching *hardcoded* to "false".

 

If you want to try to be clever and turn it on, or even set it to use the config value (set in the back-office), you'll be rewarded with a completely broken template (in my case anyway).

 

What's the story here, Prestashop?

Link to comment
Share on other sites

So you're confirming that smarty cache is not actually used in prestashop (hence the hardcoded $smarty->caching = false)?

 

Yep, only in "blockcategories" and the Smarty's configuration is properly re-written w/ this function in Tools.php:

 

public static function enableCache($level = 1)
{
[...]
if (!Configuration::get('PS_SMARTY_CACHE') || ($smarty->force_compile == 0 && $smarty->caching == $level))
return;
[...]

 

 

Regards,

Link to comment
Share on other sites

I would like to add, while you are calling it a sham, 3rd party modules can be written to take advantage of it also. Some modules obliviously would break using it ie. shipping modules, payment modules, filtering modules. But it can be leveraged with sliders and other type of modules. It is not ideal, but it can be used.

Link to comment
Share on other sites

@Bruno: I was unaware of the enableCache function inside the Tools class. This does change things a bit. But I do think its very misleading that there is a toggle switch for smarty cache in the backoffice (and that every tutorial i've seen online says to enable it for the best performance) without documentation/explanation that it only applies to blockcategories by default .

 

@DesignHaus42: I was asking if it was a sham, not saying it was :). In any case the answer seems to be "sort of".

Link to comment
Share on other sites

  • 1 month later...

hi Bruno, "the best thing is to force compile_check to true"... can you explain why the best thing and what exactly does this compile_check ? thanks

 

maybe do you mean

 

$smarty->caching = true;
...
$smarty->compile_check = true;

 

???

 

no, it breaks the same my installation test...

and well... what the benefit of $smarty->compile_check = true; only ?

Edited by mmsh (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...