How to disable your PrestaShop Smarty Cache PrestaShop?

Leave a Comment
This post is an introduction to PrestaShop smarty cache. This is a tip for a beginner PrestaShop owner or developer.

Basic information about Smarty
Smarty is PHP template engine, with smarty, you are able to separate business/program logic from your GUI design(theme or template). PrestaShop utilize smarty engine so that you are able to switch/change your PrestaShop theme easily. The theme files (GUI design) are saved in separated themes folder, and with .tpl file extension.

For example (PrestaShop standard theme)

But in order to make your theme file work, it has to be compiled into native PHP file before your web server can render page HTML contents to your browser client. Compiling the themes file will reduce your server performance. In order to minimize the performance influences, PrestaShop uses smarty function so that the compilation is done only at first time of usage of theme file.

Potential issues

As mentioned above, when smarty cache is turned on, the compilation will only be done at first time use of the theme file. That means when you make changes on the theme file, the new change you applied to the theme file will not be in effect.

By default, the smarty cache is turned on after you install your PrestaShop. If you do not know there is a smarty cache is in action, you may not know why your changes on theme file does not reflect to your PrestaShop pages. If you want to make changes and test the changes, you will have to turn off the smarty cache temporary.

How to turn off or turn on smarty cache?

PrestaShop 1.3x or lower
To switch smarty cache in PrestaShop 1.3x or lower, you need to change following two lines in smarty configuration file as listed below

Configuration file location:

To turn off, change lines to
(when your make changes on your store theme files)
$smarty->caching = false;
$smarty->force_compile = true;

To turn on, change lines to
(when your store is in production mode, no changes will be made)
$smarty->caching = true;
$smarty->force_compile = false;

PrestaShop 1.4x or higher
If you are using PrestaShop 1.4x or higher, you don't need to changes file directly, you can make changes from you back office directly.

log in to your back office
click Preferences tab
click Performance tab
switch the smarty cache on or off and click "Save" button"

Recommended setting of smarty cache
It is highly recommend to leave your smarty cache on if your store is in production or you are not making any changes to any themes files. This will rapidly improveyour store performances.

Best Prestashop Hosting Recommendation

One of the most important things when choosing a good Prestashop hosting is the feature and reliability. HostForLIFE is the leading provider of Windows hosting and affordable Prestashop, their servers are optimized for PHP web applications such as the latest Prestashop version. The performance and the uptime of the hosting service are excellent and the features of the web hosting plan are even greater than what many hosting providers ask you to pay for.

At HostForLIFEASP.NET, customers can also experience fast Prestashop hosting. The company invested a lot of money to ensure the best and fastest performance of the datacenters, servers, network and other facilities. Its datacenters are equipped with the top equipments like cooling system, fire detection, high speed Internet connection, and so on. That is why HostForLIFEASP.NET guarantees 99.9% uptime for Prestashop. And the engineers do regular maintenance and monitoring works to assure its Prestashop hosting are security and always up.
Next PostNewer Post Previous PostOlder Post Home


Post a Comment