This is a short english version of My german post about a work-around for a issue with the plugin. Today I have noted, there are no more picture urls. Only a broken icon and the url is a ‚add-to-wishlist‘-link. I found no easy-to-use alternative, so I do a little research and debugging and found, the xml-response has a new element named ‚ItemLinks‘. This element also has childs ‚URL‘.
The plugin-code takes all elements named ‚URL‘ and uses them as picture-links. Since the author will not longer support the plugin, you have to fix it for yourself or wait for a dev, who changes the code and submit to the wordpress svn. Maybe I will do. For the moment, follow this steps to make it work again. In the file:
/wp-content/plugins/amazon-reloaded-for-wordpress/amazon-reloaded-for-wordpress.php
you have to add these lines after the line 82:
...
$detailPageUrl = $this->getFirstElementValueForTagName($item, 'DetailPageURL');
// New lines to make image urls working
$itemlinks = $item->getElementsByTagName('ItemLinks')->item(0);
$itemlinks->parentNode->removeChild($itemlinks);
$imageUrls = array();
...
This removes the new ‚ItemLinks‘ element from the xml-response. So the plugin can find pictures and work as expected. While reading the amazon webservice documentation, they use a different url. To reflect the new url, you have to change:
http://ecs.amazonaws.com
to:
http://webservices.amazon.com
This can be done with a small change to the last 2 functions in the php-file. At the end, change the url’s in both functions like this:
function getAmazonProductSearchRequestUrl($terms, $index) {
$settings = $this->getSettings();
$url = "http://webservices.amazon.{$settings['amazon-locale']}/onca/xml?";
$url .= 'Service=AWSECommerceService&';
$url .= 'Version=2011-08-01&';
$url .= 'AssociateTag=' . urlencode( $settings[ 'amazon-associates-id'] ) . '&';
$url .= "AWSAccessKeyId={$settings['amazon-api-key']}&";
$url .= 'Operation=ItemSearch&';
$url .= 'Keywords='.urlencode(str_replace(' ', '%20', $terms)).'&';
$url .= 'SearchIndex='.urlencode($index).'&';
$url .= 'ResponseGroup=Small,Images';
return $url;
}
function getAmazonHelpRequestUrl() {
$settings = $this->getSettings();
return 'http://webservices.amazon.'.$settings['amazon-locale'].'/onca/xml?Service=AWSECommerceService&AWSAccessKeyId='.$settings['amazon-api-key'].'&Operation=BrowseNodeLookup&BrowseNodeId=163357';
}
I have packed a changed version of this plugin. You can grab it here and simply unpack it over the old version. You must overwrite the old files.
Schreibe einen Kommentar