When an ASIN type CCK node is inserted into the database, the amazon_item table does not get the proper rows inserted in it until the node is *viewed*. This only seems to become relevant when CCK nodes are created with node_save programmatically, as the items would be loaded accidentally by the validate op as well as the load op. So if nodes were being created with a standard form in the standard flow, they'd be populated.

It all becomes quite nasty when you're using a view with a relationship to ASINs. The relationship is normally "required". But if nodes have been entered with node_save(), the relationship can never be created until the nodes are views. But if the view is the primary way of viewing them, it can never happen.

To reproduce the bug:
1. Create a node view with a required relationship on ASIN.
2. Create an ASIN-type CCK node using node_save().

At this point, the amazon_item database will not be populated with the appropriate elements.

What I would expect: The amazon_item table would be populated with the rows related to the new node and the view would pick up the node I created.

What happened instead: The amazon_item table is not populated with rows related to my node. As a result, the view picks up nothing. However, just viewing the node (outside the view) will make the view start working, as the items are loaded into the table on node_load().

The attached patch resolves this issue by loading the items on the hook_field() insert and update ops.

Thanks for the great module!

CommentFileSizeAuthor
amazon_asin_field_insert_update_01.patch491 bytesrfay

Comments

rfay’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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