Jump to content

Invoice payment gateway dropdown stopped switching payment methods


postcd

Recommended Posts

Hello,

on WHMCS 6.3.2, legacy WHMCS 5 template
Apache Version     2.4.37
PHP Version     5.6.38

in file /templates/default/viewinvoice.tpl

is:

Quote

{if $allowchangegateway}
<form method="post" action="{$smarty.server.PHP_SELF}?id={$invoiceid}">{$gatewaydropdown}</form>
{else}

but suddenly i found when i use this dropdown it does not switch payment methods. I already tried to:

- enable debug mode
- tried to restore stock invoice.tpl file and clear template cache
- tried Chrome and Firefox (both same issue)

Please kindly advice me what to check or try. Thank you in advance for the help.

Edited by postcd
Link to comment
Share on other sites

I was notified today about this, but it could happen even a few weeks back.

I tried to change template to "five" in Setup / General Settings / General

and then cleaned Template cache. I see that not helped to make the dropdown menu to switch payment methods on the invoice page.

Edited by postcd
Link to comment
Share on other sites

i'd be tempted to think it's a .js issue with the onchange="submit()" not triggering correctly.. i've just tried it on a v6.3.2 dev, using five or default and am not noticing any problem.

any recent changes that could have caused this ? have you added a new payment gateway recently ?

Link to comment
Share on other sites

When you switch the payment method, it should do a submit to viewinvoice.php?id=<invoice_number> .  Does that happen?   Using firefox inspect or chrome's equal, watch the network traffic page for the request if you can't see it do a refresh.   If the page does not reload, then check the browser console for javascript errors as something there is likely causing the issue. 

Link to comment
Share on other sites

There is no reload, no action in the developer console (both Firefox and Chrome) on Network tab and on Console tab when i switch payment method on invoice page dropdown menu.

I have not added new payment gateway recently. Should i anyhow disable some payment gateways? (preferably without loosing their data)

I would also restore stock files of a directories which you tell me (maybe some in /includes/ ?), so we can see if it is files problem or hosting problem? Apparently it is not a problem of the template..

Edited by postcd
Link to comment
Share on other sites

And that same behavior of no reload happens on stock 5 template?   Odd as that popup just does a javascript onchange and submits the form as if you hit a button. 

Look at the source of the invoice page and confirm the action set for the payment switch form is indeed set to the /viewinvoice and not like blank. 

Link to comment
Share on other sites

Yes, the "five" also do not shows anything and no redirect on developer consoles of both browsers.

Quote

Look at the source of the invoice page and confirm the action set for the payment switch form is indeed set to the /viewinvoice and not like blank.

I used stock invoice.tpl and so it should be all right, though i am unsure which file you mean so i can find that "action set".

The error_log shows this:

Trying to get property of non-object in /home1/me/public_html/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(157) : eval()'d code on line 83

        // dummy local smarty variable
        if (!isset($_template->tpl_vars['smarty'])) {            ---< 83 line
            $_template->tpl_vars['smarty'] = new Smarty_Variable;

Undefined index: custviewinvoicealtpay in /home1/postcd/public_html/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(157) : eval()'d code on line 148
Undefined index: paymentsuccess in /home1/me/public_html/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(157) : eval()'d code on line 170
Undefined index: pendingreview in /home1/me/public_html/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(157) : eval()'d code on line 173
Undefined index: paymentfailed in /home1/me/public_html/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(157) : eval()'d code on line 176
Undefined index: manualapplycredit in /home1/me/public_html/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(157) : eval()'d code on line 184
Trying to get property of non-object in /home1/me/public_html/vendor/smarty/smarty/libs/sysplugins/smarty_internal_templatebase.php(157) : eval()'d code on line 184

Last modification time of the smarty_internal_templatebase.php is 2016

Edited by postcd
Link to comment
Share on other sites

I meant the source of the invoice page when looking at it an invoice in your browser.  Look at the source for the page and find the form for switching.  The action should be set to /viewinvoice and if you do not see action, then that is the issue.   Don't have a copy of the stock template,  so what is at line 184 in the viewinvoice.tpl file? 

Link to comment
Share on other sites

> source of the invoice page when looking at it an invoice in your browser

<font class="unpaid">Unpaid</font><br />
<form method="post" action="/viewinvoice.php?id=10331"><input type="hidden" name="token" value="stringhere" /><select name="gateway" onchange="if (!window.__cfRLUnblockHandlers) return false; submit()" class="form-control select-inline" data-cf-modified-stringhere-=""><option value="coinpayments" selected="selected">

> what is at line 184 in the viewinvoice.tpl file? 

/templates/default/viewinvoice.tpl

{foreach from=$transactions item=transaction}
    <tr>
        <td class="textcenter">{$transaction.date}</td>   <---- 184 line
        <td class="textcenter">{$transaction.gateway}</td>
        <td class="textcenter">{$transaction.transid}</td>
        <td class="textcenter">{$transaction.amount}</td>
    </tr>
{foreachelse}

Link to comment
Share on other sites

@steven99 thank You very much for your help. When i paused Cloudflare protection on their website, the payment method switching started working. (One may need to purge cache on cloudflare site and maybe also in WHMCS / Utilities / System / System Cleanup / clear template cache)

I will submit ticket to Cloudflare to ask them what exact setting may be causing this..

Link to comment
Share on other sites

  • 2 weeks later...

Hello, the fix/workaround of this issue is to disable Cloudflare Performance measures on invoice page.
https://support.cloudflare.com/hc/en-us/articles/200169526-I-get-a-site-offline-error-message-when-updating-or-accessing-the-admin-section-of-my-content-management-system
Page rule should be for: *yourdomainhere.com/viewinvoice.php*
And only rule to apply is Performance: Disable

--

i can not edit my leading post. if anyone can, you can mention it in it

Edited by postcd
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