Jump to content

[SOLVED] display default category name in new product slider


Recommended Posts

Hi

 

i tried to display the name of the default category in the new products slider without any result

the ids work with {$product.id_category_default} :unsure: 

 

but not the name of the category {$product.category_default}

 

 

can somebody help me wich is the right code for the tlp file  :)

in product.tlp it works for me with this guide

 

but how can i add the default category name for the new products slider (module) and the featured products ?  :blink:

 

i use ps 1.6.0.8

 

 

Devil  :)  

 

 

Link to comment
Share on other sites

hi vekia, 

 

yes its only a module from the transformer theme it display only the new products in a slider.

 

now i want to add the default category name in this module

but i don´t know how the code for the tlp file look like

 

with {$product.id_category_default}  :unsure:  

 

i got only the id´s but i need the names of this id´s

 

do you have any ideas to realize this ?

 

Vekia i have found your code in a thread of you 

 

<span style="font-size:10px;">
    {foreach from=Product::getProductCategoriesFull($product.id_product) item=cat}
        <a href="{$link->getCategoryLink({$cat.id_category})}" title="{$cat.name}">{$cat.name}</a>,
    {/foreach}
</span>

 

this code works for me but i only need the default category name not all category names

 

how can i modify it to realize this ?

 

 

Devil

Link to comment
Share on other sites

everything depends on how the module controller looks like.

if there is no $product object, code that i proposed to use may not work well

 

try to use {$product|print_r} you will see available variables to use, if there will be no category default variable, you will need to extend module controller, there will be no other way to achieve it, unfortunately

Link to comment
Share on other sites

Hi Vekia,

 

thank you for you replay

 

i got a solution from the theme developer

i think its working for other solutions too.

 

edit product.php

 

Add the following lines right after this line
 
 $row['category'] = Category::getLinkRewrite((int)$row['id_category_default'], (int)$id_lang);
 
 
$category = new Category((int)$row['id_category_default']);
$row['category_name'] = $category->getName((int)$id_lang);

 

 then use {$product.category_name} 

 

 

 

Greatings 

 

Devil

Link to comment
Share on other sites

×
×
  • Create New...