Post by deluzione » Thu Aug 06, 2009 1:12 am

I don't know if this is a common issue, If I set up something wrong or there's a glitch somewhere, but on one of my client's site I use OpenCart with Paypal.
My client got a confirmation from Paypal that a payment was done, but OpenCart shows no sign of a placed order. The customer shows up under "Customer", but there are no orders to be found.

Am I doing something wrong, or did the customer "forget" to go back to the website after using the Paypal terminal?

New member

Posts

Joined
Fri Jun 05, 2009 6:13 am

Post by Leon » Thu Aug 06, 2009 1:14 am

This is a common error, i'm not sure if there is a fix or not.

It happened to me, so i went into phpmyadmin, found the order and changed it's status to 1, so that it showed in the admin.

Active Member

Posts

Joined
Tue Apr 07, 2009 1:20 am

Post by Daniel » Thu Aug 06, 2009 1:24 am

I've spotted this aswell.

I'm trying to find out why this is happening.

In the next version i'm adding a error log that can be viewed int he admin to spot this sort of stuff.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by deluzione » Thu Aug 06, 2009 1:25 am

Ah, thanks.. I used the phpmyadmin trick, but I hope I don't have to do that for every order...

Can't wait for the solution.. :)

New member

Posts

Joined
Fri Jun 05, 2009 6:13 am

Post by Daniel » Thu Aug 06, 2009 1:41 am

have you not seen the missing order status in the admin orders page?

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by Leon » Thu Aug 06, 2009 1:45 am

Nope.

I just looked and couldn't see it at first.

When you first go to the page, you expect all of the orders to be shown, and the filter thing to filter that list down; you don't expect it to reveal a whole load of other orders.
That's why i, and i expect many others didn't even realise this feature was there.

Thanks for letting me know though; if i get another order that doesn't show i'll use this.

Active Member

Posts

Joined
Tue Apr 07, 2009 1:20 am

Post by Qphoria » Thu Aug 06, 2009 1:48 am

might be best to add back the ajax confirm and make it configurable from the admin. This will at least put the order in a pending state so you are more aware of it.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by tahnmeep » Thu Aug 06, 2009 6:15 am

Just throwing this out there-- I wonder if it has to do anything with the db naming scheme, mentioned by Qphoria here:
http://forum.opencart.com/viewtopic.php?f=20&t=5452
Though looking back it looks like 1.2.8 wasn't happy with the old way either :(

New member

Posts

Joined
Sun Jul 05, 2009 1:24 pm


Post by Leon » Thu Aug 06, 2009 6:20 am

Qphoria didn't post in that topic you linked to.

I don't think that the name makes any difference at all.

I have a feeling that the problem lies with the client configuration at the paypal website, not with the opencart system.

After not getting an email, i looked through my paypal settings and found that it was still redirecting to an old confirmation page, so i changed it.

I don't know why, but i can't seem to replicate the error though.

Active Member

Posts

Joined
Tue Apr 07, 2009 1:20 am

Post by Daniel » Thu Aug 06, 2009 6:22 am

have the problem on my own server aswell.

i'm looking into it.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by RaymondBeaudoin » Thu Aug 06, 2009 11:45 pm

Has there been any updates about this? I see no orders, even incomplete ones on the site, though when I checked the database they were there.

New member

Posts

Joined
Mon Aug 03, 2009 12:56 pm

Post by Leon » Fri Aug 07, 2009 12:58 am

RaymondBeaudoin wrote:Has there been any updates about this? I see no orders, even incomplete ones on the site, though when I checked the database they were there.
Go to Customers>Order.
In the Status dropdown, select 'No status orders', then press filter.

It's not an easy find :)

Active Member

Posts

Joined
Tue Apr 07, 2009 1:20 am

Post by Daniel » Fri Aug 07, 2009 1:42 am

yes this is annoying i have installed loggers and allsorts to find out what is going on. the calling back is happening but can;'t understand why the orders are not being processed.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by Daniel » Fri Aug 07, 2009 4:38 am

this is very strange. I just deleted one of the paypal sandbox emails and setup a new test account and it is now working.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by RaymondBeaudoin » Fri Aug 07, 2009 4:43 am

That is really strange, I tested it with live paypal and it didn't work.

New member

Posts

Joined
Mon Aug 03, 2009 12:56 pm

Post by popfriend » Fri Aug 07, 2009 4:58 am

it occurred in my site randomly. Please help!

Newbie

Posts

Joined
Thu Jul 09, 2009 6:09 pm

Post by Daniel » Fri Aug 07, 2009 5:05 am

Can some one put this into there payment/paypal.php controller?

Code: Select all

<?php
class ControllerPaymentPPStandard extends Controller {
	protected function index() {
    	$this->data['button_confirm'] = $this->language->get('button_confirm');
		$this->data['button_back'] = $this->language->get('button_back');

		if (!$this->config->get('pp_standard_test')) {
    		$this->data['action'] = 'https://www.paypal.com/cgi-bin/webscr';
  		} else {
			$this->data['action'] = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
		}		
		
		$this->load->model('checkout/order');
		
		$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
																				   
		$this->data['business'] = $this->config->get('pp_standard_email');
		$this->data['item_name'] = html_entity_decode($this->config->get('config_store'));				
		$this->data['currency_code'] = $order_info['currency'];
		$this->data['amount'] = $this->currency->format($order_info['total'], $order_info['currency'], $order_info['value'], FALSE);
		$this->data['first_name'] = $order_info['payment_firstname'];
		$this->data['last_name'] = $order_info['payment_lastname'];
		$this->data['address1'] = $order_info['payment_address_1'];
		$this->data['address2'] = $order_info['payment_address_2'];
		$this->data['city'] = $order_info['payment_city'];
		$this->data['zip'] = $order_info['payment_postcode'];
		
		$payment_address = $this->customer->getAddress($this->session->data['payment_address_id']);
		
		$this->data['country'] = $payment_address['iso_code_2'];
		
		$this->load->library('encryption');
		
		$encryption = new Encryption($this->config->get('config_encryption'));
		
		$this->data['notify_url'] = $this->url->http('payment/pp_standard/callback&order_id=' . $encryption->encrypt(urlencode($this->session->data['order_id'])));
		$this->data['email'] = $order_info['email'];
		$this->data['invoice'] = $this->session->data['order_id'] . ' - ' . $order_info['payment_firstname'] . ' ' . $order_info['payment_lastname'];
		$this->data['lc'] = $this->language->getCode();
		
		if (!$this->config->get('pp_standard_transaction')) {
			$this->data['paymentaction'] = 'authorization';
		} else {
			$this->data['paymentaction'] = 'sale';
		}
		
		$this->data['return'] = $this->url->https('checkout/success');
		$this->data['cancel_return'] = $this->url->https('checkout/payment');

		$this->data['back'] = $this->url->https('checkout/payment');
		
		$this->id       = 'payment';
		$this->template = $this->config->get('config_template') . 'payment/pp_standard.tpl';
		
		$this->render();	
	}
	
	public function callback() {
		$this->load->library('encryption');
	
		$encryption = new Encryption($this->config->get('config_encryption'));
		
		if (isset($this->request->get['order_id'])) {
			$order_id = $encryption->decrypt(urldecode($this->request->get['order_id']));
		} else {
			$order_id = 0;
		}

		$this->load->model('checkout/order');
				
		$order_info = $this->model_checkout_order->getOrder($order_id);
		
		if ($order_info) {
			$request = 'cmd=_notify-validate';
		
			foreach ($this->request->post as $key => $value) {
				$request .= '&' . $key . '=' . urlencode(stripslashes($value));
			}

			$header  = 'POST /cgi-bin/webscr HTTP/1.0' . "\r\n";
			$header .= 'Content-Type: application/x-www-form-urlencoded' . "\r\n";
			$header .= 'Content-Length: ' . strlen(utf8_decode($request)) . "\r\n\r\n";
		
			if (!$this->config->get('pp_standard_test')) {
				$fp = fsockopen('www.paypal.com', 80, $errno, $errstr, 30);
			} else {
				$fp = fsockopen('www.sandbox.paypal.com', 80, $errno, $errstr, 30);
			}
		
			if ($fp) {
				fputs($fp, $header . $request);
			
				while (!feof($fp)) {
					$response = fgets($fp, 1024);
				
					if (strcmp($response, 'VERIFIED') == 0) {
						$this->model_checkout_order->confirm($order_id, $this->config->get('config_order_status_id'));
						
						switch($this->request->post['payment_status']){
							case 'Completed':
								$this->model_checkout_order->update($order_id, $this->config->get('pp_standard_order_status_id'), '', TRUE);
								break;
							case 'Canceled_Reversal':
								$this->model_checkout_order->update($order_id, $this->config->get('pp_standard_order_status_canceled_reversal_id'), '', TRUE);
								break;
							case 'Denied':
								$this->model_checkout_order->update($order_id, $this->config->get('pp_standard_order_status_denied_id'), '', TRUE);
								break;
							case 'Failed':
								$this->model_checkout_order->update($order_id, $this->config->get('pp_standard_order_status_failed_id'), '', TRUE);
								break;
							case 'Pending':
								$this->model_checkout_order->update($order_id, $this->config->get('pp_standard_order_status_pending_id'), '', TRUE);
								break;
							case 'Refunded':
								$this->model_checkout_order->update($order_id, $this->config->get('pp_standard_order_status_refunded_id'), '', TRUE);
								break;
							case 'Reversed':
								$this->model_checkout_order->update($order_id, $this->config->get('pp_standard_order_status_reversed_id'), '', TRUE);
								break;
							default:
								$this->model_checkout_order->update($order_id, $this->config->get('pp_standard_order_status_unspecified_id'), '', TRUE);
								break;
						}
					}
				}
			
				fclose($fp);
			}
		}
	}
}
?>
Tell me if it works?

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by Qphoria » Fri Aug 07, 2009 5:25 am

You mean pp_standard.php? Is this a v1.3.0 problem or an earlier problem.

Honestly after reading all the posts scattered around, I still don't know what the problem is. I have my 1.3.0 cart running without problem using paypal standard.

I have a php debugger ide that I use and I've stepped through what I could and saw no issue. Is it a problem on the IPN callback?

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Daniel » Fri Aug 07, 2009 5:46 am

yes its a callback problem with 1.3.0.

I did read recently that paypal was down for a day. I don't know if that affected some accounts some how.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by deluzione » Fri Aug 07, 2009 6:02 am

I had it in 1.2.8 as well. I upgraded now, but I wasn't able to test yet..

New member

Posts

Joined
Fri Jun 05, 2009 6:13 am
Who is online

Users browsing this forum: No registered users and 67 guests