How to create an attractive auto amazon product widget

How to create an attractive auto amazon product widget

Auto amazon product widget is a widget used to display the product from amazon with simple enough to use. You can use the auto amazon product widget, without having to build a website amazon. By using a blog / site of yours that has the highest visitor will increase your amazon earning.

If previously I’ve made a plugin on Free Amazon Asin Grabber Plugin and Boost your Earning with Amazon Custom Thumbnail Plugin, this time I am not going to teach you how to increase your amazon earnings but how to make amazon auto generated products to be displayed as a sidebar widget which will display the amazon products according to the keywords you are looking for.

If you still do not understand what it is auto amazon product widget, please see the video footage below, how to use auto amazon product widget

 How to install and use auto amazon product widget 

• Before you can download this amazon auto product widget on wordpress site,you can download from this my link below

• Upload and Install auto amazon product plugin on your wordpress site.
• Go to you widget window (appearance -> widgets).
• Drag auto amazon product widget on your sidebar widget
• Fill the requirement field (Please do not left blank, because all of these fields, is needed so that plugin can run well )
• Check your side now 🙂

 The advantage of using Amazon product widget 

• You can show amazon product without build your amazon site.
• You don’t need more skill to show amazon product.
• an attractive amazon product display can increase your earning.
• You can show product with your interested keyword.
• Its Free and If you wish, you can make a donation to me 🙂

 The lack of this amazon auto product 

• A slightly to burdensome your hosting site, because this plugin work to grab amazon xml product from amazon site.
• Auto Amazon product widget still have many bugs which I do not know.

 Maybe this is the long-awaited session ,how do I make auto amazon product widget 

• Please create auto-amazon-product-widget folder.
• Create a php file name as auto-amazon-product-widget.php
• Copy this syntax below on your auto-amazon-product-widget.php file.

Plugin Name: Auto amazon product widget by seegatesite
Plugin URI:
Description: Creating an interactive wordpress widget to show amazon`s product with autogenerated widget.
Version: 1.0
Author: Seegatesite
Author URI:
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
if ( ! defined( 'ABSPATH' ) ) {
    exit; // disable direct access
wp_register_sidebar_widget('aapws_id','Auto amazon product Widget','aapws_display',array('description' => 'Auto amazon product widgets by'));

function aapws_control($args=array(), $params=array()) {
if (isset($_POST['submitted']))
	update_option('aapws_title', $_POST['widgettitle']);
	update_option('aapws_tag_id', $_POST['tag_id']);
	update_option('aapws_pub_key', $_POST['pub_key']);
	update_option('aapws_priv_key', $_POST['priv_key']);
	update_option('aapws_searchindex', $_POST['searchindex']);
	update_option('aapws_keyword', $_POST['keyword']);
	update_option('aapws_location', $_POST['location']);
	update_option('aapws_count', $_POST['count']);
//load options
$widgettitle = get_option('aapws_title');
$tag_id = get_option('aapws_tag_id');
$pub_key = get_option('aapws_pub_key');
$priv_key = get_option('aapws_priv_key');
$searchindex = get_option('aapws_searchindex');
$keyword = get_option('aapws_keyword');
$location = get_option('aapws_location');
$count = get_option('aapws_count');
Widget Title :<br />
<input type="text" class="widefat" name="widgettitle" value="<?php echo stripslashes($widgettitle); ?>" />
<br /><br />
Tag id :<br />
<input type="text" class="widefat" name="tag_id" value="<?php echo $tag_id; ?>" />
<br /><br />
Public key :<br />
<input type="text" class="widefat" name="pub_key" value="<?php echo $pub_key; ?>" />
<br /><br />
Private key :<br />
<input type="text" class="widefat" name="priv_key" value="<?php echo $priv_key; ?>" />
<br /><br />
Searchindex :<br />
<select class="widefat" name="searchindex">
	<option value="All"<?php if($searchindex=="All") echo 'selected' ;  ?> >All</option>
    <option value="Apparel"<?php if($searchindex=="Apparel") echo 'selected' ;  ?> >Apparel</option>
    <option value="Appliances"<?php if($searchindex=="Appliances") echo 'selected' ;  ?> >Appliances</option>
    <option value="ArtsAndCrafts"<?php if($searchindex=="ArtsAndCrafts") echo 'selected' ;  ?> >ArtsAndCrafts</option>
    <option value="Automotive"<?php if($searchindex=="Automotive") echo 'selected' ;  ?> >Automotive</option>
    <option value="Baby"<?php if($searchindex=="Baby") echo 'selected' ;  ?> >Baby</option>
    <option value="Beauty"<?php if($searchindex=="Beauty") echo 'selected' ;  ?> >Beauty</option>
    <option value="Blended"<?php if($searchindex=="Blended") echo 'selected' ;  ?> >Blended</option>
    <option value="Books"<?php if($searchindex=="Books") echo 'selected' ;  ?> >Books</option>
    <option value="Classical"<?php if($searchindex=="Classical") echo 'selected' ;  ?> >Classical</option>
    <option value="Collectibles"<?php if($searchindex=="Collectibles") echo 'selected' ;  ?> >Collectibles</option>
    <option value="DigitalMusic"<?php if($searchindex=="DigitalMusic") echo 'selected' ;  ?> >DigitalMusic</option>
    <option value="Grocery"<?php if($searchindex=="Grocery") echo 'selected' ;  ?> >Grocery</option>
    <option value="DVD"<?php if($searchindex=="DVD") echo 'selected' ;  ?> >DVD</option>
    <option value="Electronics"<?php if($searchindex=="Electronics") echo 'selected' ;  ?> >Electronics</option>
    <option value="HealthPersonalCare"<?php if($searchindex=="HealthPersonalCare") echo 'selected' ;  ?> >HealthPersonalCare</option>
    <option value="HomeGarden"<?php if($searchindex=="HomeGarden") echo 'selected' ;  ?> >HomeGarden</option>
    <option value="Industrial"<?php if($searchindex=="Industrial") echo 'selected' ;  ?> >Industrial</option>
    <option value="Jewelry"<?php if($searchindex=="Jewelry") echo 'selected' ;  ?> >Jewelry</option>
    <option value="KindleStore"<?php if($searchindex=="KindleStore") echo 'selected' ;  ?> >KindleStore</option>
    <option value="Kitchen"<?php if($searchindex=="Kitchen") echo 'selected' ;  ?> >Kitchen</option>
    <option value="LawnGarden"<?php if($searchindex=="LawnGarden") echo 'selected' ;  ?> >LawnGarden</option>
    <option value="Magazines"<?php if($searchindex=="Magazines") echo 'selected' ;  ?> >Magazines</option>
    <option value="Marketplace"<?php if($searchindex=="Marketplace") echo 'selected' ;  ?> >Marketplace</option>
    <option value="Merchants"<?php if($searchindex=="Merchants") echo 'selected' ;  ?> >Merchants</option>
    <option value="Miscellaneous"<?php if($searchindex=="Miscellaneous") echo 'selected' ;  ?> >Miscellaneous</option>
    <option value="MobileApps"<?php if($searchindex=="MobileApps") echo 'selected' ;  ?> >MobileApps</option>
    <option value="MP3Downloads"<?php if($searchindex=="MP3Downloads") echo 'selected' ;  ?> >MP3Downloads</option>
    <option value="Music"<?php if($searchindex=="Music") echo 'selected' ;  ?> >Music</option>
    <option value="MusicalInstruments"<?php if($searchindex=="MusicalInstruments") echo 'selected' ;  ?> >MusicalInstruments</option>
    <option value="MusicTracks"<?php if($searchindex=="MusicTracks") echo 'selected' ;  ?> >MusicTracks</option>
    <option value="OfficeProducts"<?php if($searchindex=="OfficeProducts") echo 'selected' ;  ?> >OfficeProducts</option>
    <option value="OutdoorLiving"<?php if($searchindex=="OutdoorLiving") echo 'selected' ;  ?> >OutdoorLiving</option>
    <option value="PCHardware"<?php if($searchindex=="PCHardware") echo 'selected' ;  ?> >PCHardware</option>
    <option value="PetSupplies"<?php if($searchindex=="PetSupplies") echo 'selected' ;  ?> >PetSupplies</option>
    <option value="Photo"<?php if($searchindex=="Photo") echo 'selected' ;  ?> >Photo</option>
    <option value="Shoes"<?php if($searchindex=="Shoes") echo 'selected' ;  ?> >Shoes</option>
    <option value="Software"<?php if($searchindex=="Software") echo 'selected' ;  ?> >Software</option>
    <option value="SportingGoods"<?php if($searchindex=="SportingGoods") echo 'selected' ;  ?> >SportingGoods</option>
    <option value="Tools"<?php if($searchindex=="Tools") echo 'selected' ;  ?> >Tools</option>
    <option value="Toys"<?php if($searchindex=="Toys") echo 'selected' ;  ?> >Toys</option>
    <option value="UnboxVideo"<?php if($searchindex=="UnboxVideo") echo 'selected' ;  ?> >UnboxVideo</option>
    <option value="VHS"<?php if($searchindex=="VHS") echo 'selected' ;  ?> >VHS</option>
    <option value="Video"<?php if($searchindex=="Video") echo 'selected' ;  ?> >Video</option>
    <option value="VideoGames"<?php if($searchindex=="VideoGames") echo 'selected' ;  ?> >VideoGames</option>
    <option value="Watches"<?php if($searchindex=="Watches") echo 'selected' ;  ?> >Watches</option>
    <option value="Wireless"<?php if($searchindex=="Wireless") echo 'selected' ;  ?> >Wireless</option>
    <option value="WirelessAccessories"<?php if($searchindex=="WirelessAccessories") echo 'selected' ;  ?> >WirelessAccessories</option>
<br /><br />
Keyword :<br />
<input type="text" class="widefat" name="keyword" value="<?php echo $keyword; ?>" />
<br /><br />
Location :<br />
<select  name="location">
	<option value="ca" <?php if($location=='ca') echo 'selected'; ?> >.ca</option>
	<option value="cn" <?php if($location=='cn') echo 'selected'; ?> >.cn</option>
	<option value="es" <?php if($location=='es') echo 'selected'; ?> >.es</option>
    <option value="fr" <?php if($location=='fr') echo 'selected'; ?> >.fr</option>
    <option value="in" <?php if($location=='in') echo 'selected'; ?> >.in</option>
    <option value="it" <?php if($location=='it') echo 'selected'; ?> >.it</option>
    <option value="" <?php if($location=='') echo 'selected'; ?> ></option>
    <option value="" <?php if($location=='') echo 'selected'; ?> ></option>
    <option value="com" <?php if($location=='com') echo 'selected'; ?> >.com</option>
<br /><br />
Count :<br />
<select  name="count">
			echo '<option value="'.$i.'" ';
			if($count==$i) echo ' selected';
			echo ' >'.$i.'</option>';
<br /><br />
<input type="hidden" name="submitted" value="1" />
function aapws_display($args=array(), $params=array())
	//load options
	$widgettitle = get_option('aapws_title');
	$count = get_option('aapws_count');
	   $jdw = 'Hot trends';
	} else {
	   $jdw = $widgettitle;
	//widget output
	echo stripslashes($args['before_widget']);
	echo stripslashes($args['before_title']);
	echo stripslashes($jdw);
	echo stripslashes($args['after_title']); ?>
	$url = aapws_aws_request();
	//echo $url;
	$a	 = file_get_contents($url);
	$xml = new SimpleXmlElement($a, LIBXML_NOCDATA);
	echo "<ul>";
	  $cnt = count($xml->Items->Item);
	  for($i=0; $i<$cnt; $i++)
		   echo "<li>";
		   $detailurl = $xml->Items->Item[$i]->DetailPageURL;
		   $img = $xml->Items->Item[$i]->SmallImage->URL;
		   $title = $xml->Items->Item[$i]->ItemAttributes->Title;
		   $price = $xml->Items->Item[$i]->OfferSummary->LowestNewPrice->FormattedPrice;
		   $desc = $xml->Items->Item[$i]->EditorialReviews->EditorialReview->Content;

		   echo '<div style="width:100%;"><p>';
		   echo '<img src="'.$img.'" align="left" />';
		   echo '<a href="'.$detailurl.'">'.substr($title,0,70).'...</a><br/>';
		   echo 'Price : '.$price.'<br/>';
		   echo strtolower(substr($desc,0,70)).'...<br/>';
		   echo '<a href="'.$detailurl.'">more detail</a>';
		   echo "</p></div><div style='clear:both'></div></li>";
		   if($i == $count-1)
	echo '</ul>';
	<?php wp_reset_query(); ?>
	<?php echo stripslashes($args['after_widget']);

function aapws_aws_request()
	  $tag_id = get_option('aapws_tag_id');
	  $pub_key = get_option('aapws_pub_key');
	  $priv_key = get_option('aapws_priv_key');
	  $searchindex = get_option('aapws_searchindex');
	  $keyword = get_option('aapws_keyword');
	  $location = get_option('aapws_location');
		'Operation'		  => 'ItemSearch',
		'Keywords'		  => $keyword ,
		'SearchIndex'	  => $searchindex          ,
		'AssociateTag'    => $tag_id,  //tag url
		'ResponseGroup'   => 'Medium'                ,
	  $ext=$location;  //extension of server, see data.php
      $method = "GET";
	  $host = "ecs.amazonaws.".$ext;
	  $uri = "/onca/xml";
	  $params["Service"] = "AWSECommerceService";
	  $params["AWSAccessKeyId"] = $pub_key;
	  $params["Timestamp"] = gmdate("Y-m-d\TH:i:s\Z",time());  //may not be more than 15 minutes out of date!
	  $params["Version"] = "2009-03-31";
	  $canonicalized_query = array();
	  foreach ($params as $param=>$value)
			$param = str_replace("%7E", "~", rawurlencode($param));
			$value = str_replace("%7E", "~", rawurlencode($value));
			$canonicalized_query[] = $param."=".$value;
		$canonicalized_query = implode("&", $canonicalized_query);
		$string_to_sign = $method."\n".$host."\n".$uri."\n".$canonicalized_query;
		$signature = base64_encode(hash_hmac("sha256", $string_to_sign, $priv_key, True));
		$signature = rawurlencode($signature);
		$request = "http://".$host.$uri."?".$canonicalized_query."&Signature=".$signature;
	    return $request;


• Compress you folder as zip file
• Voilaaa… your amazon auto product widget is ready to use now 🙂
Should I explain the syntax line above? I would certainly explain a few little syntax line above, because I am a good man, like to sharing and not arrogant … LOL :). I am not going to explain at length, because you certainly better than me in terms of programming
• To register your widget sidebar

wp_register_sidebar_widget('aapws_id','Auto amazon product Widget','aapws_display',array('description' => 'Auto amazon product widgets by'));

• Create control / parameter to show amazon auto product. You need Amazon api key (amazon public key and private ket) and your tag-id.

function aapws_control($args=array(), $params=array())
if (isset($_POST['submitted']))

• To show your widget on your sidebar widget from this syntax

function aapws_display($args=array(), $params=array())
	// ------------- copy from syntax above --------------------------//
function aapws_aws_request()
	// ------------- copy from syntax above --------------------------//

To create this auto amazon product widget you just need 5 minutes of your time, I have not a had time to upload this plugin on wordpress official website, but I will try soon to launch auto amazon product widget on the wordpress official site to be enjoyed by everyone, my other amazon plugin you can read here amazon plugin.

The following two tabs change content below.
This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.


 Add your comment
  1. Brother please tell me, how will i get public key and private key from? i don’t understand.

  2. <option value="de" >.de

    this won’t work. Have any idea?

Leave a Comment

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

%d bloggers like this: