ljackson09
12-08-09, 01:38
Hi Guys,
just logged in to find out that v3 of the shop window api has been released :)
i have been waiting for this day as im sure many have,
i have some questions that i require some assistance with please.
1/i would like to specify a product category when searching for a particular item?
here is my current code
//AFFILIATE WINDOW PRICE FINDER
$searchcategory = "";
$storesArray = array(
1186,1109,380,1257,1418,1228,172,1672,1744,854,214 7,
1331,2258,1599,1487,1946,1322,323,2249,1598,1964,1 5,
547,1970,2344,2383,1221,782,65,2276,1472,1132,1184 ,
2038,2208,1311,1084,9,2124,1815,1916,1107,2026,199 5,
2383,782,65,1198,1132,65,782,1597,2041,2203,2038,2 124,
2433,2453,1995,1521,1916,686,2354,1472,1107,980,25 37,
2481,1559,483,1404,2547,2548,2549);
$stores = array('iMerchantId' => $storesArray);
$aParams = array("sQuery" => $Keywords, "iMerchantId" => $stores);
$oResponse=$oClient->call('getProductList', $aParams);
#basis of one per merchant
$onePerMerchant = array();
$x = 0;
if(count($oResponse->oProduct) <> 0){;
foreach($oResponse->oProduct as $oProduct){
if(!in_array($oProduct->iMerchantId,$onePerMerchant)
&& in_array($oProduct->iMerchantId,$storesArray))
{ #makes sure we dont already have a product from this merchant
# add merchantID to $onePerMerchant Array
$onePerMerchant[$x] = $oProduct->iMerchantId;
$merchantname = $oProduct->iMerchantId;
$merchant = "AW".$oProduct->iMerchantId;
$productPrice = number_format($oProduct->fPrice, 2, '.', '');
$PnP = number_format($oProduct->fDeliveryCost, 2, '.', '');
$totalPrice = number_format((($oProduct->fPrice)+($oProduct->fDeliveryCost)), 2, '.', '');
$link = $oProduct->sAwDeepLink;
//INSERT INTO DB
$getpricesSQL = "INSERT INTO comparison_results
(storeID,product_price,postage_price,total_price,l ink)
VALUES('$merchant',$productPrice,$PnP,$totalPrice,
'$link')";
$query = mysql_query($getpricesSQL)or die(mysql_error());
$x++;
}
}
}
else{}
//AFFILIATE WINDOW END
which searches for an item based on a string inputted and then it returns 1 item for each merchant that i am signed up to if there is a product that matches the criteria, however the current problm is that if im searching in dvds for "17 Again" im getting 17inch tvs and a few other odd products appear which i would like to remove by adding a search in category which i was told was being added for v3?
2/can i pull out a list of discount codes out of the api of all the stores i am signed up to? if so how ?
any help would be appreciated... :)
p.s how do i change to v3
many thanks
Luke
just logged in to find out that v3 of the shop window api has been released :)
i have been waiting for this day as im sure many have,
i have some questions that i require some assistance with please.
1/i would like to specify a product category when searching for a particular item?
here is my current code
//AFFILIATE WINDOW PRICE FINDER
$searchcategory = "";
$storesArray = array(
1186,1109,380,1257,1418,1228,172,1672,1744,854,214 7,
1331,2258,1599,1487,1946,1322,323,2249,1598,1964,1 5,
547,1970,2344,2383,1221,782,65,2276,1472,1132,1184 ,
2038,2208,1311,1084,9,2124,1815,1916,1107,2026,199 5,
2383,782,65,1198,1132,65,782,1597,2041,2203,2038,2 124,
2433,2453,1995,1521,1916,686,2354,1472,1107,980,25 37,
2481,1559,483,1404,2547,2548,2549);
$stores = array('iMerchantId' => $storesArray);
$aParams = array("sQuery" => $Keywords, "iMerchantId" => $stores);
$oResponse=$oClient->call('getProductList', $aParams);
#basis of one per merchant
$onePerMerchant = array();
$x = 0;
if(count($oResponse->oProduct) <> 0){;
foreach($oResponse->oProduct as $oProduct){
if(!in_array($oProduct->iMerchantId,$onePerMerchant)
&& in_array($oProduct->iMerchantId,$storesArray))
{ #makes sure we dont already have a product from this merchant
# add merchantID to $onePerMerchant Array
$onePerMerchant[$x] = $oProduct->iMerchantId;
$merchantname = $oProduct->iMerchantId;
$merchant = "AW".$oProduct->iMerchantId;
$productPrice = number_format($oProduct->fPrice, 2, '.', '');
$PnP = number_format($oProduct->fDeliveryCost, 2, '.', '');
$totalPrice = number_format((($oProduct->fPrice)+($oProduct->fDeliveryCost)), 2, '.', '');
$link = $oProduct->sAwDeepLink;
//INSERT INTO DB
$getpricesSQL = "INSERT INTO comparison_results
(storeID,product_price,postage_price,total_price,l ink)
VALUES('$merchant',$productPrice,$PnP,$totalPrice,
'$link')";
$query = mysql_query($getpricesSQL)or die(mysql_error());
$x++;
}
}
}
else{}
//AFFILIATE WINDOW END
which searches for an item based on a string inputted and then it returns 1 item for each merchant that i am signed up to if there is a product that matches the criteria, however the current problm is that if im searching in dvds for "17 Again" im getting 17inch tvs and a few other odd products appear which i would like to remove by adding a search in category which i was told was being added for v3?
2/can i pull out a list of discount codes out of the api of all the stores i am signed up to? if so how ?
any help would be appreciated... :)
p.s how do i change to v3
many thanks
Luke