Alldo Group Posted August 27, 2011 Share Posted August 27, 2011 I'm trying to fetch the current id_category on the product page. I have searched the forums but with no results. I need to display a notice for some categories. This is what I am trying to use in product.tpl, with no success. {php} if( $smarty.get.id_category == '5' OR $product->id_category_default == '5'){ echo 'Test'; } {/php} Using PS 1.4.4 php_tag=true; Performance settings: force compile cache disabled Thanks in advance Link to comment Share on other sites More sharing options...
jeevanoss Posted August 27, 2011 Share Posted August 27, 2011 Hi, A product have multiple categories.So it should be an array. But you can get default category of a product by $product->id_category_default in product.tpl Link to comment Share on other sites More sharing options...
Alldo Group Posted August 28, 2011 Author Share Posted August 28, 2011 Thanks for your reply! Still can't get it to work. There are sub-categories. The first is 5 and the second are, for example 15. The easiest way would be to check the first category id. Im not sure how to achive this, is this correct: $prodId = $product->id_category_default; if( $prodId == 5){ echo 'An important notice!'; } Thanks! 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