getButterfly Logo getButterfly

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.

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

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

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


Subscribe to getButterfly Blog

Once a week or so we send an email with our best content. We never bug you, we just send you our latest piece of content.

If you found any value in this post, agree, disagree, or have anything to add - please do. I use comments as my #1 signal for what to write about. Read our comment policy before commenting! Comments such as "Thank you!", "Awesome!", "You're the man!" are either marked as spam or stripped from URL.

Leave a reply