Jump to content

Change of bank account number depending on the currency


Emily_

Recommended Posts

Hello,

The task sounds like this:

If during purchase process we choose PLN - the invoice should be generated with PLN account number (this one which is already on every invoice);
If during purchase process we choose EUR - the invoice should be generated with different account number.

What's the best way to do this? Code looks like this:

<div class="row">
                <div class="invoice-col right">
                    <strong>{$LANG.invoicespayto}</strong>
                    <address class="small-text">
                        {$payto}
                        {if $taxCode}<br />{$taxIdLabel}: {$taxCode}{/if}
                    </address>
                </div>

I need to modify text contained in variable $payto, but couldn't find where is that generated. Or should I simply modify the invoice template files (viewinvoice.tpl and invoicepdf.tpl) and use conditional statements to show the data required?

Thank you in advance.

Link to comment
Share on other sites

On 10/07/2020 at 14:02, Emily_ said:

I need to modify text contained in variable $payto, but couldn't find where is that generated.

it's generated by WHMCS and pull from the database - it's the content of the Pay To box in general settings -> general, but you could manipulate the value with a ClientAreaPageViewInvoice hook that checks the client's currency and payment method, and if it's EUR and banktransfer (I assume), then the hook replaces the value of $payto with your modified content.

but are you sure that you mean $payto and not $paymentbutton - which usually displays bank transfer account details to the user rather than $payto which is normally a postal address ?

On 10/07/2020 at 14:02, Emily_ said:

Or should I simply modify the invoice template files (viewinvoice.tpl and invoicepdf.tpl) and use conditional statements to show the data required?

it would work in the viewinvoice template too if you're more familiar using Smarty in the template - as you suggest, it's just if statements and deciding the content based on their results.

for invoicepdf.tpl, you can't use hooks, so if you needed to modify that template in a similar way, you would write your conditions in PHP rather than Smarty.

Link to comment
Share on other sites

Thank you,

I've just edited templates and it's working.

But which template does this window use?

image.png.4e8d7eb5e02e14943bb562d882d1389c.png

It's shown on viewinvoice.php page and doesn't change when viewinvoice.tpl and invoicepdf.tpl are modified....

Thank you in advance.

Link to comment
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.

  • 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