Will this module eventually work for 13 digit ISBNs since 13 digit ISBNs are becoming the industry standard and 10 digit ISBNs are already being phased out?
Connie
| Comment | File | Size | Author |
|---|---|---|---|
| #30 | amazon.isbn13fix.patch | 1.74 KB | rfay |
| #27 | amazon.EANandAmazon.com_links.patch | 3.74 KB | rfay |
| #26 | 13digitTO10digit.zip | 871 bytes | conniec |
| #8 | amazon.patch | 9.55 KB | Anonymous (not verified) |
| #3 | amazon_ean_support.txt | 9.45 KB | mleicester |
Comments
Comment #1
tcblack commentedIn my tests I have not been able to get a 13 digit ISBN to work yet, but may be related to http://drupal.org/node/302721
Comment #2
conniec commentedTest the patch from the above node and no luck on my site. 13 Digit ISBNs still won't work
Connie
Comment #3
mleicester commentedThe Amazon ASIN number is often identical to the same product's ISBN-10 number. However, they are different things. My understanding is that products with 13 digit ISBNs (EANs) also have a 10 character ASIN. For more about the relationship between ISBN-13 numbers and ASINs, read https://affiliate-program.amazon.com/gp/associates/help/t5/a16.
Attached is a patch that implements a lookup for 13 character EANs for the ASIN CCK field. The lookup will validate and convert EANs to ASINs on save (converted during the presave op in hook_field). This lookup uses the Amazon API and therefore has the advantage of being an 'official' conversion from EAN to ASIN. You may also test EAN lookups in the admin test interface. This patch also wraps up the one-line fixes at #302721: Amazon field rejects any product ID. Amazon API test feature works fine though. and #329463: Force fetch when testing ASINs via admin interface.
In most locales, when looking up EANs, you must also specify the search index (e.g. "Books"). This patch adds the ability to configure which search index is used for EAN lookups on the module settings page. Possibly this should be configurable per instance of the ASIN CCK field.
Note: this patch applies against DRUPAL-6--1 but there's no release for 6.x-1.x-dev. It won't apply to 6.x-1.0-beta3.
Comment #4
mleicester commentedComment #5
conniec commentedLove this patch! Works great for me.
Found a small error. Amazon.module has an extra } at the end of the replacement code.
Hand-applied to alpha5, BTW
Connie
Comment #6
kevcol commentedYour patch worked like a charm for me. (The first patch I've ever installed, btw.) Thanks much!
Comment #7
Anonymous (not verified) commentedWorks for me, thanks :)
It would be perfect to allow the inclusion of "-" in the ISBN (e.g. 978-3150106822 instead of 9783150106822) as this is nearer the "default" format, but that is a matter of minor importance.
Comment #8
Anonymous (not verified) commentedAttached is an integration with the patch from #338097: CCK amazon field says that Amazon ID 1591840562 cannot be found but it is retrieved and put in the database as this is more likely to preserve ASINs formatted like numbers.
Comment #9
rfayThanks for your work on this, and for being willing to contribute.
I'm concerned about the extent and complexity of this patch and would like to discuss it further. I also hate to trigger the child requests to Amazon.com that are a significant performance hit.
Note that Amazon Store has the categories already managed for all locales... Perhaps that should move into Amazon.
Interested in the discussion, here or on IRC. I'm often on.
Comment #10
Anonymous (not verified) commentedAppologies for the delay - I was away for two weeks and in contradiction to my plans had no internet-access available... I will look at the patch again tomorrow and report back ;)
Comment #11
superxain commentedI hope the ASIN field would accept data format like "0-672-32884-4 " (just remove all dashes and spaces automatically ). A quick dirty hack to do the job also will be welcome.
Comment #12
svogel commentedI just managed to put in the changes into the beta-10 and it works again with 13-digit ISBNs. But according to lots of changes in beta-10 it wasn't as easy as supposed to.
I would strongly suggest to put this patch into the destribution as it improves the amazon-module a lot.
Best regards
Stefan
Comment #13
rfay@svogel, do you have a patch to contribute?
Comment #14
conniec commentedhi all,
I haven't done anything in Drupal for a while and am updating some sites.
Has anyone figured out how to convert 13 digit ISBNs into 10 digit ones? Does the Amazon Store module to that for us?
Stefan, which patch did you use?
Connie
Comment #15
rfayAmazon's API is about ASINs, so this module is also focused around ASINs. Amazon started out as a book company, and they based their identifiers around ISBNs, which were 10 digit. Well, they're stuck there.
You can read about this issue at this link. It looks to me like it would be complicated and beyond the scope of this module to do 13-digit ISBNs.
Comment #16
conniec commentedThanks, Ray, for the quick reply.
I don't know how to make patches but I have a php program that will converet 13 digit ISBNS to 10 digit ISBNs if that will help anyone. But that means changing the ISBNs one by one.
Connie
Comment #17
rfay@conniec, I don't know everything about 13-digit ISBNs, but did you read the Amazon link about 13-digit ISBNs carefully? Your code must not just convert into a 10-digit ISBN, it must convert to the correct Amazon ASIN. If you have confidence you can do that, then I'm interested.
The patch in #8 does try to do this, and the ideas there, if they work, might end up working.
Comment #18
conniec commented@Ray, I've read the link and right now, my conversion works for all ISBNs that start w/ 978. There is no conversion for ISBNs that start w/ 979, I understand. That's a future worry but it doesn't seem to affect most books right now, that I can tell. Shall I send you my conversion code?
I found this interesting (it's on the linked Amazon page)
--Is there an automated way to create Associates links if I have the 13-digit ISBN?
Yes. You can programmatically generate Associates links from 13-digit ISBNs using the E-Commerce Service (ECS) from Amazon Web Services. The ECS ItemLookup function allows you to look up items using an ASIN, international article number (EAN), or other identifiers. The Web Services team updated this function to treat 13-digit ISBNs as EANs so you can use the function to look up a book either using its 10-digit ASIN or its 13-digit ISBN. --
Is there any usable info in the above para?
I don't understand Drupal programming, but will be delighted to be your test subject should you think there is merit in digging into this.
BTW, I had the #8 patch working satisfactorily on my site until we had to upgrade for Amazon's two identifiers.
Comment #19
volantis commentedI'm using amazon.module revision 1.27.2.23 and I'm getting "Invalid argument supplied for foreach() in /home... on line 348 when using the ten and thirteen digit ASINs. This happens for both test and for live pages. I'm using Drupal 6.14. Is there something I'm missing in the setup, or is this a bug?
Comment #20
rfay@volantis, there's no revision of that number in amazon module.... Or amazon_store.
I imagine you're testing with amazon and you don't have your AWS credentials configured. Your issue is going to be #608624: Test should detect and report invalid credentials. Please make sure to get an Amazon AWS account, configure the credentials, and then use a valid ASIN to test with (a 13-digit is not valid)
@conniec: I'm glad you're interested in this. I'll consider doing it, or maybe @tirsales will come back in with a current patch. The problem is that it requires a separate lookup just to get the ASIN, so is definitely a different thing.
Comment #21
volantis commented@rfay
Actually, I did fill in the AWS credentials when I created the AWS account. However, I went back again after your comment to see if I copied them correctly. The credentials that I saw upon registering were completely different from the credentials I just saw. Other site administrators new to the Amazon Module in the future will want to check the information on the Your Account:Security Credentials page at aws.amazon.com. After changing to the right credentials, everything works fine.
Comment #22
conniec commented@rfay thanks for keeping the ISBN 13 to 10 conversion on your radar screen. Let me know how I can help.
Comment #23
rfayI took a look at this tonight and feel like it's a bit destabilizing just as we're getting to a 1.0 release. I kind of feel like we're hacking at it and may need to step back.
Any complete solution should handle 13-char ASINs in
I don't think I'm open to a new table that would map 13-digit ISBNs to ASINs, but that would be one way to do this.
The patches in #3 and #8 are decent working patches (out of date, of course), but they don't improve the overall quality of the code - they're workarounds to make the 13-digit ISBN work. Neither of those patches handles the database lookup (which is always by ASIN).
I think perhaps we should be looking at an "amazon_ean_mapper" module that we could add on. It could even maintain its own database table that mapped 13->10. It could intercept hook_filter calls... And it would be used only by those who want 13-digit EANs, so wouldn't have any impact on the code for the larger audience.
What do you say to this? Anybody rise to the challenge?
Comment #24
conniec commentedSounds good to me.
I don't know how to 'hook' into Drupal orhow to put coding into the proper format, but I will gladly give anyone my php program that converts 13 digit ISBN to 10 digit. Just let me know where to send it!
Again, many thanks, rfay, for all the time and thought you've put into this.
Connie
Comment #25
rfay@conniec, just attach it to a comment in this issue. Zip it up, or tar it up, and attach it.
I think probably the best approach might be a module that does hook_form_alter to alter the ASIN field's input and goes and gets the 10-digit when a 13-digit is entered. That would do it for the CCK route.
For filters, perhaps there's a way for an add-on module to hook_filter and capture before Amazon gets to it (or after).
Comment #26
conniec commentedHere it is. Let me know what I can do to help.
Connie
Comment #27
rfayWith this patch you can now use the following formats in either an Amazon ASIN field or a filter, and hyphens are stripped.
So there are now several more options for input formats.
Please test it out and let me know if I broke anything.
Committed to HEAD: This will be in the next dev release.
http://drupal.org/cvs?commit=312126
Comment #28
conniec commentedHurrah and many thanks. Just patched and am playing with it now.
Connie
Comment #30
rfayThe admin 'test' interface did not handle 13-digit ISBNs. It's updated in this patch.
Committed: http://drupal.org/cvs?commit=321336
Comment #31
svogel commentedUps, sorry. I haven't looked into this one a long time.
I have used the patch from @mleicester
http://drupal.org/files/issues/amazon_ean_support.txt
No I didn't have a working patch, I did this line by line.
Best regards
Stefan