Chillax86 Posted July 13, 2016 Share Posted July 13, 2016 (edited) I need to display a different stock message on the product page when a product from a certain category has been sold. So I would like to do something like this {if defaultCategoryID == 8} {l s='Sold'} {else} {l s='Currently out of stock'}{/if} I don't think you can grab the default category from an already established smarty variable in Product.tpl correct me if I am wrong, I think I may have to override/extend the ProductCore class. If so how would be the best way to achieve this or is there a better way? I'm using PrestaShop 1.6.1.5 Edited July 13, 2016 by Chillax86 (see edit history) Link to comment Share on other sites More sharing options...
rocky Posted July 14, 2016 Share Posted July 14, 2016 Have you tried {if $product->id_category_default == 8}? Link to comment Share on other sites More sharing options...
Chillax86 Posted July 14, 2016 Author Share Posted July 14, 2016 I hadn't tried that, I thought I had to code it in as my google searches suggested, thank you for a quick reply, is there a way I can see all the available smarty variables in the .tpl? Link to comment Share on other sites More sharing options...
rocky Posted July 14, 2016 Share Posted July 14, 2016 Unfortunately, there's no easy way to see all the Smarty variables on a page. You can find the PHP file that calls the TPL file to see what variables are assigned there. You can also read through the init function in classes/controller/FrontController.php to see what Smarty variables are assigned on all pages. Link to comment Share on other sites More sharing options...
vekia Posted July 14, 2016 Share Posted July 14, 2016 you can also use {debug} in the .tpl file then you will see a popup with list of all available smarty variables on selected page 2 Link to comment Share on other sites More sharing options...
Adam_Uy Posted August 4, 2016 Share Posted August 4, 2016 you can also use {debug} in the .tpl file then you will see a popup with list of all available smarty variables on selected page This really helps! Thank you 1 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