ozgurerdogan Posted July 20, 2015 Share Posted July 20, 2015 I want some client to use certain payment gateway and some other other payment gateway. Is that somehow possible. I do not want them to change or see other gateways. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 20, 2015 Share Posted July 20, 2015 to take them in reverse order, you can prevent clients from choosing a gateway when paying an invoice, by not ticking the checkbox in General Settings / Invoice http://docs.whmcs.com/Invoice_Tab#Clients_Choose_Gateway Clients Choose Gateway Enabling will display a dropdown menu on the invoice allowing customers to choose which gateway they use to pay each invoice. When disabled each invoice will use the gateway the client chose upon signup. it isn't possible to define which gateways a client can use via the admin area, but you could do so by modifying the template and/or using action hooks. i've posted a number of threads on limiting payment gateways - the latest of which is below... http://forum.whmcs.com/showthread.php?100127-Hide-payment-option&p=416114#post416114 it would make the coding slightly easier if you could assign these clients to client groups - http://docs.whmcs.com/Client_Groups e.g, create a client group called "Paypal", assign the clients that can only use Paypal to that group and then use the client group idea in your Smarty code... that will be easier than coding a long list of client IDs ! 0 Quote Link to comment Share on other sites More sharing options...
ozgurerdogan Posted July 21, 2015 Author Share Posted July 21, 2015 Thank you. This will help a lot. But how about dropdown list in invoice. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted July 21, 2015 Share Posted July 21, 2015 Thank you. This will help a lot. But how about dropdown list in invoice. in viewinvoice.tpl, it's the same principle of using client groups as a shortcut, but you have to come at it from another angle because the dropdown list is actually a Smarty variable - and so you can't edit it in the same way, but you can remove options from the list. so viewinvoice.tpl contains the following code... {if $status eq "Unpaid" && $allowchangegateway} <form method="post" action="{$smarty.server.PHP_SELF}?id={$invoiceid}" class="form-inline"> {$gatewaydropdown} </form> {else} {$paymentmethod} {/if} let's assume you have a client group, with an ID value of "1", that you don't want to be able to pay via PayPal, you could replace the above code with... {if $status eq "Unpaid" && $allowchangegateway} <form method="post" action="{$smarty.server.PHP_SELF}?id={$invoiceid}" class="form-inline"> {if $clientsdetails.groupid eq "1"} {$gatewaydropdown|replace:'<option value="paypal">PayPal</option>':''} {else} {$gatewaydropdown} {/if} </form> {else} {$paymentmethod} {/if} this will remove the "Paypal" option from the dropdown. if you had a client group that you wanted to pay only via Paypal, then you would remove the other payment options from {$gatewaydropdown} by using multiple replaces. {$gatewaydropdown|replace:'<option value="mailin">Mail In Payment</option>':''|replace:'<option value="banktransfer">Bank Transfer</option>':''} any client not in that client group will see all of the gateway options... if you had a number of client groups to which you wanted to assign different gateway options, then you would use multiple {if} statements to cover all the required groups. to be thorough, one other template to look at might be masspay.tpl - you have access to each gateway with this template (via a foreach loop), so you can use code similar to the above link to hide payment gateways based on client groups. <select name="paymentmethod" id="paymentmethod" class="form-control"> {foreach from=$gateways item=gateway} <option value="{$gateway.sysname}">{$gateway.name}</option> {/foreach} </select> all the above code is from the v6 templates, but the principle works with v5 too. 0 Quote Link to comment Share on other sites More sharing options...
ozgurerdogan Posted July 21, 2015 Author Share Posted July 21, 2015 Thank you. You really helped a lot. 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.