Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
asv_amazon
So here we go. I just uploaded my first plugin. I hope people find it useful, and definitely let me know about defects and enhancements. I’ll work on defects right now and make a list of enhancements to review.
Name: asv_amazon
Version: 0.3
Author: Amit Varia
Author URL: <a href=“http://www.amitvaria.com/”>http://www.amitvaria.com/</a>
Modified: 2005-05-25
<a href=“http://www.amitvaria.com/plugin/asv_amazon_0.3.txt”>Download URL</a>
<a href=“http://www.amitvaria.com/index.php?id=67”>Example URL</a>
Summary: You can include some basic information about a product off the Amazon website and now you can cache the product on to your textpattern site.
UPDATE (06/14/2005): I fixed a defect that prevented the plugin from pulling the data from a cached page. Also the plugin can be installed using the 1.0 standard.
Last edited by variaas (2005-06-14 21:07:53)
Offline
Re: asv_amazon
hey variaas you may want to take a look at this article:
http://aaugh.com/imageabuse.html
would you be able to add such variables to an image and how it’s displayed? Just curious. Very cool article.
Offline
Offline
Re: asv_amazon
I don’t know how many people are considering this plugin useful, but I’m working on the next version right now and am going to start caching. I’m trying to figure out how much to cache.
Should I just cache the XML file that holds all the data about the product, or should I also cache images instead of pulling the image off Amazon’s site?
Offline
Re: asv_amazon
Hi variaas,
I’m caching the response I get from amazon in rmc_audioscrobbler, here’s the caching code:
<code>
<pre>
if (!file_exists($cachefile)) {
$searchResult = $AS->DoKeywordSearch($searchterm, ‘lite’, ‘music’, 1);
if ($searchResult) {
$result = $searchResult0;
$handle = fopen($cachefile, “w”);
fwrite($handle, serialize($result));
fclose($handle);
}
} else {
$cachefilesize = filesize($cachefile);
$handle = fopen($cachefile, “r”);
$result = unserialize(fread($handle, $cachefilesize));
}
</pre>
</code>
I save the response I get from amazon by simply serializing the object I get from parsing the XML. Works perfectly (for me).
I wouldn’t worry about caching the images, to be able to cache them you’d have to retrieve the images first and save them onto your filesystem (might be more trouble than it’s worth, but if you plan to do so let me know if you need a helping hand).
Last edited by ruairi (2005-05-27 09:25:00)
Offline
Re: asv_amazon
this doesn’t add in associate IDs, does it? so you’d get a referal and % back on each purchase through your site?
Listen to Kenneth
Offline
Re: asv_amazon
ruairi,
Thanks for the input on caching. I went ahead and wrote it last night, and it’s really close to your code. The only difference is that I don’t serialize the XML received. Is there a reason to serialize it? I just copy the file from the Amazon Website to the “textpattern/tmp” folder.
Also I went and ahead and gave the option to cache the image to the tmp folder as well. Again I just copy the image to the tmp folder.
Offline
Offline
Offline
Re: asv_amazon
variaas wrote:
ruairi,
Thanks for the input on caching. I went ahead and wrote it last night, and it’s really close to your code. The only difference is that I don’t serialize the XML received. Is there a reason to serialize it? I just copy the file from the Amazon Website to the “textpattern/tmp” folder.
The only reason I serialize the result is because the Amazon search api returns an array, I’ve no xml file to cache.
Offline
Offline
#12 2005-06-14 20:09:43
- davidm
- Member
- From: Paris, France
- Registered: 2004-04-27
- Posts: 719
Re: asv_amazon
I am interrested by this plugin, which I missed at the time, but my question is : will it be possible to use this plugin with european amazon websites, such as amazon.fr ?
Thx !
.: Retired :.
Offline