I edited the PHP on the WP-Amazon Plugin for WordPress. I wanted to achieve two things. One, when adding an image, I wanted the text to follow it. Two, I wanted to have it display the name of the product in the title attribute of the link, that is, when one hovers over the link, I wanted the title to display, rather then the default of "View product details at Amazon".
Here is the new improved code:
-
function generateHTMLCode(format,prodname,url,imgurl) {
-
if (format=='link') {
-
html = '<a href="'+url+'" title="Amazon.com - '+prodname+'">'+prodname+'</a>';
-
} else {
-
html = '<a href="'+url+'" title="Amazon.com - '+prodname+'"><img src="'+imgurl+'" alt="'+prodname+'" /></a><br />'
-
+'<a href="'+url+'" title="Amazon.com - '+prodname+'">'+prodname+'</a>';
-
}
-
htmlCode = document.getElementById("htmlcode")
-
htmlCode.value = html;
-
}
Here is the old code so one can find it. It should be around line 190 or so (for version 1.3.2 anyhow)
-
function generateHTMLCode(format,prodname,url,imgurl) {
-
if (format=='link') {
-
html = '<a href="'+url+'" title="View product details at Amazon">'+prodname+'</a>';
-
} else {
-
html = '<a href="'+url+'" title="View product details at Amazon"><img src="'+imgurl+'" alt="'+prodname+'" /></a>';
-
}
-
htmlCode = document.getElementById("htmlcode")
-
htmlCode.value = html;
-
}
I am still looking for a way to change the link to a more basic link, so Amazon's new Product Preview will work properly. However, for some reason I can't figure out where it is making the full link...



hello. is there an easy way within wp-amazon to display a widget block with a random image and title somewhere in the widget sidebars?
perhaps by using a phpexec widget with a call?
(p.s., yes, i know about the cg-amazon plugin)
That may be above my current PHP abilities. I would say contact the author of the plugin itself and see if he knows, although I am not sure if it is still in development. I am still trying to find a way of changing the links to a basic link so the product preview will work.