ljackson09
21-01-10, 17:34
Hi All
i have this code
<?php
foreach ($category_list as $category => $sub_category)
{
switch($category)
{
case "DVD";
$aw_id = "240";
$aw_name = "DVDs";
$keywords = "-region 1";
break;
case "CD";
$aw_id = "241";
$aw_name = "Music";
$keywords = "";
break;
case "Video Games";
$aw_id = "579";
$aw_name = "-console -bundle";
$keywords = "-region 1";
break;
case "Blu-Ray";
$aw_id = "550";
$aw_name = "Blu-Ray";
$keywords = "-region 1";
break;
case "Books";
$aw_id = "538";
$aw_name = "Books";
$keywords = "";
break;
}
print "<div class='category_container'>";
print "<h2 class='category_header red'>$category</h2>";
#GET TOP 5 ITEMS FOR EACH CATEGORY
$AW_catid = $aw_id;
$AW_cat = $aw_name;
$keywords = "";
$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(sAwImageUrl, sAwThumbUrl, sName,sAwImageUrl,sMerchantImageUrl,sMerchantThumb Url,sDescription,sBrand,iMerchantId,iCategoryId);
$booleansearch = array('sQuery'=> $keywords, 'oActiveRefineByGroup' => $oRefineBy, 'bAdult' => true, 'iLimit'=>5, 'sColumnToReturn' => $returnedcolumns, 'sSort'=>'popularity', 'sMode' => 'boolean');
$oResponse= $oClient->call('getProductList', $booleansearch);
foreach($oResponse->oProduct as $oProduct)
{
$img = htmlspecialchars($oProduct->sMerchantImageUrl);
$img2 = htmlspecialchars($oProduct->sAwThumbUrl);
$desc = $oProduct->sDescription;?>
<div class="individual_top5">
<h3 class="individual_top5_headers"><?php print $oProduct->sName;?></h3>
<div class="individual_top5_images">
<?php
print "<img src='$img2' height='85px' alt='$desc' title='$desc' /></div>"?>
</div>
<?php
}
print "</div>";
}
I am trying to pull out the top 5 products from several categories and it works ok if i type in the keywords for a boolean search like so
$booleansearch = array('sQuery'=> '-region 1', 'oActiveRefineByGroup' => $oRefineBy, 'bAdult' => true, 'iLimit'=>5, 'sColumnToReturn' => $returnedcolumns, 'sSort'=>'popularity', 'sMode' => 'boolean');
but if i do this
$booleansearch = array('sQuery'=> $keywords, 'oActiveRefineByGroup' => $oRefineBy, 'bAdult' => true, 'iLimit'=>5, 'sColumnToReturn' => $returnedcolumns, 'sSort'=>'popularity', 'sMode' => 'boolean');
i get compleatly different results even though its doing the same thing, isnt it? why am i getting the two sets of data?
i really need to use the varible in there as i will be searching over 30 categories and cannot add all the -keywords for all the categories in the one query
can anyone please help me with this?
many thanks
Luke
i have this code
<?php
foreach ($category_list as $category => $sub_category)
{
switch($category)
{
case "DVD";
$aw_id = "240";
$aw_name = "DVDs";
$keywords = "-region 1";
break;
case "CD";
$aw_id = "241";
$aw_name = "Music";
$keywords = "";
break;
case "Video Games";
$aw_id = "579";
$aw_name = "-console -bundle";
$keywords = "-region 1";
break;
case "Blu-Ray";
$aw_id = "550";
$aw_name = "Blu-Ray";
$keywords = "-region 1";
break;
case "Books";
$aw_id = "538";
$aw_name = "Books";
$keywords = "";
break;
}
print "<div class='category_container'>";
print "<h2 class='category_header red'>$category</h2>";
#GET TOP 5 ITEMS FOR EACH CATEGORY
$AW_catid = $aw_id;
$AW_cat = $aw_name;
$keywords = "";
$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(sAwImageUrl, sAwThumbUrl, sName,sAwImageUrl,sMerchantImageUrl,sMerchantThumb Url,sDescription,sBrand,iMerchantId,iCategoryId);
$booleansearch = array('sQuery'=> $keywords, 'oActiveRefineByGroup' => $oRefineBy, 'bAdult' => true, 'iLimit'=>5, 'sColumnToReturn' => $returnedcolumns, 'sSort'=>'popularity', 'sMode' => 'boolean');
$oResponse= $oClient->call('getProductList', $booleansearch);
foreach($oResponse->oProduct as $oProduct)
{
$img = htmlspecialchars($oProduct->sMerchantImageUrl);
$img2 = htmlspecialchars($oProduct->sAwThumbUrl);
$desc = $oProduct->sDescription;?>
<div class="individual_top5">
<h3 class="individual_top5_headers"><?php print $oProduct->sName;?></h3>
<div class="individual_top5_images">
<?php
print "<img src='$img2' height='85px' alt='$desc' title='$desc' /></div>"?>
</div>
<?php
}
print "</div>";
}
I am trying to pull out the top 5 products from several categories and it works ok if i type in the keywords for a boolean search like so
$booleansearch = array('sQuery'=> '-region 1', 'oActiveRefineByGroup' => $oRefineBy, 'bAdult' => true, 'iLimit'=>5, 'sColumnToReturn' => $returnedcolumns, 'sSort'=>'popularity', 'sMode' => 'boolean');
but if i do this
$booleansearch = array('sQuery'=> $keywords, 'oActiveRefineByGroup' => $oRefineBy, 'bAdult' => true, 'iLimit'=>5, 'sColumnToReturn' => $returnedcolumns, 'sSort'=>'popularity', 'sMode' => 'boolean');
i get compleatly different results even though its doing the same thing, isnt it? why am i getting the two sets of data?
i really need to use the varible in there as i will be searching over 30 categories and cannot add all the -keywords for all the categories in the one query
can anyone please help me with this?
many thanks
Luke