Page 1 of 1

Warning in confirm payment whit Paypal (Opencart 1.3.0)

Posted: Tue Aug 11, 2009 5:14 pm
by gradamedia
Hi
I have a problem.
I used Opencart 1.3.0 translated to spanish.
The message appaer in checkout/confirm only whit paypal method:

Code: Select all

Warning: Division by zero in C:\AppServ\www\opencart130\system\library\encryption.php on line 14

Warning: Division by zero in C:\AppServ\www\opencart130\system\library\encryption.php on line 14
Thanks a lot.

Excuse my english ;D

David.

Re: Warning in confirm payment whit Paypal (Opencart 1.3.0)

Posted: Tue Aug 11, 2009 10:25 pm
by Qphoria
Not sure but do you have a value in the Admin->Configuration->Setting->Server Tab
Encryption key? Put anything there (ex. ABC123 or AGBSHW or AJG244 etc)

Re: Warning in confirm payment whit Paypal (Opencart 1.3.0)

Posted: Wed Aug 12, 2009 7:04 pm
by gradamedia
Thanks Qphoria

Is solved!!!!!

That was the problem.

Orders in missing status with Paypal standard in OC 1.3.2

Posted: Fri Aug 14, 2009 8:38 pm
by gradamedia
Hi again:
I have setup the shop with OC 1.3.2 in localhost, activated the standard paypal module put the module in test mode, I have signed up to paypal developer and created a sandbox account, it transfers me from checkout to paypal, but the orders only saved missing status.
Does this happen when Paypal is in test mode?
Thanks a lot
David

Re: Warning in confirm payment whit Paypal (Opencart 1.3.0)

Posted: Fri Aug 14, 2009 8:48 pm
by Qphoria
the order only gets updated when you actually finish the paypal process

Re: Warning in confirm payment whit Paypal (Opencart 1.3.0)

Posted: Sat Aug 15, 2009 10:27 am
by publicbar
Hi,

I installed this site: http://www.topgunmarketing.net/
A long time ago. Yesterday someone placed an order which paypal took the money for yet there
was no record anywhere in the system of what was purchased (NO order was recorded??)
I tested the system myself and it worked fine, so did a friend and it worked fine for him.

Could anyone give me some clues as to what could be causing this ?

PS: The admin is also no being emailed when an order is made. setting are set to yes EG:
E-Mail: abc@test.com
Send E-Mails: Yes

thanks
Chris

Re: Warning in confirm payment whit Paypal (Opencart 1.3.0)

Posted: Sat Aug 15, 2009 10:40 am
by Daniel
your using a realyl old version that snot really supported.

Re: Warning in confirm payment whit Paypal (Opencart 1.3.2)

Posted: Tue Aug 18, 2009 6:11 pm
by gradamedia
Hi me again:
The problem with Paypal standard persists (OC 1.3.2), I tried to test mode and also in normal mode.
Then show the contents of files associated with paypal standard.

catalog/controller/payment/pp_standrad.php

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'), ENT_QUOTES, 'UTF-8');				
		$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'] = html_entity_decode($order_info['payment_firstname'], ENT_QUOTES, 'UTF-8');	
		$this->data['last_name'] = html_entity_decode($order_info['payment_lastname'], ENT_QUOTES, 'UTF-8');	
		$this->data['address1'] = html_entity_decode($order_info['payment_address_1'], ENT_QUOTES, 'UTF-8');	
		$this->data['address2'] = html_entity_decode($order_info['payment_address_2'], ENT_QUOTES, 'UTF-8');	
		$this->data['city'] = html_entity_decode($order_info['payment_city'], ENT_QUOTES, 'UTF-8');	
		$this->data['zip'] = html_entity_decode($order_info['payment_postcode'], ENT_QUOTES, 'UTF-8');	
		
		$payment_address = $this->customer->getAddress($this->session->data['payment_address_id']);
		
		$this->data['country'] = $payment_address['iso_code_2'];
		
		$this->data['notify_url'] = $this->url->http('payment/pp_standard/callback');
		$this->data['email'] = $order_info['email'];
		$this->data['invoice'] = $this->session->data['order_id'] . ' - ' . html_entity_decode($order_info['payment_firstname'], ENT_QUOTES, 'UTF-8') . ' ' . html_entity_decode($order_info['payment_lastname'], ENT_QUOTES, 'UTF-8');
		$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->load->library('encryption');
		
		$encryption = new Encryption($this->config->get('config_encryption'));
		
		$this->data['custom'] = $encryption->encrypt($this->session->data['order_id']);

		$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->post['custom'])) {
			$order_id = $encryption->decrypt($this->request->post['custom']);
		} 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));
			}
				
			if (extension_loaded('curl')) {
				if (!$this->config->get('pp_standard_test')) {
					$ch = curl_init('https://www.paypal.com/cgi-bin/webscr');
				} else {
					$ch = curl_init('https://www.sandbox.paypal.com/cgi-bin/webscr');
				}

				curl_setopt($ch, CURLOPT_POST, true);
				curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
				curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
				curl_setopt($ch, CURLOPT_HEADER, false);
				curl_setopt($ch, CURLOPT_TIMEOUT, 30);
				curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
		
				$response = curl_exec($ch);
		
				if (strcmp($response, 'VERIFIED') == 0) {
					$this->model_checkout_order->confirm($order_id, $this->config->get('pp_standard_order_status_id'));
				}
					
				curl_close($ch);
			} else {
				$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";
				$header .= 'Connection: close'  ."\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('pp_standard_order_status_id'));
						}
					}
				
					fclose($fp);
				}
			}
		}
	}
}
?>
catalog/view/theme/default/template/payment/pp_standard.tpl

Code: Select all

<form action="<?php echo $action; ?>" method="post" id="checkout">
  <input type="hidden" name="cmd" value="_xclick" />
  <input type="hidden" name="business" value="<?php echo $business; ?>" />
  <input type="hidden" name="item_name" value="<?php echo $item_name; ?>" />
  <input type="hidden" name="currency_code" value="<?php echo $currency_code; ?>" />
  <input type="hidden" name="amount" value="<?php echo $amount; ?>" />
  <input type="hidden" name="first_name" value="<?php echo $first_name; ?>" />
  <input type="hidden" name="last_name" value="<?php echo $last_name; ?>" />
  <input type="hidden" name="address1" value="<?php echo $address1; ?>" />
  <input type="hidden" name="address2" value="<?php echo $address2; ?>" />
  <input type="hidden" name="city" value="<?php echo $city; ?>" />
  <input type="hidden" name="zip" value="<?php echo $zip; ?>" />
  <input type="hidden" name="country" value="<?php echo $country; ?>" />
  <input type="hidden" name="address_override" value="0" />
  <input type="hidden" name="notify_url" value="<?php echo $notify_url; ?>" />
  <input type="hidden" name="email" value="<?php echo $email; ?>" />
  <input type="hidden" name="invoice" value="<?php echo $invoice; ?>" />
  <input type="hidden" name="lc" value="<?php echo $lc; ?>" />
  <input type="hidden" name="return" value="<?php echo $return; ?>" />
  <input type="hidden" name="rm" value="2" />
  <input type="hidden" name="no_note" value="1" />
  <input type="hidden" name="cancel_return" value="<?php echo $cancel_return; ?>" />
  <input type="hidden" name="paymentaction" value="<?php echo $paymentaction; ?>" />
  <input type="hidden" name="custom" value="<?php echo $custom; ?>" />
</form>
<div class="buttons">
  <table>
    <tr>
      <td align="left"><a onclick="location = '<?php echo $back; ?>'" class="button"><span><?php echo $button_back; ?></span></a></td>
      <td align="right"><a onclick="$('#checkout').submit();" class="button"><span><?php echo $button_confirm; ?></span></a></td>
    </tr>
  </table>
</div>
And they also attached a screenshot of the behavior of Firebug at the right time to finish the payment with paypal standard mode normal.

Thanks in advance for your help.