Post by thbr02 » Thu May 22, 2025 8:12 pm

I've replaced the world map at dashboard to a map of Sweden. Now I would like to add a function to the model/extension/dashboard/map.php, which retrievs the zones instead of the countries. I've found the inquiry to retrieve the countries, but I've not the knowledge how to alter it in a proper way to retrieve zones instead of the countries. Would anyone be kind to give me a hint?

Code: Select all

$query = $this->db->query("SELECT COUNT(*) AS total, SUM(o.total) AS amount, c.iso_code_2 FROM `" . DB_PREFIX . "order` o LEFT JOIN `" . DB_PREFIX . "country` c ON (o.payment_country_id = c.country_id) WHERE o.order_status_id IN(" . implode(',', $implode) . ") GROUP BY o.payment_country_id");

Active Member

Posts

Joined
Wed Jun 22, 2011 10:30 pm
Location - Sweden

Post by paulfeakins » Fri May 23, 2025 5:45 pm

thbr02 wrote:
Thu May 22, 2025 8:12 pm
I've replaced the world map at dashboard to a map of Sweden.
I think if you want this to work it's the sort of thing you'd need a developer for.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by thbr02 » Fri May 23, 2025 8:33 pm

The map is already there. The remaining is to get the zones.

Active Member

Posts

Joined
Wed Jun 22, 2011 10:30 pm
Location - Sweden

Post by khnaz35 » Sat May 24, 2025 4:28 am

Take a look on this extension and adopt as you needed.
https://www.opencart.com/index.php?rout ... ort=rating

If you don't know how to code you can always hire a developer.

Got an urgent question that’s keeping you up at night? There might just be a magical inbox ready to help: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by CartCoding » Mon May 26, 2025 9:44 am

The JQVMAP have not map data for Sweden.

All maps of jqvmap: https://github.com/10bestdesign/jqvmap/ ... /dist/maps

Tracking Assiatant - Integrate Realtime Tracking Information on Website
OpenCart Extensions, Plugins Development, Themes Design and Website Optimization
FREE Guidance and Advice at https://www.cartcoding.com


User avatar
Newbie

Posts

Joined
Thu Aug 03, 2023 3:48 pm

Post by thbr02 » Mon May 26, 2025 1:33 pm

CartCoding wrote:
Mon May 26, 2025 9:44 am
The JQVMAP have not map data for Sweden.

All maps of jqvmap: https://github.com/10bestdesign/jqvmap/ ... /dist/maps
I have configured one myself.

Active Member

Posts

Joined
Wed Jun 22, 2011 10:30 pm
Location - Sweden

Post by thbr02 » Mon May 26, 2025 1:33 pm

khnaz35 wrote:
Sat May 24, 2025 4:28 am
Take a look on this extension and adopt as you needed.
https://www.opencart.com/index.php?rout ... ort=rating

If you don't know how to code you can always hire a developer.
Thanky you. I'll take alook at it. Seems it's just what i need.

Active Member

Posts

Joined
Wed Jun 22, 2011 10:30 pm
Location - Sweden

Post by CartCoding » Mon May 26, 2025 3:52 pm

Please try to modify follow code:
{your_path}/admin/model/extension/dashboard/map.php

Code: Select all

$query = $this->db->query("SELECT COUNT(*) AS total, SUM(o.total) AS amount, z.code FROM `" . DB_PREFIX . "order` o LEFT JOIN `" . DB_PREFIX . "zone` z ON (o.payment_zone_id = z.zone_id) LEFT JOIN `" . DB_PREFIX . "country` c ON (z.country_id=c.country_id) WHERE o.order_status_id IN(" . implode(',', $implode) . ") AND c.name='Sweden' GROUP BY o.payment_zone_id");
{your_path}/admin/controller/extension/dashboard/map.php

Code: Select all

$json[strtolower($result['code'])] = array(
	'total'  => $result['total'],
	'amount' => $this->currency->format($result['amount'], $this->config->get('config_currency'))
);
{your_path}/admin/view/template/extension/dashboard/map_info.twig

Code: Select all

<script type="text/javascript" src="view/javascript/jquery/jqvmap/maps/{your_jqvmap.js}"></script> 

{your_path} is your real path, {your_jqvmap.js} is your real file name.

Tracking Assiatant - Integrate Realtime Tracking Information on Website
OpenCart Extensions, Plugins Development, Themes Design and Website Optimization
FREE Guidance and Advice at https://www.cartcoding.com


User avatar
Newbie

Posts

Joined
Thu Aug 03, 2023 3:48 pm
Who is online

Users browsing this forum: No registered users and 21 guests