Jump to content
Sign in to follow this  
dimitrifrom31

Invoice customization: Disable a payment method if using "add funds"

Recommended Posts

Here is how to disable 2checkout (can be applied to other payment gateways) for the add funds feature.

The reason behind this is that you are not allowed to use 2checkout for adding funds as per 2checkout terms of service.

 

 

Edit "viewinvoice.tpl":

{if $invoiceitems|strstr:$LANG.addfunds}
{$gatewaydropdown|replace:'<option value="tco">2CheckOut</option>':''}
{else}{$gatewaydropdown}
{/if}

 

 

 

Edit "clientareaaddfunds.tpl":

      
               {foreach from=$gateways item=gateway}
	{if $gateway.sysname!=tco}
                   <option value="{$gateway.sysname}">{$gateway.name}</option>
	{/if}
               {/foreach}

Edited by dimitrifrom31

Share this post


Link to post
Share on other sites

aah, you've updated the post and are no longer checking the language file... that's good!

 

two things to check...

 

1. are you sure that it's "Add funds"? the language file defines it as "Add Funds"...

2. try changing $invoiceitems to $invoiceitems.description and see if that helps...

Share this post


Link to post
Share on other sites

Yes I figured out the variable , just did not look down enough with the {debug} popup. I then edited my post to givethe full solution.

 

1) Adjusted that.

 

2) $invoceitems works fine.

 

Thanks.

Edited by dimitrifrom31

Share this post


Link to post
Share on other sites

i'm glad to hear that you got it working...

 

with regards to 1), there would be no need to use multiple entries for the different languages, you would just use the one language file entry...

 

{if $invoiceitems|strstr:$LANG.addfunds}
{$gatewaydropdown|replace:'<option value="tco">2CheckOut</option>':''}
{else}{$gatewaydropdown}
{/if}

Share this post


Link to post
Share on other sites

Thanks for sharing the useful piece of code. There's also a chance that a customer creates an Add Funds invoice and doesn't instantly pay it. Then they could attempt to pay it along with a regular invoice using the Mass Pay option (if enabled):

 

- clientarea.php?action=masspay

- clientarea.php?action=masspay&all=true

 

We're currently working to disable 2checkout for mass pay if Add Funds invoice is included, so I'll share the code when done.

 

FYI. Here's what 2co refer to when they suspend your account:

 

"Unfortunately, what you described qualifies as "cash gifting" under our prohibited products list, which can be found here:

https://www.2checkout.com/policies/prohibited-product-list"

Share this post


Link to post
Share on other sites

Hello, I added both code into my template but i found it's not working for me. Can anyone ensure me that it's working whmcs 7.10.2! Thanks.

Share this post


Link to post
Share on other sites
On 04/06/2020 at 19:00, Benjamin Biswas said:

Hello, I added both code into my template but i found it's not working for me. Can anyone ensure me that it's working whmcs 7.10.2! Thanks.

the clientareaaddfunds.tpl change should still work... the invoice one might need some tweaking (haven't tested it in years) - though I would argue in both cases, that you shouldn't rely on a 5 year-old thread for code to be used in a more recent WHMCS install and would use hooks instead to achieve the same goal.

Share this post


Link to post
Share on other sites

Hello,

Need too,

1. clientareaaddfunds.tpl working good in 8.5.1

2. viewinvoice.tpl not working.

In html checking it same 

<option value="tco">2CheckOut</option>

in 

$LANG.addfunds

All ok, but not working. Help please. Think some wrong in 

$invoiceitems
Edited by Evgeny

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated