Torbz Posted April 10, 2012 Share Posted April 10, 2012 Hi folks, I'm trying to inject the name of the sub-category to which a product belongs before the product name in product-list.tpl. The current code is: <h3>{if isset($product.new) && $product.new == 1} <span class="new">{l s='New'}</span>{/if} <a href="%7B$product.link%7Cescape:%27htmlall%27:%27UTF-8%27%7D" title="{$product.name|escape:'htmlall':'UTF-8'}"> [b]{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}[/b]</a></h3> and I would imagine an addition like this: <h3>{if isset($product.new) && $product.new == 1}<span class="new">{l s='New'}</span>{/if}<a href="%7B$product.link%7Cescape:%27htmlall%27:%27UTF-8%27%7D" title="{$product.name|escape:'htmlall':'UTF-8'}"> [b]{$subcategory.name|escape:'htmlall':'UTF-8'} {$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}[/b]</a></h3> would work. I have to do this because the client's catalogue is arranged in such a way that his sub-categories are the artist name (he sells CD's) and the product names do not already include the artist. I also need to do the same in the featured products module, as the album name appears here but not the artist name (the sub-category). *EDIT* Solved the first bit by inserting: {strip} {$category->name|escape:'htmlall':'UTF-8'} {$categoryNameComplement|escape:'htmlall':'UTF-8'} {/strip} before the product name. Link to comment Share on other sites More sharing options...
reinoplantae Posted May 3, 2012 Share Posted May 3, 2012 Torbz, it worked to me too. But i want to display the first category, not the default one. For exemple: men > clothes > t-shirts > long sleeves (where 'men' is the first category). How can we do that? 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