Menu

How to Disable Cache on Specific Pages/Features in Page Cache Pro

The Page Cache Pro module for PrestaShop offers powerful caching features to enhance your website's speed and performance. However, there may be instances where you need to disable cache for certain pages or features to ensure that dynamic content is always up-to-date. This guide will walk you through the process of disabling cache for specific modules or hooks, ensuring your website delivers the most accurate and current information.

Step-by-step guide to disable cache on specific pages/features

Step 1: Open the module configuration page

Step 2: Navigate to "Page cache" on the module main menu

Step 3: Locate and click on the "Exceptions" tab. You'll see a list of modules and the hooks they are associated with.

Step 4: Find the module for which you want to disable cache. Activate the "Disable caching" option for that module or specific hooks.

Step 5: For modules with dynamic content, disable cache for specific hooks to keep data current.

For example, if you have a module that displays on-sale products, disable the cache for its hooks to avoid displaying expired products on sale as soon as it ends. To see which hooks a module uses, go to "Design > Positions" in your PrestaShop back office.

By following these steps, you’ll guarantee that your selected modules and hooks always display the freshest content, enhancing both accuracy and user experience on your website.

 

How does the "Initiate with empty content" option work?

When the "Initiate with empty content" option is enabled, the module's content won't load at the same time as the rest of the website. Instead, the website first shows empty placeholders or a basic layout where the module's content will be.

After a brief delay, usually a few milliseconds, the website uses Ajax to load and display the actual content. This method reduces the initial page load time, giving users a faster browsing experience while ensuring that the most current data is quickly displayed.

 

Example: Disabling cache and initiating with empty content for the "Wishlist Block" module's

Here's how you'd identify its associated hook and disable the cache:

  • Navigate to "Design > Positions" in your PrestaShop back office
  • Use the search bar to find the "Wishlist block" module.
  • Identify hooks: The "Wishlist block" module is associated with two hooks: “displayFooter” and “displayProductActions”.

AD_4nXdkcwxmS-3_Ia4fkajURgebcAgPWO5yYXRALWL6u5SebMIhXTQB42dIeK0a7n4ivfjXG21wyEWRZB9_zmbQKnpuWjWbaQ5hCRF9ZcMRgaDgy7qn3iJjhaQvceenKp71Mk9XErxc1QhxnSQtPljX6A1_ZWIJ?key=nzzIT_DMb2MWqSmIOtVRRQ

For example, you only want to disable cache and initiate with empty content for “displayFooter”:

  • Go to the "Page Cache" module's main menu and click on the "Exceptions" tab.
  • Find the "Wishlist block" module in the list.
  • Locate the “displayFooter” hook and activate the "Disable caching" and "Initiate with empty content" options for the “displayFooter” hook.

AD_4nXdIC_CNMa4H58ThWh0JMT1YMm_Hnxy5eDVsOFtQ7veu2cuJ2VOEbqrmdEw6-6JMjZeOOfkv8CT0Ez1-x-tD1xdjKA32eyY7F-4p5QYzo--RaaQH5xhLRxXpiH1X0dSVYUMWpMUAo4coVtQaYYlQxF0PbuFZ?key=nzzIT_DMb2MWqSmIOtVRRQ

After configuring these settings, the "displayFooter" hook for the "Wishlist block" module will load its content separately, reducing the initial load time and ensuring the content is always up-to-date.

  

By following this guide, you will be able to manage your website's caching more effectively, ensuring that critical content remains fresh and accurate. This will enhance your site's performance and provide a better experience for your users, keeping them engaged and satisfied with up-to-date information.

Nombre de vues: 17 vues