nineteen83 Posted May 19, 2008 Share Posted May 19, 2008 Hi guys, Bit of a newbie, but I've searched high and low and cannot get the category name of the product to show up on product.tpl! I've tried <h1>{$category->name}</h1> No to avail. Any tips? Thanks! K Link to comment Share on other sites More sharing options...
nineteen83 Posted May 20, 2008 Author Share Posted May 20, 2008 So, this sort of works... {$return_category_name} but only on some pages? Confusing! Link to comment Share on other sites More sharing options...
nineteen83 Posted May 22, 2008 Author Share Posted May 22, 2008 So since nobody knows, or is not sharing, I managed to hack product.php and added $result = Db::getInstance()->ExecuteS(' SELECT `id_category` FROM `'._DB_PREFIX_.'category_product` WHERE `id_product` = '.intval($_GET['id_product']).''); $smarty->assign('current_category_id',$result); $result_catname = Db::getInstance()->ExecuteS(' SELECT `name` FROM `'._DB_PREFIX_.'category_lang` WHERE `id_category` = '.intval($result[0]['id_category']).''); $smarty->assign('current_category',$result_catname); And on product.tpl, {$current_category[0].name} will show the category name of the current product. Hopefully this helps someone out there... Ciao Link to comment Share on other sites More sharing options...
shagshag Posted May 22, 2008 Share Posted May 22, 2008 Hi, I use this in product.tpl on RC3 : {if $category} {$category->name} {elseif $product->id_category_default != 1} {php} global $product, $cookie; $this->assign('default_category', new Category($product->id_category_default, $cookie->id_lang)); {/php} {$default_category->name} {else} {$shop_name} {/if} it's bad to use php in template file but I think it's better than hack product.phpRegards Link to comment Share on other sites More sharing options...
cerberus22 Posted June 18, 2009 Share Posted June 18, 2009 Hi All,Does anybody know how to turn shagshags reply into a link ?All the best,Cerberus22 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