djabollo Posted August 15, 2012 Share Posted August 15, 2012 Hi, i need to put product tags on product-list... unfortunately i can't find any module or tutorial how to get it. If anyone know how, please share the knowledge. I use presta 1.3. Best regards. Peter Link to comment Share on other sites More sharing options...
benjamin utterback Posted August 15, 2012 Share Posted August 15, 2012 Hello Peter, What do you exactly when you say product tags? like for SEO purposes? Link to comment Share on other sites More sharing options...
djabollo Posted August 15, 2012 Author Share Posted August 15, 2012 Hi Benjamin, my client wants to have all tags for every product in product-list, next to product description; clicking on the tag user will be able to get other list of product with the same tag. I'll add the search link to every tag, but i have no idea how to put tags on tpl file. I have a solution for product.tpl, but it doesn't work with product-list.tpl. Hope i explained clearly Sorry if my english is a little unclear. Link to comment Share on other sites More sharing options...
djabollo Posted August 17, 2012 Author Share Posted August 17, 2012 Can anyone help? As i wrote before... i need to show seo tags for every product on the product list page. How can i do this? Link to comment Share on other sites More sharing options...
Andrew R Posted September 23, 2012 Share Posted September 23, 2012 Hi there, you can do this by modifying Classes > Product.php. In the function getProductProperties, before the line: self::$producPropertiesCache[$cacheKey] = $row; add two lines: $row['tags'] = Tag::getProductTags((int)$row['id_product']); $row['tags'] = $row['tags'][(int)$id_lang]; In product-list.tpl, you can read the tags as an array e.g: {foreach from=$product.tags item=ptag} {/foreach} To read from product.tpl, the lookup is: {foreach from=$product->tags[$lang_id] item=ptag} {/foreach} Ideally you shouldn't modify core classes and override them instead but I've found some class overrides break so for the odd line of code, I just add it to the main class and note what I've changed. 1 Link to comment Share on other sites More sharing options...
fbascuiz Posted September 24, 2012 Share Posted September 24, 2012 Hi there, you can do this by modifying Classes > Product.php. In the function getProductProperties, before the line: self::$producPropertiesCache[$cacheKey] = $row; add two lines: $row['tags'] = Tag::getProductTags((int)$row['id_product']); $row['tags'] = $row['tags'][(int)$id_lang]; In product-list.tpl, you can read the tags as an array e.g: {foreach from=$product.tags item=ptag} {/foreach} To read from product.tpl, the lookup is: {foreach from=$product->tags[$lang_id] item=ptag} {/foreach} Ideally you shouldn't modify core classes and override them instead but I've found some class overrides break so for the odd line of code, I just add it to the main class and note what I've changed. Hello Andrew Maybe you can help me, i need to put the "main category" of the product above the price, i´m trying edit the product.tlp file but i don't know the code. Regards! Link to comment Share on other sites More sharing options...
Andrew R Posted September 24, 2012 Share Posted September 24, 2012 Hello Andrew Maybe you can help me, i need to put the "main category" of the product above the price, i´m trying edit the product.tlp file but i don't know the code. Regards! If you mean the direct parent category of the product, you'd use: {$category->name|escape:'htmlall':'UTF-8'} If you mean the root category, you can pick any out of the path. If you have a breadcrumb included (breadcrumb.tpl), you can use the $path variable or just assign it if not: {if isset($smarty.capture.path)}{assign var='path' value=$smarty.capture.path}{/if} That's the full breadcrumb with links but you can extract the names by doing: {assign var=pathstrip value=$path|strip_tags} {assign var=pathname value='>'|explode:$pathstrip} {strip}{$pathname[0]}{/strip} Link to comment Share on other sites More sharing options...
guilhermedemellokich Posted October 18, 2017 Share Posted October 18, 2017 Hi ! I use PS 1.6.1.15I have put all product tags on category.tpl.I added this: <ul class="producttags">{foreach from=$products item=product name=products}{foreach from=Tag::getProductTags($product.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>{/foreach}{/foreach} {/foreach}</ul> after this part: {include file="./product-list.tpl" products=$products} <div class="content_sortPagiBar"> <div class="bottom-pagination-content clearfix"> {include file="./product-compare.tpl" paginationId='bottom'} {include file="./pagination.tpl" paginationId='bottom'} </div> </div> you can add this styles to the global.css located in themes>default-bootstrap>css: .producttags { list-style:none; position:relative; clear:both; display:block; padding-bottom:20px; margin-bottom:20px; } .producttags li, .producttags a{ float:left; height:24px; line-height:24px; position:relative; font-size:11px; margin-bottom: 5px; } .producttags a{ margin-left:20px; padding:0 10px 0 12px; background:#0089e0; color:#fff; text-decoration:none; -moz-border-radius-bottomright:4px; -webkit-border-bottom-right-radius:4px; border-bottom-right-radius:4px; -moz-border-radius-topright:4px; -webkit-border-top-right-radius:4px; border-top-right-radius:4px; } .producttags a:visited{ color:#fff; } .producttags a:before{ content:""; float:left; position:absolute; top:0; left:-12px; width:0; height:0; border-color:transparent #0089e0 transparent transparent; border-style:solid; border-width:12px 12px 12px 0; } .producttags a:after{ content:""; position:absolute; top:10px; left:0; float:left; width:4px; height:4px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; background:#fff; -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;} With much help from: https://mypresta.eu/en/art/ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now