Page 1 of 1

[SOLVED] Submit button not bring up PayPal Commerce

Posted: Wed Sep 20, 2023 2:25 am
by jmastin
Version 3.0.3.2

When checking out and submit order is clicked, nothing happens. I recently updated the PayPal commerce and everything was working just fine. There have been three weeks or so of no orders and when I went to check, the button is not working. I have disconnected and reconnected and nothing that I know to do seems to fix the issue.

I downloaded the new PayPal integration and the same thing is occurring or I get a credit card input without anywhere to fill in the information.

Re: Submit button not bring up PayPal Commerce

Posted: Wed Sep 20, 2023 6:34 am
by jmastin
Notice: Undefined property: Proxy::getAgreeStatus in /home/customer/www/lovephoebeluna.com/storage/modification/system/engine/action.php on line 79

I restored a backup to return back to the PayPal Commerce Platform and when I hit submit, this message showed up.

"Notice: Undefined property: Proxy::getAgreeStatus in /home/customer/www/lovephoebeluna.com/storage/modification/system/engine/action.php on line 79"

This is what line 79 says:

Code: Select all

return call_user_func_array(array($controller, $this->method), $args);

Re: Submit button not bring up PayPal Commerce

Posted: Thu Sep 21, 2023 4:02 pm
by ADD Creative
The problem is that some part of the code is trying to call a function call getAgreeStatus, which does not exist. getAgreeStatus in not part of OpenCart so search in your .php files to work out what extension is calling it. Then remove and reinstall that extension.

Re: Submit button not bring up PayPal Commerce

Posted: Thu Sep 21, 2023 9:44 pm
by jmastin
ADD Creative wrote:
Thu Sep 21, 2023 4:02 pm
The problem is that some part of the code is trying to call a function call getAgreeStatus, which does not exist. getAgreeStatus in not part of OpenCart so search in your .php files to work out what extension is calling it. Then remove and reinstall that extension.
I reinstalled the extension and now the "submit" button on the cart page, not working. It does not pull up the credit card input box or anything. There is no reaction. All the required address and contact information is filled out.

Re: Submit button not bring up PayPal Commerce

Posted: Thu Sep 21, 2023 11:50 pm
by ADD Creative
Check both the PHP and OpenCart error logs. Check your web browser's developer tool for messages when to checkout.

Re: Submit button not bring up PayPal Commerce

Posted: Sat Sep 23, 2023 12:43 am
by jmastin
ADD Creative wrote:
Thu Sep 21, 2023 11:50 pm
Check both the PHP and OpenCart error logs. Check your web browser's developer tool for messages when to checkout.
OC: 2023-09-22 16:44:16 - PHP Notice: Trying to access array offset on value of type null in /home/customer/www/lovephoebeluna.com/storage/vendor/scss.inc.php on line 1753

PHP:
#0 /home/customer/www/lovephoebeluna.com/public_html/catalog/controller/extension/onepagecheckout/payment_method.php(131): Loader->model('extension/payme...')
#1 /home/customer/www/lovephoebeluna.com/storage/modification/system/engine/action.php(79): ControllerExtensionOnepagecheckoutPaymentMethod->index()
#2 /home/customer/www/lovephoebeluna.com/storage/modification/catalog/controller/startup/router.php(38): Action->execute(Object(Registry))
#3 /home/customer/www/lovephoebeluna.com/storage/modification/system/engine/action.php(79): ControllerStartupRouter->index()
#4 /home/customer/www/lovephoebeluna.com/storage/modification/system/engine/router.php(92): Action->execute(Object(Registry))
#5 /home/customer/www/lovephoebeluna.com/storage/modification/system/engine/router.php(81): Router->execute(Object(Action))
#6 /home/customer/www/lov in /home/customer/www/lovephoebeluna.com/storage/modification/system/engine/loader.php on line 60
[22-Sep-2023 13:33:28 UTC] PHP Fatal error: Uncaught Exception: Error: Could not load model extension/payment/paypal! in /home/customer/www/lovephoebeluna.com/storage/modification/system/engine/loader.php:60
Stack trace:

Re: Submit button not bring up PayPal Commerce

Posted: Mon Sep 25, 2023 1:10 am
by ADD Creative
The last error suggests that the file catalog/model/extension/payment/paypal.php is missing or can't be accessed.

Re: Submit button not bring up PayPal Commerce

Posted: Mon Sep 25, 2023 6:34 am
by jmastin
ADD Creative wrote:
Mon Sep 25, 2023 1:10 am
The last error suggests that the file catalog/model/extension/payment/paypal.php is missing or can't be accessed.
The file is showing. I am not sure what is blocking access to it.

This is the file

Code: Select all

<?php
class ModelExtensionPaymentPayPal extends Model {
	public function getMethod($address, $total) {
		$method_data = array();
		
		$agree_status = $this->getAgreeStatus();
		
		if ($this->config->get('payment_paypal_status') && $this->config->get('payment_paypal_client_id') && $this->config->get('payment_paypal_secret') && $agree_status) {
			$this->load->language('extension/payment/paypal');

			$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$this->config->get('payment_paypal_geo_zone_id') . "' AND country_id = '" . (int)$address['country_id'] . "' AND (zone_id = '" . (int)$address['zone_id'] . "' OR zone_id = '0')");

			if (($this->config->get('payment_paypal_total') > 0) && ($this->config->get('payment_paypal_total') > $total)) {
				$status = false;
			} elseif (!$this->config->get('payment_paypal_geo_zone_id')) {
				$status = true;
			} elseif ($query->num_rows) {
				$status = true;
			} else {
				$status = false;
			}

			if ($status) {			
				$method_data = array(
					'code'       => 'paypal',
					'title'      => $this->language->get('text_paypal_title'),
					'terms'      => '',
					'sort_order' => $this->config->get('payment_paypal_sort_order')
				);
			}
		}

		return $method_data;
	}
	
	public function hasProductInCart($product_id, $option = array(), $recurring_id = 0) {
		$query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "cart WHERE api_id = '" . (isset($this->session->data['api_id']) ? (int)$this->session->data['api_id'] : 0) . "' AND customer_id = '" . (int)$this->customer->getId() . "' AND session_id = '" . $this->db->escape($this->session->getId()) . "' AND product_id = '" . (int)$product_id . "' AND recurring_id = '" . (int)$recurring_id . "' AND `option` = '" . $this->db->escape(json_encode($option)) . "'");
				
		return $query->row['total'];
	}
	
	public function getCountryByCode($code) {
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "country WHERE iso_code_2 = '" . $this->db->escape($code) . "' AND status = '1'");
				
		return $query->row;
	}
	
	public function getZoneByCode($country_id, $code) {
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone WHERE country_id = '" . (int)$country_id . "' AND (code = '" . $this->db->escape($code) . "' OR name = '" . $this->db->escape($code) . "') AND status = '1'");
		
		return $query->row;
	}
	
	public function getAgreeStatus() {
		$agree_status = true;
		
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "country WHERE status = '1' AND (iso_code_2 = 'CU' OR iso_code_2 = 'IR' OR iso_code_2 = 'SY' OR iso_code_2 = 'KP')");
		
		if ($query->rows) {
			$agree_status = false;
		}
		
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone WHERE country_id = '220' AND status = '1' AND (`code` = '43' OR `code` = '14' OR `code` = '09')");
		
		if ($query->rows) {
			$agree_status = false;
		}
		
		return $agree_status;
	}
	
	public function log($data, $title = null) {
		// Setting
		$_config = new Config();
		$_config->load('paypal');
			
		$config_setting = $_config->get('paypal_setting');
		
		$setting = array_replace_recursive((array)$config_setting, (array)$this->config->get('payment_paypal_setting'));
			
		if ($setting['general']['debug']) {
			$log = new Log('paypal.log');
			$log->write('PayPal debug (' . $title . '): ' . json_encode($data));
		}
	}
}

Re: Submit button not bring up PayPal Commerce

Posted: Mon Sep 25, 2023 6:19 pm
by ADD Creative
Do you get a "PHP Fatal error: Uncaught Exception: Error: Could not load model extension/payment/paypal!" entry in the error log every time you get to the payment stage at checkout or was it a one off?

Re: Submit button not bring up PayPal Commerce

Posted: Mon Sep 25, 2023 8:25 pm
by jmastin
ADD Creative wrote:
Mon Sep 25, 2023 6:19 pm
Do you get a "PHP Fatal error: Uncaught Exception: Error: Could not load model extension/payment/paypal!" entry in the error log every time you get to the payment stage at checkout or was it a one off?
It has come up more than once but not often. That message showed up on the actual cart page where the credit card input should have been showing after clicking "submit" for the order.

Re: Submit button not bring up PayPal Commerce

Posted: Mon Sep 25, 2023 11:25 pm
by ADD Creative
Check the file's permissions. Should usually be 0644, but you may have to ask your host. You could also test with the default OpenCart checkout and not the one page checkout extension you are using.

Re: Submit button not bring up PayPal Commerce

Posted: Tue Sep 26, 2023 1:06 am
by jmastin
ADD Creative wrote:
Mon Sep 25, 2023 11:25 pm
Check the file's permissions. Should usually be 0644, but you may have to ask your host. You could also test with the default OpenCart checkout and not the one page checkout extension you are using.
Permission is 644. Default checkout gives me this message:

Notice: Undefined property: Proxy::getAgreeStatus in /home/customer/www/lovephoebeluna.com/storage/modification/system/engine/action.php on line 79

Code: Select all

<?php
/**
 * @package		OpenCart
 * @author		Daniel Kerr
 * @copyright	Copyright (c) 2005 - 2017, OpenCart, Ltd. (https://www.opencart.com/)
 * @license		https://opensource.org/licenses/GPL-3.0
 * @link		https://www.opencart.com
*/

/**
* Action class
*/
class Action {
	private $id;
	private $route;
	private $method = 'index';
	
	/**
	 * Constructor
	 *
	 * @param	string	$route
 	*/
	public function __construct($route) {
		$this->id = $route;
		
		$parts = explode('/', preg_replace('/[^a-zA-Z0-9_\/]/', '', (string)$route));

		// Break apart the route
		while ($parts) {
			$file = DIR_APPLICATION . 'controller/' . implode('/', $parts) . '.php';

			if (is_file($file)) {
				$this->route = implode('/', $parts);		
				
				break;
			} else {
				$this->method = array_pop($parts);
			}
		}
	}

	/**
	 * 
	 *
	 * @return	string
	 *
 	*/	
	public function getId() {
		return $this->id;
	}
	
	/**
	 * 
	 *
	 * @param	object	$registry
	 * @param	array	$args
 	*/	
	public function execute($registry, array $args = array()) {
		// Stop any magical methods being called
		if (substr($this->method, 0, 2) == '__') {
			return new \Exception('Error: Calls to magic methods are not allowed!');
		}

		$file  = DIR_APPLICATION . 'controller/' . $this->route . '.php';	
		$class = 'Controller' . preg_replace('/[^a-zA-Z0-9]/', '', $this->route);
		
		// Initialize the class
		if (is_file($file)) {
			include_once(modification($file));
		
			$controller = new $class($registry);
		} else {
			return new \Exception('Error: Could not call ' . $this->route . '/' . $this->method . '!');
		}
		
		$reflection = new ReflectionClass($class);
		
		if ($reflection->hasMethod($this->method) && $reflection->getMethod($this->method)->getNumberOfRequiredParameters() <= count($args)) {
			return call_user_func_array(array($controller, $this->method), $args);
		} else {
			return new \Exception('Error: Could not call ' . $this->route . '/' . $this->method . '!');
		}
	}
}
error log:

#0 /home/customer/www/lovephoebeluna.com/public_html/catalog/controller/extension/onepagecheckout/payment_method.php(131): Loader->model('extension/payme...')
#1 /home/customer/www/lovephoebeluna.com/storage/modification/system/engine/action.php(79): ControllerExtensionOnepagecheckoutPaymentMethod->index()
#2 /home/customer/www/lovephoebeluna.com/storage/modification/catalog/controller/startup/router.php(38): Action->execute(Object(Registry))
#3 /home/customer/www/lovephoebeluna.com/storage/modification/system/engine/action.php(79): ControllerStartupRouter->index()
#4 /home/customer/www/lovephoebeluna.com/storage/modification/system/engine/router.php(92): Action->execute(Object(Registry))
#5 /home/customer/www/lovephoebeluna.com/storage/modification/system/engine/router.php(81): Router->execute(Object(Action))
#6 /home/customer/www/lov in /home/customer/www/lovephoebeluna.com/storage/modification/system/engine/loader.php on line 60

Line 60:

Code: Select all

			} else {
				throw new \Exception('Error: Could not load model ' . $route . '!');
			}

Re: Submit button not bring up PayPal Commerce

Posted: Tue Sep 26, 2023 2:39 am
by ADD Creative
What other extension do you have? Have you tried disabling some and refreshing modifications to see if any are conflicting?

Re: Submit button not bring up PayPal Commerce

Posted: Tue Sep 26, 2023 6:25 am
by jmastin
ADD Creative wrote:
Tue Sep 26, 2023 2:39 am
What other extension do you have? Have you tried disabling some and refreshing modifications to see if any are conflicting?
I have Sapphire Pro security module & One Page Checkout by Extension Bazaar

Sapphire Pro - If I turn off the "Protect from Spam" option and the One Page Checkout is disabled, the submit button appears again as well as the credit card input box. However, a few minutes after the protect from spam button was switched to no, I received 1200+ messages that core files to my opencart and/or ShopUnity files have been altered. Everything began to run slow and I started receiving page unresponsive messages from Google Chrome. I restored an old backup. Now I am concerned about switching off the spam protection. Odd that it occurred very shortly after I turned it off.

Re: Submit button not bring up PayPal Commerce

Posted: Tue Sep 26, 2023 3:56 pm
by ADD Creative
I would contact the developer of the Sapphire Pro Security Module and ask them about compatibility with the PayPal payment extension and about the "Protect from Spam" option.

Re: [SOLVED] Submit button not bring up PayPal Commerce

Posted: Mon Nov 11, 2024 6:09 am
by hamidg84
Hello OP,

Did you manage to fix it? I'm having the same issue.