From 6a8e38d24c4866b8559f7116eac694fbf1da4ded Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 9 Nov 2015 16:21:27 -0500 Subject: profile html, search api --- StoneIsland/www/index.html | 241 +++++++++++++++++++++++--------------- StoneIsland/www/js/sdk/product.js | 14 ++- test/lib/promise.js | 1 + test/test/01-product.js | 14 ++- 4 files changed, 171 insertions(+), 99 deletions(-) diff --git a/StoneIsland/www/index.html b/StoneIsland/www/index.html index 13710677..d55f6ef6 100644 --- a/StoneIsland/www/index.html +++ b/StoneIsland/www/index.html @@ -86,7 +86,10 @@ CHECKOUT PROCEED WITH CHECKOUT - + + + +

STORY

@@ -139,6 +142,16 @@
+
+
+

FAQ

+
+
+
+ + + +

COLLECTION NAME

@@ -152,20 +165,6 @@
- -
-
-

FAQ

-
-
-
- -
-
-

NOTIFICATIONS

-
TURN ON / OFF NOTIFICATIONS
-
-
-
+ +

LOGIN

@@ -225,24 +225,64 @@

NEW USER

- - + + - - +

PASSWORD

+ I agree to share my personal information with Stone Island.
+

PROFILE

+
+ + + + +

CHANGE PASSWORD

+ + + +
+
+

SHIPPING

+
+
+ +
+
+

PAYMENT

+
+
+
+ +
+
+ +
+
+

NOTIFICATIONS

+
TURN ON / OFF NOTIFICATIONS
+
+ + +

YOUR CART / 2 ITEMS

@@ -312,86 +352,93 @@
- + + +
+ + + diff --git a/StoneIsland/www/js/sdk/product.js b/StoneIsland/www/js/sdk/product.js index 2cf58452..55f1940a 100644 --- a/StoneIsland/www/js/sdk/product.js +++ b/StoneIsland/www/js/sdk/product.js @@ -1,11 +1,13 @@ sdk.product = (function(){ var product = {} + + var default_gallery = 31617 product.collection = function(opt){ 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, }) @@ -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 diff --git a/test/lib/promise.js b/test/lib/promise.js index a3638de4..c239f306 100644 --- a/test/lib/promise.js +++ b/test/lib/promise.js @@ -1,5 +1,6 @@ module.exports = function(fn, data){ var my_cb, my_res, error_cb, my_error + data = data || {} data.success = function(res){ my_res = res if (my_cb) { diff --git a/test/test/01-product.js b/test/test/01-product.js index 983532d7..365e1581 100644 --- a/test/test/01-product.js +++ b/test/test/01-product.js @@ -10,7 +10,7 @@ describe('product', function(){ describe('#collection()', function(){ it('returns a collection', function(done){ - promise(sdk.product.collection, { gallery_id: 31617 }).then(function(data){ + promise(sdk.product.collection).then(function(data){ assert(data.Header.StatusCode == 200) assert(data.SearchResponseFull.Results.Items.length > 0) test_item = data.SearchResponseFull.Results.Items[0] @@ -31,5 +31,17 @@ describe('product', function(){ }) }) + describe('#search()', function(){ + it('finds products', function(done){ + promise(sdk.product.search, { query: "jacket" }).then(function(data){ + assert(data.Header.StatusCode == 200) + assert(data.SearchResponseFull.Results.Items.length > 0) + done() + }).error(function(error){ + done() + }) + }) + }) + }) -- cgit v1.2.3-70-g09d2