This is an old revision of the document!


Customizing PrestaShop v1.7 for use with LSCWP

PS1.7 introduces {widget} and {widget_block} that can be used in smarty template directly. (ref: http://developers.prestashop.com/themes/smarty/helpers.html#widgets) However, if this block is an ESI block, it has to be hole punched. Currently this cannot be auto captured. You have to manually place LSCache hooks to mark the begin and end of ESI block.

LSCache has to rely on hooks triggered to do the ESI injection. The default “classic” template still uses hooks for Cart (ps_shoppingcart) and Login (ps_customersignin) block. So no need to change any template files.

If module ps_shoppingcart and ps_customersignin are not triggered through hooks, but through widget or widget_block, you have to manually update the template file

Wrap around {widget name=“ps_customersignin”} With

{hook h="litespeedEsiBegin" m="ps_customersignin" field="widget"}{widget name="ps_customersignin"}{hook h="litespeedEsiEnd"}

If the widget also include a hook parameter, you need to include that in litespeedEsiBegin as well. For eg.

{widget name="module_name" hook=”specific_hook”}

Will change to

{hook h="litespeedEsiBegin" m="module_name" field="widget" hook=”specific_hook”}{widget name="module_name"}{hook h="litespeedEsiEnd"}

For widget_block, if there’s any html code, that will need to put aside into a template file. {widget_block name=”module_name”} Smarty / html {/widget_block}

If we want to hole punch this part, and later on to regenerate the content through ESI request, we need to place ESI begin and end marker around and put all the smarty/html in a template file. So it will look like {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”}

The content in “template_path.tpl” needs to be exactly same as Smarty/html part.

Let’s take “wholesale” template as an example. Let’s say the header.tpl use varient 1, the actual header template is {include file='_partials/_variants/header-1.tpl'} For this part

          <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>

Needs to be replaced to

          <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>
  • Admin
  • Last modified: 2017/09/29 16:19
  • by Lisa Clarke