pieter314 Posted December 8, 2011 Share Posted December 8, 2011 Hello, I sell comic books. Series are subcategories in my shop. When I list products (for example in "new products" or as search results) I want to see the name of the default category so I have the name of the series and the title of the comic book. In the attached picture, the arrow shows the place of the main category (which would be the name of the series) I guess I should adjust product-list.tpl but I have no clue what to change. Someone else has? thanks for the tips. Pieter Link to comment Share on other sites More sharing options...
pieter314 Posted December 8, 2011 Author Share Posted December 8, 2011 I narrowed it down to this paragraph in product-list.tpl. If someone could point me in the right direction (Actually I don't know how to read this code correctly) I would be very grateful. <div class="center_block"> <a href="{$product.link|escape:'htmlall':'UTF-8'}" class="product_img_link" title="{$product.name|escape:'htmlall':'UTF-8'}"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} /></a> <h3>{if isset($product.new) && $product.new == 1}<span class="new">{l s='New'}</span>{/if}<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> <p class="product_desc"><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.description_short|truncate:360:'...'|strip_tags:'UTF-8'|escape:'htmlall':'UTF-8'}">{$product.description_short|truncate:360:'...'|strip_tags:'UTF-8'}</a></p> </div> Link to comment Share on other sites More sharing options...
CartExpert.net Posted December 8, 2011 Share Posted December 8, 2011 Hello! Depending on the page your are (new_products, discounts, category) you will need to get the name of the category in different ways. If you are listing product according to a category you need to insert this code: {$category->name|escape:'htmlall':'UTF-8'} , before {$product.name|escape:'htmlall':'UTF-8'} and {$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'} Be aware, that the product name with the category name might be too long. In other cases of product listing you need to create an instance of the Category class and assign it to Smarty. Link to comment Share on other sites More sharing options...
pieter314 Posted December 8, 2011 Author Share Posted December 8, 2011 Thanks for the reply. It's especially on the new-products list that I want to do this so I understand I will have to do the trick with the smarty. That will be the next thing to figure out then. I guess I will find this on the forum too. Link to comment Share on other sites More sharing options...
pieter314 Posted December 9, 2011 Author Share Posted December 9, 2011 I surfed around on this forumas well as in my prestashop dirs. What I read isn't making much sence. I now have in my new-pruduct list the ID of the default category. What I want is the name offcourse. How do I transslate this ID to the right name? Link to comment Share on other sites More sharing options...
pieter314 Posted December 15, 2011 Author Share Posted December 15, 2011 In other cases of product listing you need to create an instance of the Category class and assign it to Smarty. Is there anybody who can explain me how to do this? 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