diff options
Diffstat (limited to 'StoneIsland/platforms/ios/www/js/sdk/product.js')
| -rw-r--r-- | StoneIsland/platforms/ios/www/js/sdk/product.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/StoneIsland/platforms/ios/www/js/sdk/product.js b/StoneIsland/platforms/ios/www/js/sdk/product.js index a2ba30a1..55f1940a 100644 --- a/StoneIsland/platforms/ios/www/js/sdk/product.js +++ b/StoneIsland/platforms/ios/www/js/sdk/product.js @@ -1,11 +1,13 @@ sdk.product = (function(){ var product = {} + + var default_gallery = 31617 product.collection = function(opt){ - $.ajax({ + return $.ajax({ method: "GET", url: sdk.path("Search.API/1.2", "search.json"), - data: { format: "full", gallery: opt.gallery_id }, + data: { format: "full", gallery: opt.gallery_id || default_gallery, productsPerPage: 100 }, success: opt.success, error: opt.error, }) @@ -13,7 +15,7 @@ sdk.product = (function(){ // https://gist.github.com/fanfare/2d25d1b36944188948ff product.item = function(opt){ - $.ajax({ + return $.ajax({ method: "GET", url: sdk.path("Item.API/1.0", "item/" + opt.code + ".json"), success: opt.success, @@ -21,5 +23,15 @@ sdk.product = (function(){ }) } + product.search = function(opt){ + return $.ajax({ + method: "GET", + url: sdk.path("Search.API/1.2", "search.json"), + data: { format: "full", gallery: opt.gallery_id || default_gallery, textSearch: opt.query, productsPerPage: 100 }, + success: opt.success, + error: opt.error, + }) + } + return product })()
\ No newline at end of file |
