Jump to content

Show default category in product list


Recommended Posts

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)

post-292342-0-47381400-1323337206_thumb.jpg

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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...