Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielborzov/778a31657e0b30033297a4d036c1ad0a to your computer and use it in GitHub Desktop.
Save danielborzov/778a31657e0b30033297a4d036c1ad0a to your computer and use it in GitHub Desktop.
diff --git a/app/addons/store_locator/controllers/frontend/store_locator.php b/app/addons/store_locator/controllers/frontend/store_locator.php
index 2e3e9c45e0..0f25d0a423 100644
--- a/app/addons/store_locator/controllers/frontend/store_locator.php
+++ b/app/addons/store_locator/controllers/frontend/store_locator.php
@@ -81,6 +81,13 @@ if ($mode == 'search') {
];
});
+ if (isset($params['ids'])) {
+ $cities[] = [
+ 'id' => $params['ids'],
+ 'text' => $params['ids']
+ ];
+ }
+
/** @var \Tygh\Ajax $ajax */
$ajax = Tygh::$app['ajax'];
diff --git a/app/addons/store_locator/func.php b/app/addons/store_locator/func.php
index 91f5cf8c2a..52053933e3 100644
--- a/app/addons/store_locator/func.php
+++ b/app/addons/store_locator/func.php
@@ -390,12 +390,11 @@ function fn_get_store_location_cities(array $params = [])
if ($params['items_per_page']) {
$params['total_items'] = (int) db_get_field(
- 'SELECT COUNT(1) AS count' .
+ 'SELECT COUNT(DISTINCT(city)) AS count' .
' FROM ?:store_locations AS locations' .
' LEFT JOIN ?:store_location_descriptions AS descriptions' .
' ON locations.store_location_id = descriptions.store_location_id' .
- ' WHERE ?p' .
- ' GROUP BY city',
+ ' WHERE ?p',
implode(' AND ', $condition)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment