Differences

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

Link to this comparison view

Both sides previous revision Previous revision
litespeed_wiki:cache:lscps:customization_1_7 [2019/09/18 20:06]
Lisa Clarke Removed instructions for widgets
litespeed_wiki:cache:lscps:customization_1_7 [2020/08/11 19:15]
Lisa Clarke Redirect to new Documentation Site
Line 1: Line 1:
-====== Customizing PrestaShop v1.7 for Use with LSCPS ====== +~~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 be automated in widgets, but not in widget blocks. 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. +
- +
-**Note**:​The cart (''​ps_shoppingcart''​) and login (''​ps_customersignin''​) blocks are the only blocks impacted by the issue as of this writing.  +
- +
-Both cart and login 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. However, if ''​ps_shoppingcart''​ and ''​ps_customersignin''​ are //not// triggered through hooks or through ''​{widget}'',​ but through ''​{widget_block}'',​ you //will// have to manually update the template file. +
- +
-===== Widget Blocks as ESI Blocks ===== +
- +
-If there’s any HTML code, it 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. +
- +
-===== Example: Warehouse Theme ===== +
- +
-Let’s take the “warehouse” template as an example, and say ''​header.tpl''​ located at ''​themes/​warehouse/​templates/​_partials/​header.tpl''​ uses variant 1. +
- +
-in ''​header.tpl'': ​  +
-      {if $iqitTheme.h_layout == 1} +
-        {include file='​_partials/​_variants/​header-1.tpl'​} +
-      {/if} +
- +
-As the above code indicated, ​ the actual header template is ''​{include file='​_partials/​_variants/​header-1.tpl'​}''​ +
- +
-You will need to modify ''​_partials/​_variants/​header-1.tpl''​. Make sure you backup your file before doing any changes. +
- +
-<​code>​ +
-vi _partials/​_variants/​header-1.tpl +
-</​code>​ +
- +
-==== ps_shoppingcart as widget_block ==== +
-Replace the following:​ +
- +
-<​code>​ +
- {widget_block name="​ps_shoppingcart"​} +
- {include '​module:​ps_shoppingcart/​ps_shoppingcart-default.tpl'​} +
- {/​widget_block} +
-</​code>​ +
- +
-with: +
- +
-<​code>​ +
- {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"​} +
-</​code>​ +
- +
-==== ps_customersignin as widget_block ==== +
-Replace the following:​ +
-<​code>​ +
-         ​{widget_block name="​ps_customersignin"​} +
-         ​{include '​module:​ps_customersignin/​ps_customersignin-btn.tpl'​} +
-         ​{/​widget_block} +
-</​code>​ +
- +
-with: +
-<​code>​ +
-         {hook h="​litespeedEsiBegin"​ m="​ps_customersignin"​ field="​widget_block"​ tpl="​module:​ps_customersignin/​ps_customersignin-btn.tpl"​}  +
-         ​{widget_block name="​ps_customersignin"​} +
-         ​{include '​module:​ps_customersignin/​ps_customersignin-btn.tpl'​} +
-         ​{/​widget_block} +
-         {hook h="​litespeedEsiEnd"​} +
-</​code>​ +
- +
-==== Making Changes to Multiple Templates ==== +
-Sometimes ''​header.tpl'',​ located at ''​themes/​warehouse/​templates/​_partials/​header.tpl'',​ may use multiple variants, like so: +
- +
-    {if $iqitTheme.h_layout == 1} +
-        {include file='​_partials/​_variants/​header-1.tpl'​} +
-    {elseif $iqitTheme.h_layout == 2} +
-        {include file='​_partials/​_variants/​header-2.tpl'​} +
-    {elseif $iqitTheme.h_layout == 3} +
-        {include file='​_partials/​_variants/​header-3.tpl'​} +
-    {elseif $iqitTheme.h_layout == 4} +
-        {include file='​_partials/​_variants/​header-4.tpl'​} +
-    {elseif $iqitTheme.h_layout == 5} +
-        {include file='​_partials/​_variants/​header-5.tpl'​} +
-    {elseif $iqitTheme.h_layout == 6} +
-        {include file='​_partials/​_variants/​header-6.tpl'​} +
-    {elseif $iqitTheme.h_layout == 7} +
-        {include file='​_partials/​_variants/​header-7.tpl'​} +
-    {/if} +
- +
-In this case, you will need to back up all seven header files, and make changes to these templates from ''​header-1.tpl''​ to ''​header-7.tpl'',​ the same way as shown above. ​+
  • Admin
  • Last modified: 2020/08/11 19:15
  • by Lisa Clarke