cmonzonc Posted June 7, 2013 Share Posted June 7, 2013 Hello, i'm trying to get the categories id's in product.tpl ... In Product.php, i put these lines in the function getProductProperties $categories_ids = Product::getProductCategories($row['id_product']); $categories_names = array(); foreach ($categories_ids AS $id) { $category = new Category($id); $categories_names[] = (int)$id; } $row['categories'] = $categories_names; When i call from product-list.tpl: <!-- Display categories --> <span id="product_categories"> {foreach from=$product.categories item=category name=category} {$category}</br> {/foreach} </span> And great, the previous code works; but when i need the product categories in product.tpl, i'm trying with this code and doesn't work: <!-- Display categories --> <span id="product_categories"> {foreach from=$product->categories item='category' name='category'} {$category} <br/> {/foreach} </span> Link to comment Share on other sites More sharing options...
vekia Posted June 7, 2013 Share Posted June 7, 2013 try with this: product categories list on product page easy in use, no controllers / classes modification, only tpl code. 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