maxihost Posted December 17, 2013 Share Posted December 17, 2013 Hello, I would like to create a conditional on invoice template like this, {if $invoice_total bigger than "1000"} Please pay using this payment method {else} Please pay using paypal {/if} In other words, if the invoice total is bigger than 1000 I would like to display one payment method, and if not, I will display paypal link. But it seems that WHMCS is not accepting "bigger than". What can I use instead ? Thank you. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted December 17, 2013 Share Posted December 17, 2013 if would be 'greater than' - so you would use > or gt {if $invoice_total > "1000"}Please pay using this payment method {else} Please pay using paypal {/if} however, I don't know if you can do this as $invoice_total contains both the currency symbol (if used) and the amount (e.g., $1000.00) - so even if you remove the currency symbol, i'm unsure whether it would be treated as a number. but try the above code and see if it works. 0 Quote Link to comment Share on other sites More sharing options...
maxihost Posted December 18, 2013 Author Share Posted December 18, 2013 if would be 'greater than' - so you would use > or gt however, I don't know if you can do this as $invoice_total contains both the currency symbol (if used) and the amount (e.g., $1000.00) - so even if you remove the currency symbol, i'm unsure whether it would be treated as a number. but try the above code and see if it works. It does not. I contacted WHMCS and they said I need to use Hook to do this. I asked if they create the hook for me as customized job but they are not doing at the moment. If you are able to do so, I would be interested in this job. "Hi, The variable you are trying to use is not an integer and so you cannot compare it as such. The value will always contain the currency prefix and suffix. You can however create your own variable to be used on using the EmailPreSend hook point. http://docs.whmcs.com/Hooks:EmailPreSend You can check that the email template name is one you wish to use the variable on, and then the relid would be the invoiceid and you can obtain the balance from tblinvoices and create your own variable to run this comparison on." 0 Quote Link to comment Share on other sites More sharing options...
maxihost Posted December 19, 2013 Author Share Posted December 19, 2013 You can try with the code below. It's not pretty, but simple and should work good in this case: {if $invoice_total|regex_replace:"/[^0-9.]+/":"" > 1000} Bigger than 1000 {else} Equal or lower than 1000 {/if} Worked pefectly. I just changed ">" to "gt" because I had an error whilw trying to send the invoice. Thank you so much. 0 Quote Link to comment Share on other sites More sharing options...
omnigenus Posted December 19, 2013 Share Posted December 19, 2013 You can always use PHP to do whatever you want inside your invoice template. No need to stick to smarty limitations 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.