Problem with pickup point marker position

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 anni tempo fa
Hi Andrei,

One of our clients reported an issue with wrong points marker position on the map if the pickup points have coordinates. In the default plugin, it is not possible to add coordinates (longitude and latitude) but they are available in the PickupPoint class and you can set them.

In the dropdown with the pickup points options, the first marker is correct but if the customer selects any of the other ones the marker is placed on the coordinates of the last pickup point. The description and title are changing correctly but not the position of the pin.

In the ShipppingAddress.cshtml and OpcShippingsAddress.cshtml the pickup points markers code is generated in a loop, but the problem is that the "marker" variable is added multiple times in the code and the last one overwrites the previous. This can be seen here:
https://www.nop-templates.com/Help/nopCommerce_forum/PickupPointsProblem/pickuppoints.jpg


One of the solutions that we have found is to wrap the code for the marker inside an IIFE e.g.:

(function() {
  var marker = new google.maps.Marker({
    map: googleMap,
    title: "@point.Name",
    position: new google.maps.LatLng(@point.Latitude, @point.Longitude),
    icon: "http://maps.google.com/mapfiles/ms/icons/blue-dot.png"
  });
  markers.set("@value", marker);
  google.maps.event.addListener(marker, 'click', function () {
    $('#pickup-points-select').val("@value")
    infowindow.setContent("@pickupPointInfo");
    infowindow.open(googleMap, marker);
  });
  @if (i == 0)
  {
    <text>googleMap.setCenter(marker.getPosition())</text>
  }
}());


This problem doesn't exist when the point hasn't got coordinates because in that case the markers code is placed in a function.

Regards,
Stoyan
7 anni tempo fa
Hi Stoyan,

Thanks a lot! We'll fix it soon (work item)
7 anni tempo fa
Fixed. Thanks for contribution
7 anni tempo fa
RomanovM wrote:
Fixed. Thanks for the contribution.


Thank you! Great work as always!

Regards,
Stoyan
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.