radus Posted November 21, 2014 Share Posted November 21, 2014 (edited) Hello, On product-list.tpl , i need to show all categories where a product is. I tried VEKIA's solution {foreach from=Product::getProductCategoriesFull(Tools::getValue('id_product')) item=cat} <meta itemprop="name" content="{$cat.name}" /> <meta itemprop="url" content="{$link->getCategoryLink({$cat.id_category})}" /> {/foreach} for Product-list.TPL it is not working. Anybody knows why ? PS 1.5.6.2 Edited November 27, 2014 by radus (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted November 21, 2014 Share Posted November 21, 2014 Hello, On product-list.tpl , i need to show all categories where a product is. I tried VEKIA's solution {foreach from=Product::getProductCategoriesFull(Tools::getValue('id_product')) item=cat} <meta itemprop="name" content="{$cat.name}" /> <meta itemprop="url" content="{$link->getCategoryLink({$cat.id_category})}" /> {/foreach} for Product-list.TPL it is not working. Anybody knows why ? PS 1.5.6.2 this code is for product page. to use it in product listings, like category view you have to use product id variable instead of tools::getValue function something like: {foreach from=Product::getProductCategoriesFull($product.id) item=cat} <meta itemprop="name" content="{$cat.name}" /> <meta itemprop="url" content="{$link->getCategoryLink({$cat.id_category})}" /> {/foreach} 1 Link to comment Share on other sites More sharing options...
radus Posted November 22, 2014 Author Share Posted November 22, 2014 Thankx VEKIA, works ferfect. I implemented {foreach from=Product::getProductCategoriesFull($product.id_product) item=category} <div itemprop="category" itemscope itemtype="http://schema.org/Product"> <meta itemprop="name" content="{$category.name|escape:'html':'UTF-8'}" /> <meta itemprop="url" content="{$link->getCategoryLink($category.id_category, $category.link_rewrite)|escape:'html':'UTF-8'}" /> </div> {/foreach} Link to comment Share on other sites More sharing options...
Ismael Arguedas Posted March 23, 2015 Share Posted March 23, 2015 Thankx VEKIA, works ferfect. I implemented {foreach from=Product::getProductCategoriesFull($product.id_product) item=category} <div itemprop="category" itemscope itemtype="http://schema.org/Product"> <meta itemprop="name" content="{$category.name|escape:'html':'UTF-8'}" /> <meta itemprop="url" content="{$link->getCategoryLink($category.id_category, $category.link_rewrite)|escape:'html':'UTF-8'}" /> </div> {/foreach} Hello, I tried this on presta 1.6.0.9 but not work for me, I guess that for 1.6 the code need some modifications, but I dont have any idea what... Someone? 1 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