You are here:  » Updated: Asynchronous Amazon and eBay API Modules

Active Forum Topics


Updated: Asynchronous Amazon and eBay API Modules

Submitted by support on Wed, 2017-01-18 10:54 in

Hi everyone,

I've created drop-in replacements of the search results (html/searchresults.php) and price comparison table (html/prices.php) HTML modules which includes tabs for Amazon and / or eBay results. Using "onClick" to detect user activation of each tab for the first time, the API results are then loaded on demand and displayed in the same format as datafeed results.

Default view, normal price comparison table of datafeed results:

...and with Amazon tab selected:

Installation

Download (Responsive HTML / Responsive HTML Plus Templates)

Download (Classic Template)

Archive contains:

html/api.css
html/api.php
html/amazon.php
html/ebay.php
html/prices.php
html/prices_table.php
html/prices_amazon.php
html/prices_ebay.php
html/searchresults.php
html/searchresults_table.php
html/searchresults_amazon.php
html/searchresults_ebay.php

Amazon / eBay tabs are enabled by the presence of html/amazon.php and html/ebay.php respectively.

- If you wish to include the Amazon tabs, edit html/amazon.php and enter your Amazon Associates AWS API credentials, associate tag and the required host and region for your locale e.g.

<?php
  $amazonAWSAccessKeyId = "YOUR_ACCESS_KEY_ID";
  $amazonSecretAccessKey = "YOUR_SECRET_ACCESS_KEY";
  $amazonAssociateTag = "YOUR_ASSOCIATE_TAG";
  $amazonHost = "webservices.amazon.co.uk";
  $amazonRegion = "eu-west-1";
?>

- If you wish to include the eBay tabs, edit html/ebay.php and enter your eBay Developers Program App ID, Global ID, Network ID (see below) and tracking ID associated with the network e.g.

<?php
  $ebayAppId = "YOUR_APP_ID";
  $ebayGlobalId = "YOUR_GLOBAL_ID";
  $ebayNetworkId = "YOUR_NETWORK_ID";
  $ebayTrackingId = "YOUR_TRACKING_ID";
?>

Upload the modified and required replacement files to your Price Tapestry installation.

Post Installation

- Amazon / eBay logos are picked up exactly as per datafeed merchant logos. To enable logos, upload the image files required as logos/Amazon.img and logos/eBay.img respectively (assuming default $config_logoExtension of ".img").

- You should add a Disallow: entry for /html/ to your site's robots.txt file

Enjoy!

Cheers,
David
--
PriceTapestry.com

Submitted by support on Wed, 2017-01-18 10:59

eBay Network ID Values

2 = Be Free
3 = Affilinet
4 = TradeDoubler
5 = Mediaplex
6 = DoubleClick
7 = Allyes
8 = BJMT
9 = eBay Partner Network

Submitted by wilkins on Thu, 2017-01-19 09:07

hi david

any time frame for classic template, starting to redue some sites where css has been an issue with templates, all of which have ebay/amazon on.

Regards

Brent

Submitted by support on Thu, 2017-01-19 13:10

Hello Brent,

I'm aiming to have a version for the Classic template available towards the end of next week. In keeping with the objective of the Classic template, I want to do it without reliance on any 3rd party framework / library (other than jQuery, which makes for very straight forward element visibility toggling and AJAX loading, and if necessary jQuery.noConflict() can be used should any conflict arise...)

Cheers,
David.
--
PriceTapestry.com

Submitted by uck on Sat, 2017-01-21 20:55

Hi David,

followed the instruction above, but the onclick doesn't work. I'm running 15/09A. Shall update to 16/10A?

thank you

Submitted by support on Mon, 2017-01-23 10:03

Hi,

Could you perhaps try loading your page in Firefox, then click one of the tabs, and then from the menu go to Tools > Web Developer > Web Console and let me know if there is a JavaScript error displayed?

Thanks,

David.
--
PriceTapestry.com

Submitted by uck on Mon, 2017-01-23 11:59

HI David,

I have spotted the problem. There is NO issue with the script.
It was my mistake: I previously had added "require("kelkoo.php");" to search.php and then deleted the kelkoo.php file, the two things combined generated the problem.

Now is solved.

Thank you

Submitted by support on Wed, 2017-02-01 12:41

How to view raw API response if no results

Because everything takes place in the background it can be tricky to diagnose any problems setting up the API modules if results are not displayed as expected. Both Amazon and eBay APIs return detailed error messages such as whether a key provided is invalid. To view the response, look for the following code at line 171 (html/searchresults_amazon.php) / line 139 (searchresults_ebay.php)

    $xml = api_fetch($url);

...and REPLACE with:

    $xml = api_fetch($url);
    if (isset($_GET["debug"]))
    {
      header("Content-Type: text/xml");
      print $xml;
      exit();
    }

With that in place, to view the response request the modified file directly with a value for the q parameter that would be expected to return results together with &debug=1 for example:

http://www.example.com/html/searchresults_amazon.php?q=iphone&debug=1

Cheers,
David.
--
PriceTapestry.com

Submitted by support on Fri, 2017-02-10 09:24

Hi everyone,

Asynchronous Amazon and eBay API Modules now available to download for Classic template.

Cheers,
David.
--
PriceTapestry.com

Submitted by ajmboy on Sat, 2017-02-11 04:00

Thanks David. :)

Submitted by bodybuildingcom... on Sun, 2019-12-08 00:22

Hi David,

I have downloaded/installed the Responsive HTML / Responsive HTML Plus Templates, but when I click on the Amazon and eBay tabs, it doesn't take me to Amazon nor eBay results. I have filled out all the Access keys, Secret Access key Id's etc. for both companies.

An example page: {link saved}

Would it be a rewrite issue?

Thanks.

Norbert

Submitted by support on Mon, 2019-12-09 11:10

Hi Norbert,

Could you let me know if this is still the case after updating jQuery (for search form auto-complete) as they may be related, but if not I'll check it out further with you...

Cheers,
David.
--
PriceTapestry.com

Submitted by support on Thu, 2020-01-23 08:51

Hi everyone,

Amazon have announced end-of-life for the current V4 Product Advertising API in March with migration to V5 required before then.

My plan is to make a proxy script that makes the V5 request and returns V4 format XML that can be passed into the existing code without modification. I'll update this thread once available...

Cheers,
David.
--
PriceTapestry.com

Submitted by gregor on Thu, 2020-02-13 04:19

Hi David, any progress on this update for the new version of the API? Do you still plan to develop a solution? If so, any idea when it will be available?

Thanks

Submitted by support on Thu, 2020-02-13 08:47

Hi Gregor,

I've recoded for V5 rather than make a proxy as it's relatively easy to work with but would appreciate a couple of "beta testers" before posting a download - if you would be happy to give it a go please could you email me the existing html/searchresults_amazon.php and html/prices_amazon.php that you are using and I'll apply the changes for you to try...

Also, @Graham - I followed up to your post by email yesterday, not sure if received (you may have changed address) but if not drop me an email also to try out the new version...

Cheers,
David.
--
PriceTapestry.com

Submitted by Marcos on Wed, 2020-03-11 04:10

Hi David, hope you are doing great!

I was wondering if you had a final version of the Amazon API module. I'm working on a new website and I would like to implement it.

Thank you in advance.

Best,
Marcos

Submitted by support on Wed, 2020-03-11 11:14

Hello Marcos,

The downloads have now been updated for Amazon Product Advertising API V5.

I've also updated the first post on this page as an additional configuration parameter (region) has been added to amazon.php.

Some users have reported having to migrate their access keys from AWS to their Associates Central account. This creates a new key pair accessed through the Associated Central control panel rather than the AWS Console.

Cheers,
David.
--
PriceTapestry.com

Submitted by Marcos on Wed, 2020-03-11 17:57

Great, thanks!

Submitted by crounauer on Tue, 2020-03-17 17:59

It's also worth noting that if you create a new Access Key ID, there seems to be a 48 hour delay before they work. This error message is displayed until the new credentials become active.

Message:The request was denied due to request throttling. Please verify the number of requests made per second to the Amazon Product Advertising API

Thanks,
Simon

Submitted by support on Tue, 2020-03-17 18:21

Thanks for the note, Simon

Cheers,
David.
--
PriceTapestry.com

Submitted by MarcoCH on Wed, 2020-04-08 18:34

Hello David

are only the following files new and need to be adjusted?

amazon.php
prices_amazon.php
searchresults_amazon.php

Greets
Marco

Submitted by support on Thu, 2020-04-09 06:29

Hi Marco,

That's correct - no other files have been changed in the downloads...

Cheers,
David.
--
PriceTapestry.com

Submitted by Actual on Wed, 2020-05-13 20:42

Will this work for 13/03A?

My existing site is heavily modified and I'm not sure it would be easy to migrate to a later version without breaking mods.

Submitted by support on Thu, 2020-05-14 05:59

Hi,

It should be straight forward to get working with any distribution.

Firstly, make a backup copy of all files in your html/ folder in case you need to revert; and to create the new *_table.php files as described below.

Use the download for the "Classic" template (which generates the tabs using standalone HTML/CSS) and then from your backup of the html/ folder copy a renamed version of your existing files as follows:

searchresults.php as html/searchresults_table.php

prices.php as html/prices_table.php

The tabs and async loading of the API results uses jQuery. If not already included in your template (which wasn't the case in 13/03A), extract from the latest distribution and upload to your site:

html/vendor/jquery.min.js

Finally, edit html/header.php and insert the following line just before the closing </head> tag:

<script src='<?php print $config_baseHREF?>html/vendor/jquery.min.js'></script>

Hope this helps!

Cheers,
David.
--
PriceTapestry.com