Post by riwalker » Tue Jul 25, 2023 4:40 am

Upgraded a stock 3.0.3.8 to the maintenance release
had a few errors, all listed within opencart
I had a new problem, but fixed it myself
the nuance here is the site is used in 'catalog' mode with zero orders, so the map.php was throwing errors "($string) of type string is deprecated", admin/controller/extension/dashboard/map.php
"json_decode(): Passing null to parameter #1 ($json) of type string is deprecated"
fixed this by placing a test on line 120, "if (isset($result)) "

Code: Select all

		if (isset($result)) {
        	foreach ($results as $result) {
            	$json[strtolower($result['iso_code_2'])] = array(
                	'total'  => $result['total'],
               	 'amount' => $this->currency->format($result['amount'], $this->config->get('config_currency'))
            	);
        	}
        }

Newbie

Posts

Joined
Thu Nov 23, 2017 9:46 pm

Post by straightlight » Tue Jul 25, 2023 6:18 am

Already fixed in opencart-3: https://github.com/opencart/opencart-3/ ... rd/map.php . However, since you managed to fix the issue another way, please add: [SOLVED] at the beginning of the subject line on your first post.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by ADD Creative » Tue Jul 25, 2023 6:02 pm

I think that error may be caused by an extension or modification. There is no json_decode or line 120 in admin/controller/extension/dashboard/map.php.

Also you are testing $result before it created in the loop. Which is the same as add if (false) and would break things if there were orders to display.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by JNeuhoff » Tue Jul 25, 2023 6:58 pm

There is no bug with this in the 3.0.x.x_Maintenance release. The admin/controller/extension/dashboard/map.php looks like this for function map:

Code: Select all

	public function map() {
		$json = array();

		$this->load->model('extension/dashboard/map');

		$results = $this->model_extension_dashboard_map->getTotalOrdersByCountry();

		foreach ($results as $result) {
			$json[strtolower($result['iso_code_2'])] = array(
				'total'  => $result['total'],
				'amount' => $this->currency->format($result['amount'], $this->config->get('config_currency'))
			);
		}

		$this->response->addHeader('Content-Type: application/json');
		$this->response->setOutput(json_encode($json));
	}
That is, $json always is an array, it's never null ! It works fine even when there are zero orders.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member
Online

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by JaxMusic » Fri May 10, 2024 5:26 am

Upgrading to 3.0.3.9 I received the same error. Since it wasn't functionality I used, I just disabled Map on the Dashboard extension, which resolved it.

Open Cart version 3.0.3.8, JaxMusic.com

Mods & extensions enabled:
Google Shopping, Google Analytics, Dashboard, banners, carousel, Slide Show, Paypal , Reports, Free Shipping, Coupon, Store Credit, Reward Points, Shipping, Subtotal, Taxes, Total, Gift VoucherOpenCart Advertise, Twistin Disable Out of Stock, Teapplix (shipping and stock synch)


Newbie

Posts

Joined
Thu Jul 14, 2022 4:41 am
Who is online

Users browsing this forum: No registered users and 3 guests