Widget Developer Page
How to install BoxNow Map Widget
- Paste the BoxNow Map Widget JavaScript code into the checkout page (or any other page where you want to display the BoxNow Map Widget).
- Create new HTML button with class attribute boxnow-widget-button to open BoxNow Map Widget. For example:
- Create function for accept data from selected locker (id, address, name, etc.)
<a href="javascript:;" class="boxnow-widget-button">Open widget<a>
BoxNow Map Widget Javascript Code
<div id="boxnowmap"><div> <script type="text/javascript"> var _bn_map_widget_config = { partnerId: 123, parentElement: "#boxnowmap" afterSelect: function(selected){ alert(selected.boxnowLockerPostalCode); alert(selected.boxnowLockerAddressLine1); alert(selected.boxnowLockerId); } }; (function(d){var e = d.createElement("script");e.src = "https://widget-cdn.boxnow.gr/map-widget/client/v4.js";e.async = true;e.defer = true;d.getElementsByTagName("head")[0].appendChild(e);})(document); <script>
The most important is variable _bn_map_widget_config. There you can setup all required options.
Examples
Documentation
parentElement
required
Please fill CSS selector for Map Widget container. For example, just create
<div id="boxnowmap"></div>and fill #boxnowmap. The BoxNow map widget will be placed inside this element.
afterSelect
required for type:iframe and type:popup
Function that is triggered when the lock is selected. Included one parameter (object) contains all information about locker
(properties boxnowLockerPostalCode, boxnowLockerAddressLine1 and boxnowLockerId are the most important).
partnerId
optional
Please use your partnerId
type
optional
Use iframe, popup or navigate. Default is iframe.
gps
optional
Use it if you want to change the user's location request immediately after displaying the map. Possible options are yes or no. Default is yes.
autoclose
optional
Use it when you want to change what happens after you select a locker. For type:iframe, the default value is yes, which means that the map will be hidden when the locker is selected.
For type:popup, autoclose is always yes. The possible values are yes or no. The default value is no.
autoselect
optional
Selects a locker immediately after clicking on a locker on the map or in the list (not after clicking on the "select locker" button).
Requires autoclose=no and type=iframe. The possible values are yes or no. The default value is yes.
buttonSelector
optional
You can change the default class name to open the BoxNow Map Widget. Default is .boxnow-map-widget-button.
zip
optional
If you have set gps=no, you can use this parameter to suggest a location on the map. The value can be a ZIP or part of a general address.