Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

332
Views
Cómo iniciar la ventana modal varias veces (Geowidget) Inpost

Tengo un mercado con algunos vendedores. En el carrito, los clientes que agregan productos de pocos proveedores deben seleccionar algunos puntos del casillero de paquetes. Mi guión es bueno para un proveedor: un punto de selección, pero no para pocos. Cuando el cliente hace clic en los primeros puntos seleccionados, no puede seleccionar el siguiente punto porque la ventana modal ya está inicializada y devuelve los datos al primer punto. ¿Qué puedo mejorar para que javascript funcione independientemente de varios proveedores?

 <script src="https://geowidget.easypack24.net/js/sdk-for-javascript.js"></script> <script type="text/javascript"> window.easyPackAsyncInit = function () { easyPack.init({ defaultLocale: 'pl', mapType: 'osm', searchType: 'osm', points: { types: ['parcel_locker', 'pop'], functions: ['parcel_collect'] }, map: { initialTypes: ['parcel_locker'], } }); }; function openModal(id_method) { easyPack.modalMap(function(point, modal) { $('input[name="parcel_locker_name_'+id_method+'"]').val(point.name); modal.closeModal(); console.log(point); }, { width: 500, height: 600 }); } </script>

y php/html:

 <p>Vendor 1</p> <div class="parcel_locker"> <input type="hidden" class="custom-control-input" name="parcel_locker_name_1" id="parcel_locker_name_1" value=""> <button id="button_select_parcel_locker_1" class="btn btn-lg btn-custom" onclick="openModal(1); return false;">Select parcel locker</button> </div> <p>Vendor 2</p> <div class="parcel_locker"> <input type="hidden" class="custom-control-input" name="parcel_locker_name_2" id="parcel_locker_name_2" value=""> <button id="button_select_parcel_locker_2" class="btn btn-lg btn-custom" onclick="openModal(2); return false;">Select parcel locker</button> </div> <p>Vendor (n)</p> <div class="parcel_locker"> <input type="hidden" class="custom-control-input" name="parcel_locker_name_(n)" id="parcel_locker_name_(n)" value=""> <button id="button_select_parcel_locker_n" class="btn btn-lg btn-custom" onclick="openModal(n); return false;">Select parcel locker</button> </div>
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Se me ocurre la idea de pasar la identificación en easyPack.init (identificación del proveedor, por ejemplo)

 window.easyPack.init({ defaultLocale: "pl", mapType: "osm", searchType: "osm", packageID: singlePackage.packageID, < ----- points: { types: ["parcel_locker"], }, map: { initialTypes: ["parcel_locker"], }, });

luego en window.easyPack.modalMap puede verificar la identificación pasada con

 modal.easyPackConfig.packageID

y con esta identificación, guarde el punto elegido para cierto proveedor

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!