How to add tags (with link) to product page?

prestashop product tags on product page

Today i want to show you how to display product tags on product page in your store based on PrestaShop engine. I will show how to achieve this in PrestaShop in version 1.5.x. I will use really simple method so each merchant can do this without any special knowledge about php. The most important thing in this case is fact, that I will only modify template file - which mean that you can achieve this without core modification!



If you are not familiar with theme modifications, feel free to check two modules that are related to tags on product pages 

Product page icons
(click to open module page)

Show tags on product pages
(click to open module page)



What I mean by tags on product page?

picture below shows blue labels with product tags.

You can define own tags for each product on product edit page in back office
tags prestashop product page



First step: open the product.tpl file

As i said this tutorial will show you in the simplest way how to display product tags on product page without prestashop core modyfications. Go to your theme directory and open product.tpl file. This file is a smarty template document, where is defined the design of the each product page. You can find there html language with smarty code. 


right after the

<div id="primary_block" class="clearfix">

add the code:

<ul class="producttags">
    {foreach from=Tag::getProductTags(Tools::getValue('id_product')) key=k item=v}
        {foreach from=$v item=value}
            <li><a href="{$link->getPageLink('search', true, NULL, "tag={$value|urlencode}")}">{$value|escape:html:'UTF-8'}</a></li>

Code above add to your product page <ul> list with <li> elements. In each <li> element will appear link to the tag search page. As you see, there are two {foreach} loops. This is most important thing in this code. Okay, so I included the list with tags, now I will show how to create styles to display tag as a blue label.


CSS styles for tags list

In this case you have to add css code that i pasted below to the global.css file located in your theme directory. Just open this file and prepend code:


.producttags {

.producttags li, .producttags a{

.producttags a{
	padding:0 10px 0 12px;
.producttags a:visited{

.producttags a:before{
	border-color:transparent #0089e0 transparent transparent;
	border-width:12px 12px 12px 0;		

.producttags a:after{
	-moz-box-shadow:-1px -1px 2px #004977;
	-webkit-box-shadow:-1px -1px 2px #004977;
	box-shadow:-1px -1px 2px #004977;

.producttags a:hover{background:#555; text-decoration:none;}	

.producttags a:hover:before{border-color:transparent #555 transparent transparent;}

Save changes and refresh your product page. The nice looking tag labels should appear. That's all! If you've got any questions related to the tags on product page - feel free to ask in the comments feature below.

author milos myszczuk
Article by Milosz Myszczuk PrestaShop expert, official PrestaShop community moderator. PHP developer, specialist in relative and spatial databases management, GIS Analyst, CEO & founder of VEKIA interactive agency. Read more about VEKIA company
If you like my articles and want much more valuable tips, feel free to send me donation
1.4 version 1.4.11 1.6 404 addon admin advertise ahref ajax alpha animation api app application authentication back office backup badge banner basics block bootstrap button cache carrier cart catalog category certificate changelog chat class clear client clip cms code colors columns comments configuration contact container content controller cookie counter country coupon css csv currency customer dashboard database debug default delete delivery desktop developer device disable discount displayNav displayTop download dynamic editor effect empty encrypt engine error exchange exclude export facebook faceshop fade fancoupon fancybox fanpage fatal feature feed field file fix fixed font footer free friendly url front ftp full gallery generate gift global godaddy google google+ gray grid groupon header help hide highlight homefeatured homepage hook hosting hover howto htaccess html html5 ID image import include input instagram installation integration iPhone issue javascript jquery kgb knowhow languages law left likebox link list livingsocial loading log login logo loyality mail mailing maintenance manufacturer marketing marquee mcrypt menu meta mobile modification module movie moving multilanguage multiupload must have mysql news newsletter notification number open graph order override page password performance PHP phpmyadmin picture pinterest plugin popup post prestashop prestashop 1.0 prestashop 1.1 prestashop 1.2 prestashop 1.3 prestashop 1.4 prestashop 1.5 price rules problem product profile promotion proslider purifier quantity query quick tip random rates register reinsurance release reporting reset responsive restore results ribbon rich text right sales search security seo service shadow share shipping shop shopmania slider smarty social networks SQL SSL statistics stock store style subcategory superuser support switcher tab tablet tag tax template text theme tinyMCE tips and tricks tpl tracking translations tree trends trigger tumblr tutorial twitter update upgrade upload variables video visits voucher vulnerability web2print wide widget width window wishlist wysiwyg youtube zip zopim