Home
Download
Add-ons
Help
Forum
Organisation
Project
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
February 11, 2012, 04:02:13 AM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Interested in joining the WebsiteBaker team?
For more Information read
here
or on our
new website
.
149534
Posts in
21088
Topics by
7529
Members
Latest Member:
schwaneb
WebsiteBaker Community Forum
English
Archive (posts up to 2007)
(Moderator:
Argos
)
Amazon Module development
Pages: [
1
]
2
Go Down
Author
Topic: Amazon Module development (Read 10895 times)
snipe
Offline
Posts: 62
Amazon Module development
«
on:
January 19, 2006, 10:39:16 AM »
Hi gang,
I spent a few hours tonight working through the Amazon.Com XML and figuring out how to return what I want. I am using the single product call XML, for reasons explained in a moment - you can see how it works here:
http://www.snipe.net/indigo/books.php
The actual product display row is controlled via a template, so it should be nice and easy to customize.
I have NOT worked on the admin at ALL yet, so this is more of a discussion about an upcoming module than anything else.
The plan is this:
In the admin, have a form allowing the user to paste in an ASIN/ISBN. The script will then contact Amazon.Com, asking for the appropriate XML response, and then parse the data, inserting it into mySQL, including (but not necessarily limited to): product name, publisher, authors, image, list price, new price, used price
The affiliate url is automagically generated, and the admin settings will (hopefully) have several configurable options, such as amazon tld, admin defined categories, Amazon affiliate ID (required), Amazon Subcription ID (required), what size image to display, and whether or not to show all fields (like used prices, etc).
The good news is that the messiest part is over. The bad news is that I haven't dealt with the WB administration aspects of the modules yet, so I have a little code searching to do.
I'll update as I make progress - feel free to post ideas or requests, though no promises tht requests will be handled for the first release.
Logged
-- snipe
snipe.net · phpchick.com · everydayactivist.co
m · snipegallery.com
kweitzel
Forum administrator
Offline
Posts: 6817
Re: Amazon Module development
«
Reply #1 on:
January 19, 2006, 11:01:15 AM »
way to go snipe .. looking forward to the module ...
cheers
Klaus
Logged
WebsiteBaker Org e.V. - for WebsiteBaker
snipe
Offline
Posts: 62
Re: Amazon Module development
«
Reply #2 on:
January 19, 2006, 11:08:20 AM »
Thanks Klaus
Necesssity is the mother of invention, and it happens that I need an amazon module - and since no one has written one yet.....
Some other ones I have in mind are:
Random quotes module
Glossary module
I know there are more, but I am too pooped to remember them
That said - I need to take a break and go to bed now - I have to work in 4 hours.
Logged
-- snipe
snipe.net · phpchick.com · everydayactivist.co
m · snipegallery.com
bhhenry
Offline
Posts: 51
Re: Amazon Module development
«
Reply #3 on:
January 19, 2006, 11:10:02 AM »
I like to keep a "Reading List" on my personal site of what I have read, am reading, and plan to read. The admin defined categories would would be great for that.
It would also help to be able to add properties for each book, for example a text field for a mini-review.
Thanks for the good work!
Logged
snipe
Offline
Posts: 62
Re: Amazon Module development
«
Reply #4 on:
January 19, 2006, 11:14:14 AM »
Thanks for reminding me! One of the config options I was considering is to 1) include the amazon.com description 2) include an admin-defined text description or 3) both.
I'll have to see how progress goes - I'd like to get a working module finished by the end of the week, but it may not have all the bells and whistles mentioned here.
Logged
-- snipe
snipe.net · phpchick.com · everydayactivist.co
m · snipegallery.com
snipe
Offline
Posts: 62
Re: Amazon Module development
«
Reply #5 on:
January 19, 2006, 11:15:42 AM »
I also need to look into Amazon's error responses, so that I can provide a graceful error message if the ASIN/ISBN can't be found.
Logged
-- snipe
snipe.net · phpchick.com · everydayactivist.co
m · snipegallery.com
bupaje
Offline
Posts: 519
Re: Amazon Module development
«
Reply #6 on:
January 19, 2006, 10:21:09 PM »
Hey one of my requests wohoo!
I tried mucking around with that and changing it from the old token system to the new subscription ID but I'm not a coder so just wasted several hours.
On the error response how about redirecting to a page with the amazon search box and/or maybe related searches -ie. if visitor searches for an art book from my site and it gets an error return a page with search box and a 'you may like these related books'
Logged
My Blog, My Site
snipe
Offline
Posts: 62
Re: Amazon Module development
«
Reply #7 on:
January 19, 2006, 10:44:02 PM »
The user will never run into an Amazon.Com error - only the admin creating the book record will. When the admin enters and ISBN/ASIN number, the administration module will grab the corresponding info from Amazon and insert it into the mySQL table - so the only time the module ever talks to Amazon is that first time when it's gathering info, and even then, that's really just to save the admin from having to copy+paste a bunch of details about the product they want to display. Do you see what I mean?
I started using Indigo as a basis for the app, but honestly, the code is pretty messy and the Amazon.Com array structure has changed since they released it, so it's not a good core to use anyway. I am using their XML parsing class, just because its easier than writing one from scratch, but that's the only part that's worth salvaging.
Logged
-- snipe
snipe.net · phpchick.com · everydayactivist.co
m · snipegallery.com
bupaje
Offline
Posts: 519
Re: Amazon Module development
«
Reply #8 on:
January 19, 2006, 11:11:41 PM »
Ahhh, thanks for the explanation. There are some other popular ones here
http://www.chipdir.nl/amazon/
and I had used them briefly on an old site -worked well- but they all use the token system as well and I couldn't figure out how to fix that and make them work with WB.
I am using CaRP
http://www.geckotribe.com/rss/carp/
to insert some amazon on my site
http://www.stormvisions.com
and their is a free version - paid one is pretty cheap as well. It doesn't offer pagination and I don't know how to code it -I like CaRP overall just want to add a fuller store for music, books and software.
Logged
My Blog, My Site
snipe
Offline
Posts: 62
Re: Amazon Module development
«
Reply #9 on:
January 19, 2006, 11:21:18 PM »
I typically use Magpie for RSS feed display, but whatever works is alright
The idea behind this is that the Amazon.Com RSS only comes into play during the initital creation, and then it relies on mySQL to actually store and display product info to the user. I prefer this for one of a few reasons, not the least of which being that if Amazon.Com's services are ever down, you don't end up with errors displaying on your site, etc. It also *seems* to me that Amazon would prefer you not access the RSS a bazillion times a day, but I could be wrong about that. Their AWS site isn't particularly helpful in some respects. Plus, it looks like some of their webservices are paid, and if they ever transition into a "you pay for x number of RSS accesses", that could be a real drag. So using this method, mySQL handles all the dirty work and the RSS is only involved at all to make administering the bookstore easier. (If the admin RSS cannot find the book while it's being created in the admin, I will have to have the ability to enter in your own text as well.
Logged
-- snipe
snipe.net · phpchick.com · everydayactivist.co
m · snipegallery.com
bupaje
Offline
Posts: 519
Re: Amazon Module development
«
Reply #10 on:
January 20, 2006, 12:23:11 AM »
Sounds great, I am down to try this when it is ready - thanks.
Logged
My Blog, My Site
snipe
Offline
Posts: 62
Re: Amazon Module development
«
Reply #11 on:
January 20, 2006, 04:19:07 AM »
Can anyone who uses a non-us version of amazon.com's affiliate program post an affiliate product url or two, so I can see the syntax?
I have tested the code I have so far, and it works fine with non-book products:
http://www.snipe.net/indigo/books.php?asin=B0001CKSIG
http://www.snipe.net/indigo/books.php?asin=B00068EDUY
(The empty fields will not be displayed in the finished module.)
Logged
-- snipe
snipe.net · phpchick.com · everydayactivist.co
m · snipegallery.com
snipe
Offline
Posts: 62
Re: Amazon Module development
«
Reply #12 on:
January 21, 2006, 07:39:35 AM »
Quote from: snipe on January 20, 2006, 04:19:07 AM
Can anyone who uses a non-us version of amazon.com's affiliate program post an affiliate product url or two, so I can see the syntax?
Anyone? Anyone? Bueller? Bueller? I don't have a non-US affiliate account, so I need some help with this.
I have finished the admin module - all that's left is the public display, testing international settings, and rechecking the installation since I have madew a few changes to the tables.
Logged
-- snipe
snipe.net · phpchick.com · everydayactivist.co
m · snipegallery.com
kweitzel
Forum administrator
Offline
Posts: 6817
Re: Amazon Module development
«
Reply #13 on:
January 21, 2006, 08:31:37 AM »
sorry, don't have an affiliate account yet .... but give some time ...
Logged
WebsiteBaker Org e.V. - for WebsiteBaker
snipe
Offline
Posts: 62
Re: Amazon Module development
«
Reply #14 on:
January 21, 2006, 10:46:03 AM »
Okay, this module is effectively done - you can see the public demo here:
http://www.snipe.net/content/php_stuff/books.php
I installed and uninstalled, then reinstalled, and everything seems to be working okay - all except for the help file, which is mysteriously blank. As soon as I get that sorted I'll upload the module for your enjoyment.
Logged
-- snipe
snipe.net · phpchick.com · everydayactivist.co
m · snipegallery.com
kweitzel
Forum administrator
Offline
Posts: 6817
Re: Amazon Module development
«
Reply #15 on:
January 21, 2006, 10:56:58 AM »
it looks great!
Have signed up for a partner account. Then I am going to test your module ... again, give me some Tie for testing please ...
cheers
Klaus
Logged
WebsiteBaker Org e.V. - for WebsiteBaker
snipe
Offline
Posts: 62
Re: Amazon Module development
«
Reply #16 on:
January 21, 2006, 11:32:08 AM »
All set - the completed module thread is here:
http://forum.websitebaker.org/index.php?topic=2294
Logged
-- snipe
snipe.net · phpchick.com · everydayactivist.co
m · snipegallery.com
bupaje
Offline
Posts: 519
Re: Amazon Module development
«
Reply #17 on:
January 22, 2006, 06:31:27 AM »
Hey snipe, thanks for this. Doesn't seem to install correctly for me. It does add a page and the settings main page is there but no settings available and I get "Table 'wb.wbmod_amazon' doesn't exist"
Thanks for your work on this.
Logged
My Blog, My Site
snipe
Offline
Posts: 62
Re: Amazon Module development
«
Reply #18 on:
January 22, 2006, 07:17:32 AM »
What do you have set as your WB table prefix in your settings? And did the other tables create successfully?
Logged
-- snipe
snipe.net · phpchick.com · everydayactivist.co
m · snipegallery.com
snipe
Offline
Posts: 62
Re: Amazon Module development
«
Reply #19 on:
January 22, 2006, 07:22:38 AM »
I think I found the bug - uninstall that version and install this one, and let me know if it works OK
«
Last Edit: January 22, 2006, 07:29:56 AM by snipe
»
Logged
-- snipe
snipe.net · phpchick.com · everydayactivist.co
m · snipegallery.com
kweitzel
Forum administrator
Offline
Posts: 6817
Re: Amazon Module development
«
Reply #20 on:
January 22, 2006, 10:56:21 AM »
Hi snipe,
I sent you a link of amazon.de. Did it help you?
Now the problem I have is following:
The module installs fine. I go into the settings and there it starts.
I don't get the "Subscriber ID" and the "Affiliate ID" from Amazon, but 2 other ID's called Partner ID and Accountnumber.
Trying to put them in to the fileds you created (tried both ID's in any of the fileds, in amazon.com and amazon.de) I get following error:
Code:
[function.fopen]: failed to open stream: Operation not permitted in /usr/home/users/22/kweitzel/www/wtz.safewebspace.com/mobile-gaming/modules/amazon/clsParseXML.php on line 86
Warning: feof(): supplied argument is not a valid stream resource in /usr/home/users/22/kweitzel/www/wtz.safewebspace.com/mobile-gaming/modules/amazon/clsParseXML.php on line 87
Warning: fread(): supplied argument is not a valid stream resource in /usr/home/users/22/kweitzel/www/wtz.safewebspace.com/mobile-gaming/modules/amazon/clsParseXML.php on line 88
Warning: feof(): supplied argument is not a valid stream resource in /usr/home/users/22/kweitzel/www/wtz.safewebspace.com/mobile-gaming/modules/amazon/clsParseXML.php on line 87
Warning: fread(): supplied argument is not a valid stream resource in /usr/home/users/22/kweitzel/www/wtz.safewebspace.com/mobile-gaming/modules/amazon/clsParseXML.php on line 88
Any Suggestions?
cheers
Klaus
Logged
WebsiteBaker Org e.V. - for WebsiteBaker
bupaje
Offline
Posts: 519
Re: Amazon Module development
«
Reply #21 on:
January 22, 2006, 05:08:05 PM »
It works perfectly! Thanks. Very cool. This will be a big help in promoting WB for content sites and I hope you keep supporting this.
Only think I note is a slight delay with the record test p[roduct I added in presenting the page -can the images be cached locally instead of pulled from Amazon?
EDIT: Answered my own question, I can change the url. Does this pull info from amazon for every page view -aside from the image? I saved it locally but the pages seem to render slower than others on my site.
«
Last Edit: January 22, 2006, 05:18:06 PM by bupaje
»
Logged
My Blog, My Site
bupaje
Offline
Posts: 519
Re: Amazon Module development
«
Reply #22 on:
January 22, 2006, 07:07:03 PM »
Ok, my web hosting company had an optional database tool and I used the 'optimize tables' option which seems to have made the pages speed up. Thanks for this excellent tool!
Logged
My Blog, My Site
snipe
Offline
Posts: 62
Re: Amazon Module development
«
Reply #23 on:
January 22, 2006, 08:04:12 PM »
Quote from: kweitzel on January 22, 2006, 10:56:21 AM
Now the problem I have is following:
The module installs fine. I go into the settings and there it starts.
I don't get the "Subscriber ID" and the "Affiliate ID" from Amazon, but 2 other ID's called Partner ID and Accountnumber.
Honestly, I don't know how it works for the International versions. In the US, the affiliate ID is the ID you sign up for to get credit for the clickthrough. (You pick it yourself, if that helps) The subscriber ID is part of Amazon Web Services, and it's automatically assigned. Does that help at all? (Amazon.Com isn't particularly clear about why you need two IDs - but I do know that the subscriber ID used to be referred to as a Developer token, if that helps.)
Quote
Trying to put them in to the fileds you created (tried both ID's in any of the fileds, in amazon.com and amazon.de) I get following error:
Code:
[function.fopen]: failed to open stream: Operation not permitted in /usr/home/users/22/kweitzel/www/wtz.safewebspace.com/mobile-gaming/modules/amazon/clsParseXML.php on line 86
Warning: feof(): supplied argument is not a valid stream resource in /usr/home/users/22/kweitzel/www/wtz.safewebspace.com/mobile-gaming/modules/amazon/clsParseXML.php on line 87
Warning: fread(): supplied argument is not a valid stream resource in /usr/home/users/22/kweitzel/www/wtz.safewebspace.com/mobile-gaming/modules/amazon/clsParseXML.php on line 88
Warning: feof(): supplied argument is not a valid stream resource in /usr/home/users/22/kweitzel/www/wtz.safewebspace.com/mobile-gaming/modules/amazon/clsParseXML.php on line 87
Warning: fread(): supplied argument is not a valid stream resource in /usr/home/users/22/kweitzel/www/wtz.safewebspace.com/mobile-gaming/modules/amazon/clsParseXML.php on line 88
Any Suggestions?
Only thing I can think of is that your server doesn't permit fopen? The error "operation not permitted" implies that the server may have that function blocked for urls.
Logged
-- snipe
snipe.net · phpchick.com · everydayactivist.co
m · snipegallery.com
snipe
Offline
Posts: 62
Re: Amazon Module development
«
Reply #24 on:
January 22, 2006, 08:07:16 PM »
Quote from: bupaje on January 22, 2006, 05:08:05 PM
can the images be cached locally instead of pulled from Amazon?
EDIT: Answered my own question, I can change the url. Does this pull info from amazon for every page view -aside from the image? I saved it locally but the pages seem to render slower than others on my site.
The only time it pulls from Amazon.Com is when you're creating (or editing) the record itself and you use the Fetch tool. It grabs the info from the amazon.com url, and then populates the add/edit form. That is the ONLY time it talks to Amazon. Once you submit the form, the record is added to mysql, and it is served from mysql for all of the public page views.
Logged
-- snipe
snipe.net · phpchick.com · everydayactivist.co
m · snipegallery.com
Pages: [
1
]
2
Go Up
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> General Announcements
-----------------------------
English
-----------------------------
=> Help & Support
-----------------------------
General
-----------------------------
=> WebsiteBaker Website Showcase
-----------------------------
English
-----------------------------
=> Modules
=> Templates, Menus & Design
=> WebsiteBaker Language Files
=> Droplets (PHP code for use with Droplet module) & Snippets (raw PHP code)
-----------------------------
General
-----------------------------
=> Guest Area & Off-Topic
-----------------------------
English
-----------------------------
=> WebsiteBaker 2.x discussion
=> WebsiteBaker 3
-----------------------------
General
-----------------------------
=> Security Announcements
-----------------------------
Deutsch (German)
-----------------------------
=> Hilfe/Support
-----------------------------
General
-----------------------------
=> Documentation
-----------------------------
Francais (French)
-----------------------------
=> Help/Support
-----------------------------
Italiano (Italian)
-----------------------------
=> Help/Support
-----------------------------
Deutsch (German)
-----------------------------
=> Ankündigungen
=> Diskussion über WB
=> Off-Topic
=> Archiv für Themen bis 2007
=> Module & Snippets
-----------------------------
English
-----------------------------
=> Archive (posts up to 2007)
-----------------------------
Nederlands (Dutch)
-----------------------------
=> Aankondigingen
=> Hulp & Ondersteuning
=> Niet-Terzake (Off Topic)
-----------------------------
Deutsch (German)
-----------------------------
=> jQuery
=> Tutorials
=> Templates & Design
-----------------------------
English
-----------------------------
=> jQuery
-----------------------------
Bakery (WB shop module)
-----------------------------
=> Bakery English
=> Bakery Deutsch
-----------------------------
English
-----------------------------
=> WebsiteBaker 2.9
===> Announcements
===> Help/Support
===> Suggestions
-----------------------------
Deutsch (German)
-----------------------------
=> WebsiteBaker 2.9
===> Ankündigungen
===> Hilfe/Support
===> Vorschläge
-----------------------------
English
-----------------------------
===> Software bugs
-----------------------------
Deutsch (German)
-----------------------------
===> Softwarefehler
=====> Module / Extensions
-----------------------------
English
-----------------------------
=====> Modules / Extensions
-----------------------------
Deutsch (German)
-----------------------------
===> Erfahrungs und Testberichte
-----------------------------
KeepInTouch (Multi Contact Module)
-----------------------------
=> KeepInTouch English
=> KeepInTouch Deutsch
Loading...