0

I need to sort product collection by latitude and longitude in product listing and search page.

Explanation:

I have two product attributes Latitude and Longitude. All product has single Latitude and Longitude. Now on product listing page we need to sort product collection by current latitude and longitude.

Suppose my current location latitude is 36.778259 and longitude is -119.417931, In product listing page All product with latitude 36.778259 and longitude -119.417931 has to display first in list page and other near by latitude and longitude products should display respectively and so on. I guess we need to use Google Map API for doing it but not sure how do I do it.

Please provide me some solutions. Any help would be appreciated! Thanks!

1 Answer 1

0

Releated to Google Map API, you can use as a reference this module: https://github.com/ClaudiuCreanga/magento2-store-locator-stockists-extension

1
  • Yes, But how can we sort product collection by latitude and longitude? What would be the collection query to achieve that? Commented Nov 28, 2018 at 5:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.