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).

CommentFileSizeAuthor
amazon_publicationdate.txt3.36 KBmleicester

Comments

gmak’s picture

I'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?

mleicester’s picture

Just 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.

gmak’s picture

I 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?

mleicester’s picture

The 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?

rfay’s picture

Status: Needs review » Needs work

@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.

rfay’s picture

Status: Needs work » Fixed

Just checking... publicationdate is a fully-supported field in the amazon_book table, and is fully supported in views.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.