Devil089 Posted August 12, 2014 Share Posted August 12, 2014 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} 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 ? i use ps 1.6.0.8 Devil Link to comment Share on other sites More sharing options...
vekia Posted August 12, 2014 Share Posted August 12, 2014 new products slider this is probably some non default solution, becaue i don't know any default module like that Link to comment Share on other sites More sharing options...
Devil089 Posted August 12, 2014 Author Share Posted August 12, 2014 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} 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 More sharing options...
vekia Posted August 12, 2014 Share Posted August 12, 2014 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 More sharing options...
Devil089 Posted August 12, 2014 Author Share Posted August 12, 2014 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 More sharing options...
vekia Posted August 13, 2014 Share Posted August 13, 2014 thanks for sharing this snippet :-) so, we have a solution i marked topic title as solved Link to comment Share on other sites More sharing options...
Recommended Posts