Hi All, Merry Christmas
I am using the excellent feeds module and I am trying to set up some feeds, I have a content type with a cck selection field where I can choose a b c d and so on, I would like each imported node to retain the setting I choose in this field.
Is there anyway to get the feeds module to recognise the value of this cck field and copy it across to each of the nodes it creates when importing my rss, im guessing i need a bit of custom code to do this but not sure where to start my field is called field_story_forces, I see I can import some of the parent values so would just like to add this CCK value as well..
The type is a checkbox radio button
Many Thanks, any help will be very greatfully received
Gibbo
Comments
Hi AllCan anyone tell me how
Hi All
Still trying to solve the problem, have a look at the nexk post to see how far i ve got so far and see if you can help me out :)
Many Thanks
Gibbo
Figured it out
Hi
I ve got a bit closer to what I am trying to do,
I ve figured out how to pass a cck field from the parent now (I think) but feels a bit of a poor way to solve this problem
<?php
/**
* Implementation of hook_feeds_parser_sources_alter().
*/
function feedscck_feeds_parser_sources_alter(&$sources, $content_type) {
$sources['cck_importer_reference'] = array(
'name' => t('Feed node: CCK_Field'),
'description' => t('Import my CCK field with feeds'),
'callback' => 'feedscck_feeds_get_source',
);
}
/**
* Callback, returns cck field content of the parent feed node.
*/
function feedscck_feeds_get_source(FeedsImportBatch $batch, $key) {
if ($node = node_load($batch->feed_nid)) {
$mycckfield = $node->field_cck_text[0]['value']
return $mycckfield;
}
}
/**
* Callback for mapping.
*/
function feedscck_feeds_set_target($node, $key, $language) {
$node->field_cck_text[0]['value'] = $mycckfield;
}
?>
Can anyone tell me what the line
$sources['cck_importer_reference']
actually means as cck_importer_reference doesnt go anywhere
Also if there is a better way to do this i d be very greatful
Would be ideal if I could get this to recognise the cck fields available instead of hard coding it
Many Thanks
Gibbo