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

334
Views
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 answers
Answer question

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