Post by JKM2004 » Thu Nov 09, 2017 4:38 am

Opencart: Version 2.0.2.0
Specific Payment Module: Malse201 - Malse Commerce
The Problem: Suspect callback fails, receive an error page when trying to return to store from the Malse-Commerce system.
Error: Undefined index: payment_method in /***/***/public_html/***.co.uk/catalog/controller/payment/malse.php on line 297
---------------------------
I am trying to integrate an extension on OC Market place for Malse Commerce, it was developed by www.fido-x.net and sold on OC. (I have tried asking the developer and not had a reply for a number of months).
The customer places an order on OC store, is then taken to Malse-Commerce payment pages, they enter card details and then displayed a confirmation page. On that page is a button that says "Return to original website to complete order". This button should take the customer to; ***.co.uk/index.php?route=payment/malse/callback (as set in Malse & with a POST request) .Which then in theory finally goes to ***.co.uk/index.php?route=checkout/success.

The file /catalog/controller/payment/malse.php has this code at the bottom;

Code: Select all

public function callback() {
		if ($this->session->data['payment_method']['code'] == 'malse') {
			$this->load->model('checkout/order');

			if ($this->request->post['sd'] == $this->session->data['order_id']) {
				$this->model_checkout_order->addOrderHistory($this->session->data['order_id'], $this->config->get('malse_order_status_id'));
			}

			$this->response->redirect($this->url->link('checkout/success'));
		}
	}
I believe this 2nd line is causing the problem from what the error message says, the line reference and some testing.
If I strip this code to the following;

Code: Select all

public function callback() {
			$this->response->redirect($this->url->link('checkout/success'));
	}
The callback from Malse-Commerce works and takes me to the OC "Your order has been placed page" but the order status is "cancelled" by default. Admin & Customer receive order confirmation emails, shopping basket empties and all order data is passed into the Malse system also.

I am wondering if there is a genuine solution, or alternatively a way to code this to A) redirect correctly like my 'stripped code' approach, and B) set the order status to 'Pending'?
Any help and advice would be very much appreciated.
James

Newbie

Posts

Joined
Thu Nov 09, 2017 3:59 am

Post by JKM2004 » Thu Nov 09, 2017 4:31 pm

Not sure if this info is helpful, but. In the Database while looking in PHPmyAdmin in the '_order' table I can see valid entries in the 'payment_method' column and the 'payment_code' column. So its entering data into the DB.

Newbie

Posts

Joined
Thu Nov 09, 2017 3:59 am

Post by kestas » Thu Nov 09, 2017 6:17 pm

Hi,
this code:

Code: Select all

public function callback() {
		if ($this->session->data['payment_method']['code'] == 'malse') {
			$this->load->model('checkout/order');

			if ($this->request->post['sd'] == $this->session->data['order_id']) {
				$this->model_checkout_order->addOrderHistory($this->session->data['order_id'], $this->config->get('malse_order_status_id'));
			}

			$this->response->redirect($this->url->link('checkout/success'));
		}
	}
change to:

Code: Select all

public function callback() {
		if (isset($this->session->data['payment_method']['code']) == 'malse') {
			$this->load->model('checkout/order');

			if ($this->request->post['sd'] == $this->session->data['order_id']) {
				$this->model_checkout_order->addOrderHistory($this->session->data['order_id'], $this->config->get('malse_order_status_id'));
			}

			$this->response->redirect($this->url->link('checkout/success'));
		}
	}
But isset helps only you do not receive an error message. Seems there is more complicated. Problem is that session time expiring until the user click back button to the shop. And all session data are losing. So ask developer to improve this payment gateway...

Cheers

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by JKM2004 » Thu Nov 09, 2017 8:22 pm

Thank you Kestas.
I ran your code and it resolves the display of the error message, but as said it does not return to the OC confirmation page and the order status is 'cancelled'.
If there a way we can just run this code:

Code: Select all

public function callback() {
			$this->response->redirect($this->url->link('checkout/success'));
	}
and add some code to manually set the 'order_status_id' to a specific value (I believe 'pending' is '1')?

Newbie

Posts

Joined
Thu Nov 09, 2017 3:59 am

Post by kestas » Thu Nov 09, 2017 8:29 pm

JKM2004 wrote:
Thu Nov 09, 2017 8:22 pm
Thank you Kestas.
I ran your code and it resolves the display of the error message, but as said it does not return to the OC confirmation page and the order status is 'cancelled'.
If there a way we can just run this code:

Code: Select all

public function callback() {
			$this->response->redirect($this->url->link('checkout/success'));
	}
and add some code to manually set the 'order_status_id' to a specific value (I believe 'pending' is '1')?
Yes, but this is not solution. So please check your PM.

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am
Who is online

Users browsing this forum: No registered users and 58 guests