Note that there are some explanatory texts on larger screens.

plurals
  1. POPrestashop - create link to the category that a product belongs to
    primarykey
    data
    text
    <p>I'm fairly new at prestashop. On the home page I am using the "Specials Center" module which just displays a list of products that are on sale. I wanted to show which category the product belongs to. I edited SpecialsCenter.tpl and used this code: </p> <pre><code>&lt;a href="#"&gt;Category: {$Specials.category}&lt;/a&gt;&lt;/h2&gt; </code></pre> <p>This correctly displays the corresponding category name for which the specific product belongs to. See image: <a href="http://i.imgur.com/YVY38" rel="nofollow">Product with category</a>. The only thing I am having trouble with is creating a link to that category. Should be fairly simple but Prestashop forums seem so vacant. All questions. No answers. What is the variable to use to link to the category page?</p> <p>Thanks for your help. </p> <p>Having done a little more research...this is where I am now...</p> <pre><code>&lt;a href="{$link-&gt;getCategoryLink({$Specials.id_category}, {$Specials.category})}"&gt;Category: {$Specials.category}&lt;/a&gt; </code></pre> <p>So this outputs this link: mysiteurl/0-laptops - this is partly correct, except the <strong>category ID</strong> is wrong. The id for the category laptops is 4. It should be this: mysiteurl/<strong>4</strong>-laptops. So the first smarty tag <code>{$Specials.id_category}</code> is incorrect. I need to know how to draw the category ID using a variable of some kind. So it should be something like this: </p> <pre><code>&lt;a href="{$link-&gt;getCategoryLink('category-id', {$Specials.category})}"&gt;Category: {$Specials.category}&lt;/a&gt; </code></pre> <p>Thanks again!!! :)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload