This issue is related to #392524: Add token support for automatic node title in that I'm trying to use auto_nodetitle and populate the node title with Amazon.com data.
The specific issue is that if a user enters a 13 digit ISBN/EAN or an ISBN with hyphens in it the node title will not populate upon the initial save. If the user returns to the node edit page, the ASIN field is formatted correctly and will then populate the node title as expected when saving again.
I'm using a variation of the code from the issue mentioned above in the Automatic title generation field:
$asin = strtoupper(_amazon_clean_type($node->field_review_asin[0]['asin']));
$_amazon = amazon_item_lookup($asin);
$amazon = $_amazon[$asin];
print $amazon['title'];
Everything works fine if a properly formatted ASIN is entered.
My suspicion is that something in the Amazon module is converting any improperly formatted input and retrieving the Amazon.com data AFTER auto_nodetitle looks for the item title to use.
I've tried installing Util and using Module Weights to move Automatic Nodetitles down in the list, but it seems to have no effect.
Is this where I should seek support for this issue or should I post in the Automatic Nodetitles issue queue?
Thanks.
Comments
Comment #1
rfayPlease provide the exact example that gives you trouble and give me the script I should run through to recreate it.
Thanks,
-Randy
Comment #2
tommyk commentedThanks for the offer to help.
Using a fresh Drupal 6 install, I turned on:
Amazon API
Amazon field
Amazon media
Amazon search (not sure if needed)
Content (CCK)
Content Permissions (maybe unnecessary for this test)
Text (maybe unnecessary for this test)
Search (core) (not sure if needed)
Automatic Nodetitles
1. created content type Review (review)
2. added CCK field "ISBN or ASIN" (field_review_asin) of type Amazon item with Widget type of ASIN or ISBN Text field
3. pasted the following code into Automatic title generation Pattern for the title field
4. checked Evaluate PHP in pattern box
5. create content Review
6. paste 978-0470429037 or 978-1430209898 or any other 13 digit ISBN into the field
7. save node
8. no title appears
9. edit node
10. do nothing (EAN has been converted to 10 digit in the field)
11. save node
12. title appears
13. test with 10 digit ISBN
14. create content Review
15. paste 1430209895 into field
16. save node
17. title appears
Hope this is what you need to make sure I'm not crazy.
=)
Comment #3
rfayI think this will work for you for making a title from a field. Here I'm using a field named field_isbn. You'll have to change yours accordingly, and change the default title, etc.
Comment #4
mudgil.gaurav commentedHi
Thanks for the information provided above.Can you please brief me in which file i need to
use the above code.To get the book title,author,price etc.
Please elaborate more.
Thanks
Comment #5
rfay#2 contains the basics including a step-by-step. This is a way to use the auto_nodetitle module to set the title based on an ASIN item.
Comment #6
mudgil.gaurav commentedHi,
Thanks for your quick response.Yes i gone through #2. But after step 3 i.e. pattern generation and onward i am not able to locate where to set the pattern.
According to #2 i created a field fld_isbn and fld_title.And for the fld_title set type data to store to "Node Reference" and form element to edit the data to "Automatic text field".
My requirement is i want to allow the user to add the books.When user fills the ISBN number then if the ISBN number is valid then other fields i.e. author,title,price should be auto populated in the corresponding
text fields.
Any help or suggestion would be greatly appriciated.
Thanks
Gaurav
Comment #7
rfayI think you're doing something beyond what auto_nodetitle can do - it can only set the title. But you can *theme* the other fields quite easily.
Comment #8
willvincent commented