Post by VividImage » Thu May 24, 2018 7:11 pm

There is a quite serious bug in module: payment_method.php (OpenCartInstallFolder/catalog/controller/checkout/payment_method.php)

This bug manifests itself only when Registering a New Customer Account and then Reviewing the Shopping Cart, i.e. it will not happen when pressing 'Checkout' directly - one must first click on the 'Shopping Cart' link in the upper toolbar or on the black Cart Button, then 'View Cart' link (again, if one clicks on the black Cart Button, then on the 'Checkout' link within, without reviewing the cart, the bug won't be triggered). Also it happens irregularly, in about 50-75% of cases on average.

After agreeing to Terms & Conditions and pressing the 'Continue' button, OpenCart gets stuck on the 'Payment Method' with the error message "Warning: Payment method required!" even though the payment method is pre-selected.

I have firstly thought that this is caused by a lack of the second radio button choice (as I have started getting this error with only a single Payment Provider). But as you can see from the attached screenshot, it happens even with the two Payment Providers and two Radio Buttons to choose from.

The bug is triggered on the line:

elseif (!isset($this->session->data['payment_methods'][$this->request->post['payment_method']]))
{
$json['error']['warning'] = $this->language->get('error_payment');
}

Therefore $this->session->data['payment_methods'] is not set. (second part, i.e. $this->request->post['payment_method'] seems to be fine).

Any suggestions how to fix this, i.e. stopping $this->session->data['payment_methods'] losing its value ?

Attachments

OpenCart Bug.png

OpenCart Bug.png (22.39 KiB) Viewed 352 times


Newbie

Posts

Joined
Mon Jan 22, 2018 11:24 pm

Post by Qphoria » Fri May 25, 2018 2:17 am

Are you using IE or Edge? This is not likely an issue with the php code in that file.
This is a known issue with either of those two browsers because of the ajax cache during checkout
http://thisinterestsme.com/ajax-request ... rer-cache/

The easiest solution for this is to edit catalog/view/theme/YOURTHEME/template/checkout/checkout.tpl or checkout.twig

FIND & REPLACE ALL

Code: Select all

$.ajax({
with

Code: Select all

$.ajax({ cache: false,
That should fix it. We'll need to find a more proper permanent fix for this in the core.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by mdchun86 » Tue Jun 12, 2018 3:28 am

I seem to be having a similar issue but is happening on Google chrome mobile. Whenever selecting register account and then reviewing cart, the customer will get redirected back to select register account or guest checkout after putting in payment info. I have sent you a message Qphoria to see if you can help with this.

Newbie

Posts

Joined
Tue Apr 10, 2012 8:17 am
Who is online

Users browsing this forum: No registered users and 5 guests