Last active
March 25, 2020 16:59
-
-
Save webmarked/7e7023e250aae3071dbc86d271fa9856 to your computer and use it in GitHub Desktop.
Sample Smart Wishlist public API implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This jQuery based code fetches the contents of Express Wishlist (unregistered users) | |
var wishlistid=SWGetExpressWishlistId(); | |
$.ajax({ | |
url: "/a/wishlist?type=api&wishlistid="+wishlistid+"&version=1", | |
dataType: "json", | |
cache:false, | |
success: function(data) { | |
//your code for displaying the wishlist data. | |
} | |
}); | |
//the above code adapted for customer wishlist (logged in users) | |
var customerid=SWGetCustomerWishlistId(); | |
if(customerid!=0) //check if user is logged in | |
{ | |
$.ajax({ | |
url: "/a/wishlist?type=api&customerid="+customerid+"&version=1", | |
dataType: "json", | |
cache:false | |
success: function(data) { | |
//your code for displaying the wishlist data. | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment