Skip to content

Commit

Permalink
- Fixed ASIN parse function
Browse files Browse the repository at this point in the history
- Get the product image from ImageSet property
  • Loading branch information
Royedc4 committed Mar 9, 2017
1 parent c9c3ea3 commit e819022
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions stitch-order-request.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@
var response = e.detail.response[0];
var product = {
id: response.ASIN[0],
title: response.ItemAttributes[0].Title[0],
image: response.MediumImage[0].URL[0],
title: response.ItemAttributes[0].Title ? response.ItemAttributes[0].Title[0] : 'Untitled',
image: response.ImageSets ? response.ImageSets[0].ImageSet[0].MediumImage[0].URL[0] : '',
cost: response.ItemAttributes[0].ListPrice ? response.ItemAttributes[0].ListPrice[0].FormattedPrice[0] : 0,
prime: response.Offers[0].Offer ? !!Number(response.Offers[0].Offer[0].OfferListing[0].IsEligibleForPrime[0]): false,
itemsAttributes: response.ItemAttributes[0],
Expand Down Expand Up @@ -166,7 +166,7 @@
},

_getItemIdFromURL: function(url){
var regex = /\/dp\/(\w+)\/?/;
var regex = /\/dp?\/(\w{10})\/?/;
return regex.exec(url)[1];
}
});
Expand Down

0 comments on commit e819022

Please sign in to comment.