Skip to content

Commit

Permalink
Switched from LEFT to RIGHT JOIN in extension/dashboard/map model
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCartpenter committed May 19, 2024
1 parent 52ad507 commit 811fc05
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion upload/admin/controller/extension/dashboard/map.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function map(): void {
$results = $this->model_extension_dashboard_map->getTotalOrdersByCountry();

foreach ($results as $result) {
$json[$result['iso_code_2']] = [
$json[strtolower($result['iso_code_2'])] = [
'total' => $result['total'],
'amount' => $this->currency->format($result['amount'], $this->config->get('config_currency'))
];
Expand Down
2 changes: 1 addition & 1 deletion upload/admin/model/extension/dashboard/map.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function getTotalOrdersByCountry(): array {
}

if ($implode) {
$query = $this->db->query("SELECT COUNT(*) AS `total`, SUM(`o`.`total`) AS `amount`, LCASE(`c`.`iso_code_2`) AS `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`");
$query = $this->db->query("SELECT COUNT(*) AS `total`, SUM(`o`.`total`) AS `amount`, LCASE(`c`.`iso_code_2`) AS `iso_code_2` FROM `" . DB_PREFIX . "order` `o` RIGHT JOIN `" . DB_PREFIX . "country` `c` ON (`o`.`payment_country_id` = `c`.`country_id`) WHERE (" . implode(" OR ", $implode) . ") GROUP BY `o`.`payment_country_id`");

return $query->rows;
} else {
Expand Down

0 comments on commit 811fc05

Please sign in to comment.