This is a deceptively simple question - I have been trying to add the price, and have attempted that by changing my display function by adding:
//if there is a price show it
if (isset($result['Medium']['Amount'] )) {
echo "<b>". $result['Medium']['Amount']."</b>";
}
if($this->prod['name'] !="") {
//find what we are searching for - could also come from a GET if you wanted.
$search = $this->man['name']." ".$this->prod['name'];
$category = "PCHardware";
//Amazon account settings
define('AWS_API_KEY', 'AKIAILR632MKQJ6MTCWA');
define('AWS_API_SECRET_KEY', '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');
define('AWS_ASSOCIATE_ID', 'wholesdirect-20');
require 'amazonecs.class.php';
//declare the amazon ECS class
$amazonEcs = new AmazonECS(AWS_API_KEY, AWS_API_SECRET_KEY, 'co.uk', AWS_ASSOCIATE_ID);
//tell the amazon class that we want an array, not an object
$amazonEcs->setReturnType(AmazonECS::RETURN_TYPE_ARRAY);
//create the amazon object (array)
$response = $amazonEcs->category($category)->responseGroup('Medium,Images,Offers')->search($search);
//check that there are items in the response
if (isset($response['Items']['Item']) ) {
//loop through each item
foreach ($response['Items']['Item'] as $result) {
//check that there is a ASIN code - for some reason, some items are not
//correctly listed. Im sure there is a reason for it, need to check.
if (isset($result['ASIN'])) {
//store the ASIN code in case we need it
$asin = $result['ASIN'];
//check that there is a URL. If not - no need to bother showing
//this one as we only want linkable items
if (isset($result['DetailPageURL'])) {
//set up a container for the details - this could be a DIV
echo '<table border="0" cellpadding="8"><tr><td>';
//create the URL link
echo '<a rel="nofollow" target="_Blank" href="'.$result['DetailPageURL'].'">';
// if there is a title - show it
if (isset($result['ItemAttributes']['Title'])) {
echo $result['ItemAttributes']['Title'] . "<br/>";
}
//if there is a small image - show it (Alternatively could be simplified to <img border="0" src="image " alt="" /></a> )
if (isset($result['SmallImage']['URL'] )) {
echo "<img style=' margin: 0px; margin-left: 10px; border: 1px solid black; max-height: 55px;' align='left' src='". $result['SmallImage']['URL'] ."'>";
}
//if there is a price show it
if (isset($result['Medium']['Amount'] )) {
echo "<b>". $result['Medium']['Amount']."</b>";
}
//close the table etc
echo "</a></td></tr></table>";
}
}
}
}
}
}