View Full Version : please help me recieve better search results...
ljackson09
17-08-09, 15:56
Hi All,
i am really struggling to recieve a good set of product results for example if i search for mamma mia im getting region 3 and 4 dvds where as i want just region 2?
how can i get better search results
here is my php code
//AFFILIATE WINDOW PRICE FINDER
$searchcategory = "";
$storesArray = array(
9,15,65,172,323,380,483,547,550,686,782,854,896,91 1,980,
1052,1084,1107,1109,1132,1134,1184,1186,1198,1202, 1221,1228,
1256,1257,1270,1311,1322,1331,1350,1402,1404,1418, 1472,1487,
1521,1559,1597,1598,1599,1672,1744,1815,1826,1836, 1916,1946,
1947,1964,1970,1995,2026,2038,2041,2066,2124,2147, 2203,2208,
2249,2258,2276,2344,2354,2383,2424,2433,2453,2481, 2487,2526,
2537,2547,2548,2549);
$stores = array('iMerchantId' => $storesArray);
$oRefineBy = new stdClass();
$oRefineBy -> iId = 4;
$oRefineBy -> sName = 'Category';
$oRefineByDefinition = new stdClass();
$oRefineByDefinition -> sId = 240;
$oRefineByDefinition -> sName = 'DVDs';
$oRefineBy -> oRefineByDefinition = $oRefineByDefinition;
$aParams = array("sQuery" => $Keywords, "iMerchantId" => $stores, "oActiveRefineByGroup" => $oRefineBy);
$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
any help would be greatly appreciated
thanks
Luke
ljackson09
28-08-09, 22:32
anyone?
ive tried to use refineby to search certain categorys only but in not getting anywhere,
here is what i have tried
$oRefineBy = new stdClass();
$oRefineBy -> iId = 4;
$oRefineBy -> sName = 'DVD';
$obj = aws_signed_request("co.uk",
array("AssociateTag" => "kernconn-21",
"Operation" => "ItemSearch",
"Keywords" => $Keywords,
"SearchIndex" => $SearchIndex,
"oActiveRefineByGroup" => $oRefineBy,
"ResponseGroup" => "Large"),
$public_key, $private_key);
$count = 1;
foreach($obj->Items->Item as $item){
if((isset($item->ItemAttributes->Title)) && $count <= 1){
$merchantname = "AM01";
$productPrice = $item->Offers->Offer->OfferListing->Price->FormattedPrice;
$productPrice = trim($productPrice,'£');
$link = $item->DetailPageURL;
$image = $item->MediumImage->URL;
$actors = $item->ItemAttributes->Actor;
$format = $item->ItemAttributes->Format;
$artist = $item->ItemAttributes->Artist;
$listprice = $item->ItemAttributes->ListPrice->FormattedPrice;
$releasedate = $item->ItemAttributes->ReleaseDate;
$title = $item->ItemAttributes->Title;
$product_category = $item->ItemAttributes->Binding;
$displaysize = $item->ItemAttributes->DisplaySize;
$brand = $item->ItemAttributes->Brand;
$platform = $item->ItemAttributes->Platform;
$genre = $item->ItemAttributes->Genre;
$feature = $item->ItemAttributes->Feature;
want to search for a particular product from an array of stores with the product in the dvd category,
so im hoping to get 1 dvd for each of my stores in the array which matches my search criteria but the above is giving me cds and clothing as well which i dont want, can anyone help me to get this to work????
thanks
Luke
currentstyle
29-08-09, 03:03
Hi Luke, you're using amazon coding there, which as you might expect, won't work on the awin API, the calls are different, the objects returned in the array are different, how on earth does it show any results?
ljackson09
29-08-09, 20:46
ah shoot, wrong b***dy code, my bad sorry...
here is the correct code :)
//AFFILIATE WINDOW PRICE FINDER
$searchcategory = "";
$storesArray = array(
9,15,65,172,323,380,483,547,550,686,782,854,896,91 1,980,
1052,1084,1107,1109,1132,1134,1184,1186,1198,1202, 1221,1228,
1256,1257,1270,1311,1322,1331,1350,1402,1404,1418, 1472,1487,
1521,1559,1597,1598,1599,1672,1744,1815,1826,1836, 1916,1946,
1947,1964,1970,1995,2026,2038,2041,2066,2124,2147, 2203,2208,
2249,2258,2276,2344,2354,2383,2424,2433,2453,2481, 2487,2526,
2537,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
thanks for pointing that out :)
Luke
ljackson09
30-08-09, 20:15
ok mate i have managed to specify a category
with this code
$storesArray = array(
9,15,65,172,323,380,483,547,550,686,782,854,896,91 1,980,
1052,1084,1107,1109,1132,1134,1184,1186,1198,1202, 1221,1228,
1256,1257,1270,1311,1322,1331,1350,1402,1404,1418, 1472,1487,
1521,1559,1597,1598,1599,1672,1744,1815,1826,1836, 1916,1946,
1947,1964,1970,1995,2026,2038,2041,2066,2124,2147, 2203,2208,
2249,2258,2276,2344,2354,2383,2424,2433,2453,2481, 2487,2526,
2537,2547,2548,2549);
$stores = array('iMerchantId' => $storesArray);
$oRefineBy = new stdClass();
$oRefineBy -> iId = 4;
$oRefineBy -> sName = 'Category';
$oRefineByDefinition = new stdClass();
$oRefineByDefinition -> sId = '240';
$oRefineByDefinition -> sName = 'DVDs';
$oRefineBy -> oRefineByDefinition = $oRefineByDefinition;
$aParams = array("sQuery" => $Keywords, "iMerchantId" => $stores, "oActiveRefineByGroup" => $oRefineBy);
$oResponse=$oClient->call('getProductList', $aParams);
minus any print statments etc, the main problem im having is im only receiving a few products returned with this query, for example when searching for slumdog millionaire i only receive 2 products 1 from play and 1 from cd wow(i have coded it so that i only get 1 product from each store) but im not sure why im only receiving info from just two stores, when for example zavvi has that product so do a couple of other stores which i have signed up to, all of which are in the stores array in my code?
any ideas as to why i am not receiving any more products?
thanks for your help
Luke
currentstyle
31-08-09, 14:23
Is it necessary to include your merchant array? By default all of your merchants are searched anyway, so, I tried out the query, without a merchant array, and, without a category ID and got 37 results for slumdog millionaire.
Sometimes with the API, less is more
ljackson09
31-08-09, 15:40
the merchant array is used purley to get only the merchants results that im signed up to, if i didnt have that i'd get results from merchants that you dont need to sign up to being included in the results, which for me would be bad as i have the values in the array(store id) to look up the store names which are stored in my db.
i just would of thought i would of got more results from the search query? like i said above there are stores/merchants which sells a certain product but its not appearing in my results which is not expected?
just out of curiosity what code are you using to get all those results?
ive tried this
$oRefineBy = new stdClass();
$oRefineBy -> iId = 4;
$oRefineBy -> sName = 'Category';
$oRefineByDefinition = new stdClass();
$oRefineByDefinition -> sId = $AW_catid;
$oRefineByDefinition -> sName = $AW_catName;
$oRefineBy -> oRefineByDefinition = $oRefineByDefinition;
$aParams = array("sQuery" => $Keywords, "oActiveRefineByGroup" => $oRefineBy, "bIncludeTree" => true);
$oResponse=$oClient->call('getProductList', $aParams);
if(count($oResponse->oProduct) <> 0){;
foreach($oResponse->oProduct as $oProduct){
$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());
}
}
but am only getting 6 results???
p.s i need to define the dvd category to get a specific result set.
thanks mate
Luke
ljackson09
31-08-09, 15:52
ive even tried removing the category section all togther and im only getting 10 results :(
the merchant array is used purley to get only the merchants results that im signed up to, if i didnt have that i'd get results from merchants that you dont need to sign up to being included in the results,
Hello,
ShopWindow should only be displaying results from merchants that you are signed up to within the interface anyway. It has been designed to only promote merchants where the affiliate has a relationship with that merchant.
If this is not happening, then please let us know.
Regards
ljackson09
01-09-09, 11:49
Hi George,
i thought there were merchants that didn't requre signing up to in order to earn commissions,
for example when i remove my store array i recieved results from
Saverstore(1732)
Mobiles.co.uk(380)
which im not signed up to?
this is using V2
thanks
Luke
Ah OK you meant sign up to as in physically did that yourself within the interface.
Yes, there are some merchants that are on an auto-approve system for ShopWindow. This means that you will be automatically partnered with that merchant upon taking on the SW software but you are under no obligation to continue that relationship. You will of course still make commissions on auto-approve merchants.
If you do not wish to work with any of those merchants, i.e. the two that you listed, then you can sever the relationship between your affiliate account and them.
Regards
ljackson09
01-09-09, 12:28
ah ok thanks george, there not doing any harm so i will leave them there for the time being lol
thanks for clearing that up :)
Luke
ljackson09
02-09-09, 18:10
so i am still getting a "watered down" set of results :(
what i mean is when i search for angels and demons and refine by cat DVDs and id 240 im only getting two results play and cdwow, i have tried searching for angels & demons and this adds one more but there are merchants that im signed up to and which sell that product but i am unable to get it out of the api?
for example zavvi?
any ideas why i cannot recieve this
thanks
Luke
p.s my code is
$oRefineBy = new stdClass();
$oRefineBy -> iId = 4;
$oRefineBy -> sName = 'Category';
$oRefineByDefinition = new stdClass();
$oRefineByDefinition -> sId = '240';
$oRefineByDefinition -> sName = 'DVDs';
$oRefineBy -> oRefineByDefinition = $oRefineByDefinition;
$aParams = array("sQuery" => "Angels and Demons", "oActiveRefineByGroup" => $oRefineBy, "bIncludeTree" => true);
$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))
{ #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
$showProducts = "SELECT *
FROM comparison_results
ORDER BY IF(total_price IS NULL, 1, 2 ) DESC, total_price";
$showQuery = mysql_query($showProducts);
$num_rows = mysql_num_rows($showQuery);
if ($num_rows == 0){
print "No Products Match You Search, Check Our Help Page On Searching Tips.";
}
else {
while ($row = mysql_fetch_array($showQuery)){
$merchant = $row['storeID'];
$Price = $row['product_price'];
$delivery = $row['postage_price'];
$total_price = $row['total_price'];
$link = htmlspecialchars($row['link']);
$storeinfo = "SELECT * FROM stores WHERE storeID = '$merchant'";
$query = mysql_query($storeinfo)or die(mysql_error());
$info = mysql_fetch_array($query);
$name = $info['storeName'];
$name2 = $info['name'];
$rating = $info['rating'];
?>
<div class='storeindividual'>
<div class="prices_store">
<?php print $name;?>
</div>
<div class="prices_rating">
<?php print rating_bar($name2.'total','5','static');?>
</div>
<div class="prices_price">
<?php
if ($Price == NULL){
print "-";
}
elseif ($Price == 0){
print "-";
}
elseif ($Price == 1){
print "-";
}
else{
print "£".$Price;
}?>
</div>
<div class="prices_delivery">
<?php
if ($delivery == NULL){
print "-";
}
else{
print "£".$delivery;
}?>
</div>
<div class="prices_total">
<?php
if ($delivery == NULL){
print "-";
}
else{
print "£".$total_price;
}?>
</div>
<div class="prices_visit">
<?php print "<a href='$link'>More Info/Buy</a>";?>
</div>
</div>
<?php
}}
any ideas guys?
thanks
Luke