PrestashopA recent client asked for some modification to an online shop built on Prestashop. Now, Prestashop is built using Smarty 3 templating system. A rather weird system, with scattered bits and pieces of .tpl files, modules and CSS.

I won’t go into any more details, I’ll just show you how to add a list of “More/Other products in the same category” products with price and link to product page.

{if count($categoryProducts) > 0}<br />
<h2>{$categoryProducts|@count} {l s='other products in the same category:' mod='productscategory'}</h2>

<p>
{foreach from=$categoryProducts item='categoryProduct' name=categoryProduct}
<a href="{$link->getProductLink($categoryProduct.id_product, $categoryProduct.link_rewrite, $categoryProduct.category, $categoryProduct.ean13)}" title="{$categoryProduct.name|htmlspecialchars}">
{$categoryProduct.name|escape:'htmlall':'UTF-8'}
</a>
{if $ProdDisplayPrice AND $categoryProduct.show_price == 1 AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}
<span>
<span>({convertPrice price=$categoryProduct.displayed_price})</span>
</span>
{/if}
<br />
{/foreach}
</p>
{/if}

If you want to limit the number of characters for each product, use this line instead of the one above:

{$categoryProduct.name|truncate:15:'...'|escape:'htmlall':'UTF-8'}

submit to reddit

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

behance roo wordpress