i am trying to use the pickuppoint.co.il API in my site.
the first part of choseing adrress works fine when i use the html iframe elemnt.
(function ()
{
var pkp = document.createElement('script');
pkp.type = 'text/javascript'; pkp.async = true;
pkp.src = 'https://pickuppoint.co.il/api/ups-pickups.sdk.all.js';
document.getElementsByTagName('head')[0].appendChild(pkp);
})();
But i can’t find a way to get the json information out to my Corvid code.
the API website give me the next code
document.body.addEventListener( ‘pickups-after-choosen’, function(e, data)
{
var pointDetails = e.originalEvent ? e.originalEvent.detail :e.detail;
});
where do i install it? and how do i connect it to my Corvid?
thanks!
if you can read hebrew, here is the link for the site i took the code from
https://www.pickuppoint.co.il/?page_id=548&fbclid=IwAR3DZFu9TZRDlC9uGmi19NkaicAnL_CrmPGK9qc266JUD8Qhp7YfSgcUluo#pointsPickup
Okay, so translating that page into English, you need to be looking at using a new custom tool from Tracking and Analytics.
https://support.wix.com/en/article/about-tracking-tools-analytics
It says that you should put the first line in a html iFrame on your page which gives you the button.
https://support.wix.com/en/article/using-iframes-to-display-visible-content-on-your-site
Pickup Button
In order to create the button, the HTML code must be copied to the intended location:
<div onclick = "window.PickupsSDK.onClick (); return;" class = "ups-pickups ups-pickups-48"> </div> <div class = "ups-pickups-info"> </div>
Then the rest of the code should be placed in a new custom tool with the code being set in the header.
https://support.wix.com/en/article/embedding-custom-code-to-your-site
Install Javascript code
Embed JavaScript code in the page header.
The word TYPE should be replaced with one of the three relevant options:
-
all
-
stores
-
lockers
(function ()
{
var pkp = document.createElement ('script');
pkp.type = 'text / javascript'; pkp.async = true;
pkp.src = 'https://pickuppoint.co.il/api/ups-pickups.sdk. TYPE .js';
document.getElementsByTagName ('head') [0] .appendChild (pkp);
}) ();
And so on with the rest of the code.
As stated on the linked pages, Wix won’t provide support for code that comes from a third party provider, so if you are struggling with this then you should be contacting PickUp own support and asking them for help with this.
***Wix cannot provide support for external codes that were not created or tested with Wix. If you are experiencing an issue with your code snippet, please contact the provider directly. ***
Finally, to note that this is not an API and it is their own Guide to Embed PickUP Plug on eCommerce Sites.
When people look at using another companies API on their site - preferably a REST API if available, then it is always done through the use of code as in Wix HTTP Functions and Wix Fetch with which you get the JSON etc.
You can see more about that here.
https://www.wix.com/corvid/reference/wix-http-functions.html
https://support.wix.com/en/article/corvid-exposing-a-site-api-with-http-functions
https://www.wix.com/corvid/reference/wix-fetch.html
https://support.wix.com/en/article/corvid-accessing-third-party-services-with-the-fetch-api
Along with two examples of exposing your site.
https://www.wix.com/corvid/example/exposing-apis
https://www.wix.com/corvid/forum/corvid-tips-and-updates/example-myapi-and-myapiclient
Using an API is a much better and more secure way of working, although it would mean that you would have to do a lot more work with it and it won’t just be all written out for you like the embedded plugin is.