Post by main@salura.org » Thu Sep 19, 2024 8:39 pm

Hello,

I'm using opencart with ronixa theme, I would like to add a map on the page where the cart is, under the shipping selection, where there will be a list of Packetka subscription locations, where the user chooses a location and its address is then inserted in the delivery address.

As for the map display it's code see below.

Can anyone advise on the best and easiest way to insert the map?

I already tried something, but all I got was an error

Thank you in advance for your feedback!

Code:

Code: Select all

      <script src="https://widget.packeta.com/v6/www/js/library.js"></script>

        <script>
          const packetaApiKey = ' ';
          
          const packetaOptions = {
              valueFormat: "\"Packeta\",id,carrierId,carrierPickupPointId,name,city,street", 
	view: "modal"
          };
          
          false
      
          function showSelectedPickupPoint(point) {
              const saveElement = document.querySelector(".packeta-selector-value");
              // Add here an action on pickup point selection
              saveElement.innerText = '';
              if (point) {
                console.log("Selected point", point);
                saveElement.innerText = "Address: " + point.formatedValue; 
              }
          }
      
        </script>

         <button class="packeta-selector-open" onclick="Packeta.Widget.pick(packetaApiKey, showSelectedPickupPoint, packetaOptions)">Select pick-up point</button>    
         <div class="packeta-selector-value"></div>
      


Posts

Joined
Tue Mar 07, 2023 12:05 am
Who is online

Users browsing this forum: No registered users and 10 guests