mozack Posted October 4, 2010 Share Posted October 4, 2010 Hi,I'm trying to put block tags in product page, but i want to show only the product tags. It is showing the common tags...How to change that?Is it also possible to allow user to save their own tags for each product?RegardsMozack Link to comment Share on other sites More sharing options...
rocky Posted October 4, 2010 Share Posted October 4, 2010 Add the following to product.php before the $smarty->display: $productTags = Tag::getProductTags($id_product); $productTags = $productTags[intval($cookie->id_lang)]; $smarty->assign('productTags', $productTags); This will pass the product's tags into product.tpl. You can then use code like the following to display the tags: {foreach from=$productTags item=productTag name=productTags} {$productTag}{if !$smarty.foreach.productTags.last}, {/if} {/foreach} 1 Link to comment Share on other sites More sharing options...
mozack Posted October 4, 2010 Author Share Posted October 4, 2010 Hi,Thanks for this code... You're a life safer...RegardsMozack Link to comment Share on other sites More sharing options...
yaya Posted October 4, 2010 Share Posted October 4, 2010 hello,@Rochy : On which line pf product.php, I have to put this code ?before this$smarty->display(_PS_THEME_DIR_.'product.tpl') Link to comment Share on other sites More sharing options...
mozack Posted October 4, 2010 Author Share Posted October 4, 2010 Yes, put before that line... Link to comment Share on other sites More sharing options...
VNguyen Posted March 18, 2011 Share Posted March 18, 2011 Hi,Please let me know if I want to put product tag in a separate tab (like MORE INFO, COMMENTS) then what should I do.Thank in advance. Link to comment Share on other sites More sharing options...
matduke Posted June 27, 2011 Share Posted June 27, 2011 Hi,Please let me know if I want to put product tag in a separate tab (like MORE INFO, COMMENTS) then what should I do.Thank in advance. I'd like to know this as well! (for PS 1.4)Also I need to add a line that says whether the product is downloadable or not!Thanks! Link to comment Share on other sites More sharing options...
rassy Posted August 16, 2011 Share Posted August 16, 2011 Hi guys, is this solution compatible with V1.4? Is there another way to achieve this? Rassy Link to comment Share on other sites More sharing options...
PenaPP Posted October 13, 2011 Share Posted October 13, 2011 Hi, it's similar to the solution posted by "rocky"... Edited code for product.php has to be placed to the function/method called "process" in the file "controllers/ProductController.php" $productTags = Tag::getProductTags($this->product->id); $productTags = $productTags[(int)(self::$cookie->id_lang)]; self::$smarty->assign('productTags', $productTags); 1 Link to comment Share on other sites More sharing options...
yesiam Posted October 22, 2011 Share Posted October 22, 2011 Thanks ! Link to comment Share on other sites More sharing options...
Melanconium Posted November 29, 2011 Share Posted November 29, 2011 Hi, it's similar to the solution posted by "rocky"... Edited code for product.php has to be placed to the function/method called "process" in the file "controllers/ProductController.php" $productTags = Tag::getProductTags($this->product->id); $productTags = $productTags[(int)(self::$cookie->id_lang)]; self::$smarty->assign('productTags', $productTags); Thank you very much! Link to comment Share on other sites More sharing options...
Melanconium Posted November 29, 2011 Share Posted November 29, 2011 Thank you rocky for your solution as well Link to comment Share on other sites More sharing options...
Kaloyan_78 Posted November 30, 2011 Share Posted November 30, 2011 Hi all, First of all - thanks for the help, but I still can't get the tags to show on the specific products. Could you help me a bit here? Where should I place both codes . I'm using version 1.4.3 Thank you in advance. Link to comment Share on other sites More sharing options...
Artizzz Posted November 30, 2011 Share Posted November 30, 2011 Hi all, First of all - thanks for the help, but I still can't get the tags to show on the specific products. Could you help me a bit here? Where should I place both codes . I'm using version 1.4.3 Thank you in advance. Hi, Kaloyan_78! I attached module who displays product tags in product page. Hope it helped you. module_productpagetags.zip 3 Link to comment Share on other sites More sharing options...
Kaloyan_78 Posted November 30, 2011 Share Posted November 30, 2011 Hi, Kaloyan_78! I attached module who displays product tags in product page. Hope it helped you. Thank you so, so much, Artizzz. It works great !!! Again - thank you ! Link to comment Share on other sites More sharing options...
Germán Oronoz Arbide Posted January 17, 2012 Share Posted January 17, 2012 hello, thank you very much artizzz, it worked fine! what can i do if i want to show the tags in the product-list.tpl file?? each product with it's tags. i've tried to insert the code {if $tags|@count > 0} {foreach from=$tags item=tag key=name name=tags} <a href="{$link->getPageLink('search.php')}?tag={$tag|urlencode}" > </a> {/foreach} {/if} inside the <li> in the product-list.tpl file hope i'm explaining myself okay, thanks in advance Link to comment Share on other sites More sharing options...
seog Posted September 15, 2012 Share Posted September 15, 2012 I tried put product tag instead of product name (title) in product-list.tpl replacing in CategoryController.php : parent::displayContent(); self::$smarty->display(_PS_THEME_DIR_.'category.tpl'); to: parent::displayContent(); $productTags = Tag::getProductTags($this->product->id); $productTags = $productTags[(int)(self::$cookie->id_lang)]; self::$smarty->assign('productTags', $productTags); self::$smarty->display(_PS_THEME_DIR_.'category.tpl'); Then I replace in product-list.tpl : <h3><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name|escape:'htmlall':'UTF-8'}">{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}</a></h3> to: {foreach from=$productTags item=productTag name=productTags} <h3><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name|escape:'htmlall':'UTF-8'}">{$productTag}{if !$smarty.foreach.productTags.last}, {/if}</a></h3> {/foreach} AND THIS DON´T WORK Does anybody knows how can I replace the product.name in product-list for product tag? regards PS 1.4.8 Link to comment Share on other sites More sharing options...
seog Posted September 19, 2012 Share Posted September 19, 2012 anybody knows ??? Link to comment Share on other sites More sharing options...
coradyne Posted November 1, 2012 Share Posted November 1, 2012 (edited) Hi, Kaloyan_78! I attached module who displays product tags in product page. Hope it helped you. Hi, I want to change/translate the phrase: "view similarly tagged products:" which appears with this module. How do I do this? Thank you! edit: I modified the text in productpagetags.tpl file, but the change doesn't show on the site, no matter how many times I press F5... Edited November 1, 2012 by coradyne (see edit history) Link to comment Share on other sites More sharing options...
coradyne Posted November 3, 2012 Share Posted November 3, 2012 Never mind, apparently it was a cache problem. I learned how to fix it here: http://www.blmodules.com/prestashop-tutorials-users/prestashop-cache-when-modification-do-not-see/#.UJVpuGfjr5t and to be more precise: Delete cache manually is an option, but you will have to delete it each time you make a change.To make it automatically, please locate to /config/smarty.config.inc.php, find this line: $smarty->compile_check = false; and change to: $smarty->compile_check = true; Now, your modifications will be refelected immediately. Link to comment Share on other sites More sharing options...
jovijavi Posted June 4, 2013 Share Posted June 4, 2013 And for the 1.5.4.1 version?, I'm trying to do and does not work. Link to comment Share on other sites More sharing options...
vekia Posted June 4, 2013 Share Posted June 4, 2013 it's because in 1.5.4.1 you have to use context object instead of $smarty if it is possible - please give us information why it doesnt work for you (any error code appear? or sth?) Link to comment Share on other sites More sharing options...
jovijavi Posted June 4, 2013 Share Posted June 4, 2013 it's because in 1.5.4.1 you have to use context object instead of $smarty if it is possible - please give us information why it doesnt work for you (any error code appear? or sth?) Directly put the companion module Artizzz that does not work, and if I put it by hand, not out absolutely nothing, no error occurs (at least not shown), but nothing comes out. Link to comment Share on other sites More sharing options...
vekia Posted June 4, 2013 Share Posted June 4, 2013 just use the context object to append variable to smarty array with tags, should help Link to comment Share on other sites More sharing options...
jovijavi Posted June 4, 2013 Share Posted June 4, 2013 Can you tell me how to do or make an example, not a lot of programming in prestashop. Thank Link to comment Share on other sites More sharing options...
vekia Posted June 4, 2013 Share Posted June 4, 2013 okay, so you want exactly the same what mozac wanted? I'm trying to put block tags in product page, but i want to show only the product tags. It is showing the common tags... Link to comment Share on other sites More sharing options...
jovijavi Posted June 4, 2013 Share Posted June 4, 2013 okay, so you want exactly the same what mozac wanted? I wanted something like this: View more tags 1 View more tag 2 View more tag 3 .... And that is a link to all products with that tag Thanks for everything. Link to comment Share on other sites More sharing options...
vekia Posted June 5, 2013 Share Posted June 5, 2013 step by step tutorial: tags on product page prestashop 1.5 Link to comment Share on other sites More sharing options...
jovijavi Posted June 5, 2013 Share Posted June 5, 2013 Perfect, just what I needed!, Thanks Link to comment Share on other sites More sharing options...
vekia Posted June 5, 2013 Share Posted June 5, 2013 you're welcome you can of course modify it to display tags as list (not labels) decision is your :-) regards 1 Link to comment Share on other sites More sharing options...
Ramboz89 Posted November 12, 2013 Share Posted November 12, 2013 Hi Vekia, i've a problem with prestashop 1.5.4.1. I want show product correlate by tag in footer bottom instead of correlate by categories. I download module posted in previous reply but it doesn't work on my version. Can u help me? sorry for my english Link to comment Share on other sites More sharing options...
w3bsolutions Posted December 1, 2013 Share Posted December 1, 2013 Any idea of how to show the tags for each product on the product list (category view)? Vekia's tutorial works great for showing them in the product page but it does not work on the product-list.tpl. It should be easy, right? Any idea? Thanks. Link to comment Share on other sites More sharing options...
vekia Posted December 1, 2013 Share Posted December 1, 2013 well.. it is possible but remember that each product = separate query to database, if you've got 12 products per page = +12 queries to DB instead of Tools::getValue('id_product') use {$product.id} Link to comment Share on other sites More sharing options...
w3bsolutions Posted December 1, 2013 Share Posted December 1, 2013 Thanks for your answer. I tried but it is not working. This is my code: {foreach from=Tag::getProductTags({$product.id}) key=k item=v} {foreach from=$v item=value} <span>{$value|escape:html:'UTF-8'}</span> {/foreach} {/foreach} it does not output anything. About the sql queries, is there a better approach to do this with less queries? Thanks again. Link to comment Share on other sites More sharing options...
vekia Posted December 2, 2013 Share Posted December 2, 2013 if you want to display tags for each product, there is no other way. try with: Tag::getProductTags($product.id) Link to comment Share on other sites More sharing options...
w3bsolutions Posted December 2, 2013 Share Posted December 2, 2013 That did not work either, but it worked with from=Tag::getProductTags({$product.id_product}) thanks! 1 Link to comment Share on other sites More sharing options...
vekia Posted December 2, 2013 Share Posted December 2, 2013 woops! you've got right thank you for solution :-) Link to comment Share on other sites More sharing options...
w3bsolutions Posted December 2, 2013 Share Posted December 2, 2013 Just a question, what would be the best way to show only the 1st tag assigned to the product? Thanks in advance Link to comment Share on other sites More sharing options...
Deicide Posted August 24, 2015 Share Posted August 24, 2015 This CODE must be work on PRESTASHOP 1.6.1? i need to display TAG, in product-list.tpl... but nothing happend.. HELP pls. i USE Tag::getProductTags({$product.id_product}) this must be work in PRESTA 1.6? say pls.. Link to comment Share on other sites More sharing options...
Deicide Posted August 24, 2015 Share Posted August 24, 2015 How I can access to TAGS variable of every product on CATEGORY page, not PRODUCT page. pls HELP me with that! Link to comment Share on other sites More sharing options...
Cloud Nine Posted February 23, 2016 Share Posted February 23, 2016 The solution given by fire2 works on Prestashop 1.6.1 from=Tag::getProductTags({$product.id_product}) Thanks ! Link to comment Share on other sites More sharing options...
grubybarti Posted May 20, 2016 Share Posted May 20, 2016 How to make it work like links ? Link to comment Share on other sites More sharing options...
Recommended Posts