Post by HAO » Sun Apr 30, 2017 11:57 pm

I tried to upgrade my payment module to OpenCart 2.3.0.2, But a similar error message appears.

Code: Select all

Warning: Missing argument 2 for Cart\Currency::format(), called in catalog/model/extension/shipping/ecpaylogistic.php on line 65 and defined in 2302/system/library/cart/currency.php on line 24
Notice: Undefined variable: currency in 2302/system/library/cart/currency.php on line 25
Notice: Undefined index: in 2302/system/library/cart/currency.php on line 25
Notice: Undefined variable: currency in 2302/system/library/cart/currency.php on line 26
Notice: Undefined index: in 2302/system/library/cart/currency.php on line 26
Notice: Undefined variable: currency in 2302/system/library/cart/currency.php on line 27
Notice: Undefined index: in 2302/system/library/cart/currency.php on line 27
Notice: Undefined variable: currency in 2302/system/library/cart/currency.php on line 30
Notice: Undefined index: in 2302/system/library/cart/currency.php on line 30
catalog/model/extension/shipping/ecpaylogistic.php Code:

Code: Select all

			if ($ecpaylogisticSetting['ecpaylogistic_unimart_status']) {
				$shipping_cost = ($isFreeShipping) ? 0 : $ecpaylogisticSetting['ecpaylogistic_unimart_fee'];
				$quote_text = (strpos(VERSION, '2.2.') !== false) ? $this->currency->format($shipping_cost, $this->session->data['currency']) : $this->currency->format($shipping_cost);
				$quote_data['unimart'] = array(
						'code'         => 'ecpaylogistic.unimart',
						'title'        => $this->language->get('text_unimart'),
						'cost'         => $shipping_cost,
						'tax_class_id' => 0,
						'text'         => $quote_text,
				);
				$Extra['last_ecpaylogistic_shipping_code'] = 'unimart';
			}
Looks like this should be a problem:

Code: Select all

$quote_text = (strpos(VERSION, '2.2.') !== false) ? $this->currency->format($shipping_cost, $this->session->data['currency']) :
How can I fix it?
Last edited by HAO on Mon May 01, 2017 9:59 pm, edited 1 time in total.

HAO
Active Member

Posts

Joined
Fri Jun 03, 2011 2:52 pm

Post by imdevlper18 » Mon May 01, 2017 2:51 pm

Hi,

Since you are on 2.3.x version.
Change this code

Code: Select all

$quote_text = (strpos(VERSION, '2.2.') !== false) ? $this->currency->format($shipping_cost, $this->session->data['currency']) : $this->currency->format($shipping_cost);
To this

Code: Select all

$quote_text = $this->currency->format($shipping_cost, $this->session->data['currency']);

Opencart Extensions | Professional opencart support | Support Ticket | support@cartbinder.com


User avatar
Active Member

Posts

Joined
Sun May 11, 2014 2:04 pm

Post by pprmkr » Mon May 01, 2017 2:51 pm

Code: Select all

$quote_text = (strpos(VERSION, '2.2.') !== false) ? $this->currency->format($shipping_cost, $this->session->data['currency']) : $this->currency->format($shipping_cost);
This returns 'false' on version 2.3.0.2 and will use $this->currency->format($shipping_cost);

Better use PHp function 'version_compare' ( http://php.net/manual/en/function.version-compare.php ) :

Code: Select all

$quote_text = version_compare(VERSION, '2.2.0.0', '>=') ? $this->currency->format($shipping_cost, $this->session->data['currency']) : $this->currency->format($shipping_cost);

User avatar
Active Member

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by HAO » Mon May 01, 2017 9:58 pm

Thank you for your reply!

The problem has been solved!

HAO
Active Member

Posts

Joined
Fri Jun 03, 2011 2:52 pm
Who is online

Users browsing this forum: No registered users and 34 guests