basic Posted July 30, 2016 Share Posted July 30, 2016 Dear All: The "group" solution that WHMCS provides to assign payment gateways results in a lot of unnecessry work -- as every product that s offered in two different (or more) currencies needs to be duplicated. It is further flawed, as this does not work at all for domain registrations! Under version 5.3 of WHMCS we had the below edits working to take care of this, but it does not work anymore in version 6.3.1, and I can't figure out why not. Does anyone understand, and how to fix this? We use "six" and the "modern" shopping card ... the code below is a simplified version with just two currencies and two payment gateways. .../[whms]/templates/orderforms/modern/viewcart.tpl ------------ (...) {/if} <h2>{$LANG.orderpaymentmethod}</h2> {if $currency.id == 1} <p><input type="radio" name="paymentmethod" id="pgbtn1" value="paypalbilling" onclick="hideCCForm()"{if $selectedgateway eq "paypalbilling"} checked="checked"{/if} /> <label for="pgbtn1"><b>PayPal</b></label><br /> <input type="radio" name="paymentmethod" value="authorizecim" id="pgbtn2" onclick="showCCForm()"{if $selectedgateway eq "authorizecim"} checked="checked"{/if} /> <label for="pgbtn2"><b>Credit Card</b></label><br /> {if $currency.id == 2} <input type="radio" name="paymentmethod" value="dwolla" id="pgbtn1" onclick="hideCCForm()"{if $selectedgateway eq "dwolla"} checked="checked"{/if} /> <label for="pgbtn1"><b>Bank Transfer</b></label><br /> <input type="radio" name="paymentmethod" value="coinify" id="pgbtn2" onclick="hideCCForm()"{if $selectedgateway eq "coinify"} checked="checked"{/if} /> <label for="pgbtn2"><b>Bitcoin</b></label> {/if}</p> (...) ------------ Any ideas? Thanks! John Link to comment Share on other sites More sharing options...
brian! Posted July 31, 2016 Share Posted July 31, 2016 John, you've got 2 opening {if} statements, but you only close one of them... perhaps v5 might have forgiven you for that.. v6 probably won't! you either need to close both {if} statements or change the second one to use elseif instead - then you effectively only have one {if} statement... and that will be closed correctly. (...) {/if} <h2>{$LANG.orderpaymentmethod}</h2> {if $currency.id == 1} <p><input type="radio" name="paymentmethod" id="pgbtn1" value="paypalbilling" onclick="hideCCForm()"{if $selectedgateway eq "paypalbilling"} checked="checked"{/if} /> <label for="pgbtn1"><b>PayPal</b></label><br /> <input type="radio" name="paymentmethod" value="authorizecim" id="pgbtn2" onclick="showCCForm()"{if $selectedgateway eq "authorizecim"} checked="checked"{/if} /> <label for="pgbtn2"><b>Credit Card</b></label><br /> {elseif $currency.id == 2} <input type="radio" name="paymentmethod" value="dwolla" id="pgbtn1" onclick="hideCCForm()"{if $selectedgateway eq "dwolla"} checked="checked"{/if} /> <label for="pgbtn1"><b>Bank Transfer</b></label><br /> <input type="radio" name="paymentmethod" value="coinify" id="pgbtn2" onclick="hideCCForm()"{if $selectedgateway eq "coinify"} checked="checked"{/if} /> <label for="pgbtn2"><b>Bitcoin</b></label> {/if}</p> (...) Link to comment Share on other sites More sharing options...
basic Posted July 31, 2016 Author Share Posted July 31, 2016 Hello Brian: Yes -- sorry, actually that double "if" was an error that I only produed (not sure how it happened) in this sample code. In my actual code, which has 3 currencies and more than 2 payment gateways for each, I did use "elseif". Sorry. Using "elseif" though, what happens is that I do see the correct payments gateways for each currency, *but* I see them five (5) times, in idential columns... please SEE the here attached image file. Thanks. John Link to comment Share on other sites More sharing options...
brian! Posted August 1, 2016 Share Posted August 1, 2016 did you add your code inside the {foreach} loop? if you're using your code, you don't really need the {foreach} and {/foreach} in that block and can remove them... Link to comment Share on other sites More sharing options...
basic Posted August 1, 2016 Author Share Posted August 1, 2016 Brian .... many thanks to you! That was it. The code given in my earlier posting works once the "foreach" opening and closing tag is removed. Great! John Link to comment Share on other sites More sharing options...
mrmoahi Posted October 16, 2017 Share Posted October 16, 2017 Hello Brian I wanted to know if this script allows WHMCS to display payment gateways based on the currency selected by client? Link to comment Share on other sites More sharing options...
Recommended Posts