Getting an Individual Product
To retrieve a single product based on Awins product ID, the code is as follows:
1 2 3 4 5 6 | <?php define('API', 'PS'); require_once('constants.inc.php'); require_once('classes/class.ClientFactory.php'); $oClient = ClientFactory::getClient(API_USERNAME, API_PASSWORD, API_USER_TYPE); ?> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | <?php $singleproduct= array('iProductId'=>43495938); $oResponse= $oClient->call('getProduct', $singleproduct); $image = $oResponse->oProduct->sAwImageUrl; $categoryid = $oResponse->oProduct->iCategoryId; $name = $oResponse->oProduct->sName; $description = $oResponse->oProduct->sDescription; $price = $oResponse->oProduct->fPrice; $link = $oResponse->oProduct->sAwDeepLink; $brand = $oResponse->oProduct->sBrand; $deliverycost = $oResponse->oProduct->fDeliveryCost; $merchant = $oResponse->oProduct->iMerchantId; echo "<h2>".$name."</h2>"; echo "<a href=\"".$link."\" title=\"".$name."\"><img src=\"".$image."\"/ style=\"float:left; margin:10px;border:0\" alt=\"".$name." \"></a>"; echo $description."<br/><br/><h5>£".number_format($price,2,'.',',')."</h5>".$brand."<br/><br/>"; echo "<a href=\"".$link."\">Click to see details</a>"; ?> |
The result from this query (new window)
Possible Fields returned from the call ‘getProduct’ are :
iId The product id
iCategoryId The category id this product belongs to
iMerchantId The merchant id this product belongs to
sMerchantProductId The product id on the merchant’s system
bAdult Is this an adult only product
bHotPick Is this a merchants ‘hot pick’
iUpc Universal Product Code
iEan European Article Number
sMpn Manufacturers Part Number
iIsbn International Standard Book Number
sName The name
sDescription The full description
sSpecification The specifications
sPromotion The promotional text
sBrand The brand
sModel The model
sAwDeepLink The deeplink with the tracking code
sAwThumbUrl The thumbnail image on AWin server
sAwImageUrl The full image on AWin server
sMerchantDeepLink Merchants deeplink with no tracking code
sMerchantThumbUrl The thumbnail image on Merchant server
sMerchantImageUrl The full image on Merchant server
sDeliveryTime Text stating product delivery time
fPrice The price
fStorePrice In Store Price
fRrpPrice RRP Price
fDeliveryCost The cost of delivery
bWebOffer Web only offer
bPreOrder For pre-order
sWarranty Product warranty
Comments
2 Comments on Getting an Individual Product
-
emmfield on
Sat, 5th Dec 2009 11:11 pm
-
apimonkey on
Sun, 6th Dec 2009 12:12 pm
This site’s really really good man. It completely saved me as there isn’t much official documentation or examples, with little activity on the Shopwindow forums.
I guess all the examples are API v2, right? I downloaded v3 of the API.
Show by category ID works but the query and individual product doesn’t.
Now you’ve gotten me started I’m gonna continue with what works in v3 and try to work from there. I’ll share some v3 tips with you if I come across them if you like. It’d be great to see more on here.
I’ve just added the V3 version for an individual product here Single Product V3
Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!
You must be logged in to post a comment.




