Closed (fixed)
Project:
Amazon Product Advertisement API
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
5 Nov 2008 at 10:05 UTC
Updated:
31 Oct 2009 at 21:10 UTC
Currently there is no field to store a book's publication date (but there is a releasedate field, used with CDs). This patch creates an additional field called 'publicationdate' and adds views support. This patch also adds MySQL specific update code, relegating the PostgreSQL specific db_add_column for use only with PostgreSQL. I've altered the pre-existing update 6001 accordingly (applying a default value to the MPN column too).
| Comment | File | Size | Author |
|---|---|---|---|
| amazon_publicationdate.txt | 3.36 KB | mleicester |
Comments
Comment #1
gmak commentedI've added this patch successfully, but I'm not getting anything returned by the 'publicationdate' variable. It shows up the fields in the array when testing (using the Amazon API module configuration), but there is no data returned.
Is there still something missing?
Comment #2
mleicester commentedJust to confirm, you have run update 6002 for the amazon module? This update adds the publicationdate column into the amazon_item table. Without that the value won't be stored.
Comment #3
gmak commentedI now have the column publicationdate in the amazon_item table and some data has been populated into the field. however, how do I get this into my template?
I have been using the following for other fields:
<?php print $node->{0}['asin']; ?>but this:
<?php print $node->{0}['publicationdate']; ?>does not reveal the value.
Any suggestions?
Comment #4
mleicester commentedThe amazon_item_lookup_from_db function at line 309 of the amazon.module uses SELECT * such that all columns in the amazon_item table are added to the node object, where each field is named after the column in the database. Your code should work as it is, and indeed it does work for me. If you print_r the $node do you see the publicationdate field with a blank value, or is the publicationdate field completely missing?
Comment #5
rfay@mleicester, This patch looks worth doing. However, the hook_update_N must be a new hook. You can't retroactively change hook_update_N. Please re-roll.
Since it appears you are running PostgreSQL, a patch for #590360: Update and test PostgreSQL Support would be much appreciated.
Comment #6
rfayJust checking... publicationdate is a fully-supported field in the amazon_book table, and is fully supported in views.