PDA

View Full Version : excluding merchants from an api call? merchants that are currently 'on hold'?


ljackson09
24-01-10, 15:39
Hi All,

i have some code which searches the api and pulls out the top 3 items from several categories which is working well, the only problem i have is that some of the top 3 are from stores which are currently on hold e.g choices UK, and when the link to the prduct is clicked it says sorry product is not in there database? but im not sure how to prevent choices from being included in the results

here is my code
#GET TOP 5 ITEMS FOR EACH CATEGORY
$AW_catid = $aw_id;
$AW_cat = $aw_name;
$oRefineBy = new stdClass();
$oRefineBy -> iId = 4;
$oRefineBy -> sName = 'Category';
$oRefineByDefinition = new stdClass();
$oRefineByDefinition -> sId = $AW_catid;
$oRefineByDefinition -> sName = $AW_cat;
$oRefineBy -> oRefineByDefinition = $oRefineByDefinition;
$returnedcolumns = array(iCategoryId, iMerchantId, sAwImageUrl, fStorePrice, sAwThumbUrl, sName,sAwImageUrl,sMerchantImageUrl,sMerchantThumb Url,sDescription,sBrand);
$booleansearch = array('sQuery'=> $keywords, 'oActiveRefineByGroup' => $oRefineBy, 'bAdult' => true, 'iLimit'=>3, 'sColumnToReturn' => $returnedcolumns, 'sSort'=>'popularity', 'sMode' => 'boolean');
$oResponse= $oClient->call('getProductList', $booleansearch);
foreach($oResponse->oProduct as $oProduct)
{
$img = htmlspecialchars($oProduct->sMerchantImageUrl);
$img2 = htmlspecialchars($oProduct->sAwThumbUrl);
$price = $oProduct->fPrice;
$link = htmlspecialchars($oProduct->sAwDeepLink);
$store = $oProduct->iMerchantId;
$catid = $oProduct->iCategoryId;
$desc = $oProduct->sDescription;
$merchantid = $oProduct->iMerchantId;//the id i am trying to get the store name for

#GET MERCHANT NAME
$merchantcolumns = array(iId,sName,sClickThroughUrl);
$merchantrows = array("sColumnToReturn" => $merchantcolumns, "iAdult" => 1);
$oResponse= $oClient->call('getMerchant', $merchantrows);
foreach($oResponse->oMerchant as $merchID)
{
if($merchID->iId == $merchantid)
{
$merchName = $merchID->sName;
$merchLink = htmlspecialchars($merchID->sClickThroughUrl);
}
}
?>
<div class="individual_top5">
<h3 class="individual_top5_headers"><?php print $oProduct->sName;?></h3>
<div class="individual_top5_images">

<img src='<?php echo $img2;?>' height='85px' alt='<?php echo $desc;?>' title='<?php echo $desc;?>' /></div>
<div class='buyitnow_container'>

<div class="buyitnow_store"><span class="bold red"><a href="<?php echo $link;?>">Buy it now</a></span><br />from <a href="<?php echo $merchLink?>" target="_self"> <?php echo $merchName."</a><br /> for &pound;".$price;?></div>
</div>

<div class='compareit_container'>
<div class="compareit_link">OR <br />compare prices</div>
</div>

</div>
<?php
}


any help would be appreciated :)
thanks
Luke

Adrian
27-01-10, 11:36
Hi Luke,

Not too sure what you mean when you say the merchant is 'on hold' here! Merchants closed on the network or no longer enabled for ShopWindow will no longer appear in ShopWindow results.

You have a couple of options in regards to not showing products from particular merchants, the easiest way is to block the merchant(s) is to use the 'Merchant Manager' system in the ShopWindow area of your account (http://www.affiliatewindow.com/affiliates/shopwindow/index.php). Any merchants blocked in this system will then not appear within the ProductServe results.

You could also specify the particular merchants to include when making your API request. You could use the refine-by option to limit the number of merchants you want (and only include the active merchants that you want to display). Please see the getProductList API requests detailed here: http://wiki.affiliatewindow.com/index.php/GetProductList

Hope that helps,

Adrian

ljackson09
27-01-10, 14:21
Hi mate thanks for your reply. yeah blocking them has done the trick :)

from what i understand (may be wrong here lol) choices uk program is currently on hold??? none of the products links work that i pull from the api they all go to a page saying product is not in their database???

but blocking them has solved the problem :)

thanks
Luke

Adrian
27-01-10, 16:58
Hi Luke,

Just had a look into this, it seems that ChoicesUk are not 'on-hold' they are having technical issues with their datafeed. I will look into the issue further and will do my best to get the feed fully operational again. If this is not possible the merchant will be temporarily removed from ShopWindow until further notice.

Kind regards,

Adrian

ljackson09
29-01-10, 14:54
ah thank you!!! much appreciated

Luke