seok Posted August 23, 2023 Share Posted August 23, 2023 (edited) Hello I am limiting the total order ammount in checkout and my code only works if is upper than 1.000 € My code: {if $total_cart > 0 && $total_cart < 3.000} <button id="buy"></buton> {else} If you order is upper than 3000€, please contact-us {/if} First i tried with {if $total_cart < 3000} and also adding a dot "3.000" it works The problem is that this code {if $total_cart < 3.000} only works if the order is between 1000 and 3000€. Why this code is not working for orders less than €1000 ? Edited August 23, 2023 by seok (see edit history) Link to comment Share on other sites More sharing options...
musicmaster Posted August 23, 2023 Share Posted August 23, 2023 Try using intval($total_cart) Link to comment Share on other sites More sharing options...
seok Posted August 23, 2023 Author Share Posted August 23, 2023 unfortunately still ignoring value less than €1000 with the code: {if (intval($total_cart<3000))} Link to comment Share on other sites More sharing options...
musicmaster Posted August 23, 2023 Share Posted August 23, 2023 15 minutes ago, seok said: unfortunately still ignoring value less than €1000 with the code: {if (intval($total_cart<3000))} This should be if(intval($total_cart) < 3000) Link to comment Share on other sites More sharing options...
seok Posted August 23, 2023 Author Share Posted August 23, 2023 but in tpl file is not working your code because gives error. i tried wihout luck the code: {if (intval($total_cart) < 3000)} Link to comment Share on other sites More sharing options...
musicmaster Posted August 24, 2023 Share Posted August 24, 2023 On 8/23/2023 at 4:38 PM, seok said: but in tpl file is not working your code because gives error. i tried wihout luck the code: {if (intval($total_cart) < 3000)} I wasn't aware you were in Smarty instead of PHP. Anyway, a little googling would have been enough for you to fix that problem. Try {if (($total_cart*1) < 3000)} Link to comment Share on other sites More sharing options...
seok Posted August 24, 2023 Author Share Posted August 24, 2023 Without luck, with {if (($total_cart*1) < 3000)} it not detect the code, if I add a dot to 3000 {if (($total_cart*1) < 3.000)} then the code is detected but only works in orders between 1000 and 3000 Link to comment Share on other sites More sharing options...
musicmaster Posted August 25, 2023 Share Posted August 25, 2023 6 hours ago, seok said: if I add a dot to 3000 Can't you read? I multiply it with 1. The only alternative is that you display the content of $total_cart to make sure that it contains what you expect. 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