Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
litespeed_wiki:cache:lscps:customization_1_7 [2017/09/29 18:03]
Lisa Clarke
litespeed_wiki:cache:lscps:customization_1_7 [2020/08/11 19:15] (current)
Lisa Clarke Redirect to new Documentation Site
Line 1: Line 1:
-====== Customizing PrestaShop v1.7 for use with LSCWP ====== +~~REDIRECT>​https://docs.litespeedtech.com/lscache/lscps/settings/~~
- +
-PrestaShop v1.7 [[http://developers.prestashop.com/themes/smarty/helpers.html#​widgets|introduces]] ''​{widget}''​ and ''​{widget_block}''​ elements that can be used in Smarty templates directly. +
- +
-To ensure a hole is punched for a widget, you must define it as an ESI block. Currently, this can not be automated. You will have to manually place LSCache hooks to mark the beginning and the end of each ESI block in the template. LSCache relies on these hooks to trigger the ESI injection.  +
- +
-===== Cart and Login Widgets as ESI Blocks ===== +
- +
-The Cart (''​ps_shoppingcart''​) and Login (''​ps_customersignin''​) blocks already have hooks defined in the default “classic” template so there is no need to change template files for those particular blocks in that particular template. If ''​ps_shoppingcart''​ and ''​ps_customersignin''​ are not triggered through hooks, but through ''​{widget}''​ or ''​{widget_block}'',​ you //will// have to manually update the template file. +
- +
-Surround ''​{widget name="​ps_customersignin"​}''​ with ESI hooks like so: +
- +
-<​code>​ +
-{hook h="​litespeedEsiBegin"​ m="​ps_customersignin"​ field="​widget"​}{widget name="​ps_customersignin"​}{hook h="​litespeedEsiEnd"​} +
-</​code>​ +
- +
-If the widget also includes a hook parameter, you need to include that in ''​litespeedEsiBegin''​ as well. For example, ''​{widget name="​module_name"​ hook=”specific_hook”}''​ +
- +
-will change to  +
- +
-<​code>​ +
-{hook h="​litespeedEsiBegin"​ m="​module_name"​ field="​widget"​ hook=”specific_hook”}{widget name="​module_name"​}{hook h="​litespeedEsiEnd"​} +
-</​code>​ +
- +
-===== Widget Blocks as ESI Blocks ===== +
- +
-For ''​{widget_block}'',​ if there’s any html code, that will need to be put aside into a template file. So this: +
- +
-<​code>​ +
-{widget_block name=”module_name”} +
-Smarty / html +
-{/​widget_block} +
-</​code>​ +
- +
-becomes this: +
- +
-<​code>​ +
-{hook h="​litespeedEsiBegin"​ m="​module_name"​ field="​widget_block"​ tpl="​template_path.tpl"​}{widget_block name=”module_name”} +
-Smarty / html +
-{/​widget_block}{hook h="​litespeedEsiEnd"​} +
-</​code>​ +
- +
-where the contents of ''​template_path.tpl''​ exactly match what is written in the ''​Smarty / html''​ section. +
- +
-This allows us to use ESI to punch a hole for this widget and regenerate the content later. +
- +
-Let’s take the “wholesale” template as an example, and say ''​header.tpl''​ uses variant 1. The actual header template is ''​{include file='​_partials/​_variants/​header-1.tpl'​}''​ +
- +
-For this part you would replace this: +
- +
-<​code>​ +
-<div class="​col {if $iqitTheme.h_logo_position == '​left'​}col-auto{/​if} col-header-right text-right">​ +
- {widget_block name="​ps_shoppingcart"​} +
- {include '​module:​ps_shoppingcart/​ps_shoppingcart-default.tpl'​} +
- {/​widget_block} +
- {widget name="​ps_customersignin"​} +
- {hook h='​displayHeaderRight'​} +
-</​div>​ +
-</​code>​ +
- +
-with this: +
- +
-<​code>​ +
-<div class="​col {if $iqitTheme.h_logo_position == '​left'​}col-auto{/​if} col-header-right text-right">​ +
- {hook h="​litespeedEsiBegin"​ m="​ps_shoppingcart"​ field="​widget_block"​ tpl="​module:​ps_shoppingcart/​ps_shoppingcart-default.tpl"​} {widget_block name="​ps_shoppingcart"​} +
- {include '​module:​ps_shoppingcart/​ps_shoppingcart-default.tpl'​} +
- {/​widget_block}{hook h="​litespeedEsiEnd"​} +
- {hook h="​litespeedEsiBegin"​ m="​ps_customersignin"​ field="​widget"​}{widget name="​ps_customersignin"​}{hook h="​litespeedEsiEnd"​} +
- {hook h='​displayHeaderRight'​} +
-</​div>​ +
-</​code>​+
  • Admin
  • Last modified: 2017/09/29 18:03
  • by Lisa Clarke