5haun Posted March 27, 2018 Share Posted March 27, 2018 I would like to show a string of HTML only if discounts exist for any product. Something like this: {if $products->on_sale} <button>Specials</button> {/if} Any suggestions? PS v1.6.1.18 Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted March 27, 2018 Share Posted March 27, 2018 Hi... i thing you need to use but not tested. {if (isset($quantity_discounts) && count($quantity_discounts) > 0)} your string here {/if} Thanks Link to comment Share on other sites More sharing options...
5haun Posted March 27, 2018 Author Share Posted March 27, 2018 Hi Thank you for the reply! I tried this on product.tpl and it does not work. Any other suggestions? Link to comment Share on other sites More sharing options...
tantan199 Posted March 28, 2018 Share Posted March 28, 2018 Try this one {if $product.price_without_reduction > 0 && isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}One sale{/if} Link to comment Share on other sites More sharing options...
5haun Posted March 28, 2018 Author Share Posted March 28, 2018 (edited) On 3/28/2018 at 3:16 AM, tantan199 said: Try this one {if $product.price_without_reduction > 0 && isset($product.specific_prices) && $product.specific_prices && isset($product.specific_prices.reduction) && $product.specific_prices.reduction > 0}One sale{/if} Expand I tried that and it threw this error: Fatal error: Cannot use object of type Product as array in /home/xxxxx/public_html/xxxxx/tools/smarty/sysplugins/smarty_internal_templatebase.php(157) : eval()'d code on line 61 I actually wanted it in my mega menu module and when I put it in there I get: Notice: Undefined index: product in /home/xxxxx/public_html/xxxx/cache/smarty/compile/1b/97/2b/1b972be53e916c5c7decc7d16256cdba7f3e2a08.file.iqitmegamenu.tpl.php on line 61 Anything else? Edited March 28, 2018 by 5haun (see edit history) Link to comment Share on other sites More sharing options...
5haun Posted April 3, 2018 Author Share Posted April 3, 2018 Bump 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