From 32a2a35d4fe01576987975fc298a3998e0e9b240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Magrez?= Date: Thu, 21 Mar 2024 16:06:01 +0100 Subject: [PATCH] Update retailer list on moveend map event --- .../product/view/retailer/availability.phtml | 2 +- .../web/js/retailer/product-availability.js | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/view/frontend/templates/product/view/retailer/availability.phtml b/view/frontend/templates/product/view/retailer/availability.phtml index 15e765b..f323790 100644 --- a/view/frontend/templates/product/view/retailer/availability.phtml +++ b/view/frontend/templates/product/view/retailer/availability.phtml @@ -77,7 +77,7 @@ use Smile\RetailerOffer\Block\Catalog\Product\Retailer\Availability;
- +
diff --git a/view/frontend/web/js/retailer/product-availability.js b/view/frontend/web/js/retailer/product-availability.js index cdf99dd..8dcde52 100644 --- a/view/frontend/web/js/retailer/product-availability.js +++ b/view/frontend/web/js/retailer/product-availability.js @@ -141,8 +141,6 @@ define([ /** * Geolocalize me button action - * - * @returns {string} */ geolocalizeMe: function() { registry.get(this.name + '.geocoder', function (geocoder) { @@ -153,8 +151,6 @@ define([ /** * Action on geolocation success - * - * @returns {string} */ geolocationSuccess: function(position) { if (position.coords && position.coords.latitude && position.coords.longitude) { @@ -169,8 +165,6 @@ define([ /** * Update list of displayed offers - * - * @returns {string} */ updateDisplayedOffers: function () { registry.get(this.name + '.map', function (map) { @@ -178,6 +172,19 @@ define([ this.map.refreshDisplayedMarkers(); this.displayedOffers(this.map.displayedMarkers()); }.bind(this)); + }, + + /** + * Load modal function to set moveend event on map + * + * @returns {string} + */ + loadRetailerAvailabilityModal : function () { + let self = this; + registry.get(this.name + '.map', function (map) { + this.map = map; + this.map.map.on('moveend', self.updateDisplayedOffers.bind(self)); + }.bind(this)); } }); });