Page 1 of 1
Get zones instead of countries for dashboard map
Posted: Thu May 22, 2025 8:12 pm
by thbr02
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");
Re: Get zones instead of countries for dashboard map
Posted: Fri May 23, 2025 5:45 pm
by paulfeakins
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.
Re: Get zones instead of countries for dashboard map
Posted: Fri May 23, 2025 8:33 pm
by thbr02
The map is already there. The remaining is to get the zones.
Re: Get zones instead of countries for dashboard map
Posted: Sat May 24, 2025 4:28 am
by khnaz35
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.
Re: Get zones instead of countries for dashboard map
Posted: Mon May 26, 2025 9:44 am
by CartCoding
The JQVMAP have not map data for Sweden.
All maps of jqvmap:
https://github.com/10bestdesign/jqvmap/ ... /dist/maps
Re: Get zones instead of countries for dashboard map
Posted: Mon May 26, 2025 1:33 pm
by thbr02
I have configured one myself.
Re: Get zones instead of countries for dashboard map
Posted: Mon May 26, 2025 1:33 pm
by thbr02
Thanky you. I'll take alook at it. Seems it's just what i need.
Re: Get zones instead of countries for dashboard map
Posted: Mon May 26, 2025 3:52 pm
by CartCoding
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.