Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

333
Vistas
How init modal window for multiple times (Geowidget) Inpost

I have a marketplace with a few vendors. In cart clients who adds products from few vendors have to select few points of parcel locker. My script is good for one vendor - one select point but not for few. When client click on first select points - can't select next point because modal window is inicialized already and return data to first point. What can I improve to make javascript work independently of several vendors?

<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>

and 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 Respuestas
Responde la pregunta

0

I come up with idea to pass id in easyPack.init (vendor id for example)

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

then in window.easyPack.modalMap you can check passed id with

modal.easyPackConfig.packageID

and with this id save chosen point to certain vendor

about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda