I am trying to use Feeds module to create amazon item nodes (created by adding the ASIN cck field to a given node type). I have a csv file that lists amazon products with info such as Product Title, Manufacturer, ASIN. However, when I configure the importer to to map the fields form the csv file to the target fields in the amazon item, the ASIN field does not show up in the drop down. It appears that the Feeds module does not recognize the special ASIN cck field and cannot perform the mapping.

There is an API for the Feeds module that handles mapping to specialized content types and their fields. I just don't know the Amazon module and Feeds module well enough to utilize the API's. Below is the hook from the Feeds module that is supposed to handle the mapping.

/**
* Alter mapping targets for nodes. Use this hook to add additional target
* options to the mapping form of Node processors.
*
* For an example implementation, see mappers/content.inc
*
* @param &$targets
*  Array containing the targets to be offered to the user. Add to this array
*  to expose additional options. Remove from this array to suppress options.
*  Remove with caution.
* @param $content_type
*  The content type of the target node.
*/
function hook_feeds_node_processor_targets_alter(&$targets, $content_type) {
  $targets['my_node_field'] = array(
    'name' => t('My custom node field'),
    'description' => t('Description of what my custom node field does.'),
    'callback' => 'my_callback',
  );
}

I was wondering if anyone could somehow write a plugin for the amazon module that will expose the ASIN cck field to the Feeds module for mapping during csv import. Please let me know your thoughts on this, I am looking forward to hearing back.

Best,
-Bao

Comments

rfay’s picture

This seems like a useful feature to me.

rfay’s picture

Status: Active » Needs review
StatusFileSize
new1.8 KB
new2.09 KB
new1.67 KB

OK, this patch provides the necessary glue in the asin module. It turned out to be exactly as you pointed to.

It seems that feeds does not support multivalue fields, but single ASIN elements work fine.

Attached are the patch, a feature (you need http://drupal.org/project/features) that demonstrates a feed using Amazon, and a sample CSV file that can be used with the feature.

rfay’s picture

Status: Needs review » Fixed

Committed to DRUPAL-6--1: http://drupal.org/cvs?commit=396196
and to HEAD: http://drupal.org/cvs?commit=396200

Setting to fixed, but of course that only means if you don't have a problem with it :-)

Thanks for your sponsorship on this fix, @Bao. This will show up in the dev release on the next packaging interval, or you can use the patch if you're in more of a hurry than that.

Status: Fixed » Closed (fixed)

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

f16viper’s picture

Version: 6.x-1.0 » 7.x-1.0-beta5
Category: feature » bug
Status: Closed (fixed) » Needs work

This appears to have broken in Drupal 7 - the ASIN field dropdown is no longer available in the feeds module

rfay’s picture

Feeds wasn't available at the time of the D7 port, so I'm not surprised.

michaelfoggin’s picture

Version: 7.x-1.0-beta5 » 7.x-1.x-dev

Hmmm... Just found this which is a bit of a shame as I'm three weeks into a D7 migration project :D

Is this planned for fixing or should I be raising a bug on the Feeds module?

Ta,

Mik

rfay’s picture

Patches are welcome, but I don't believe either of us has looked at this yet and don't know when we'll get to it.

soup1977’s picture

Any chance you could share how you are getting a CSV file of ASIN numbers? I've looked high and low trying to find a script that will pull in a list of ASIN numbers for a certain category from Amazon. I'm not savvy enough to write my own script.

rfay’s picture

Go to http://browsenodes.com and visit a node that you want. For example, http://www.browsenodes.com/node-1.html

There's a link "List product ASINs for aStore". Do that. And it has instructions on how to get a csv.

Of course, you could make a CSV manually - Using Views or perhaps searching, or by using Amazon itself.

rfay’s picture

Status: Needs work » Needs review
StatusFileSize
new2.73 KB

Finally, here's the feeds for D7.

rfay’s picture

Status: Needs review » Fixed

Committed: 68088ac111c026cd662730837fcc63453eeac693

Status: Fixed » Closed (fixed)

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