CCK Fields
BonDotts - May 16, 2008 - 19:30
| Project: | Aggregation |
| Version: | 5.x-4.3 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I am consuming an RSS feed that has custom, namespaced item nodes. I am trying to get two of the node values into CCK fields I created for the aggregation_item.
My idea was to create a custom handler for the feed. Then, create some code similar to how the $other array is being used...
$cck = array();
if ($c->formID)
$cck['field_formID'] = "{$c->formID}";
if ($g->id)
$cck['field_id'] = "{$g->id}";
I then modified the aggregation_add_item call and included the $cck array. My issue is where and how iterate over the $cck array in the aggregation_add_item function and enter the values into the CCK fields.
Thanks

#1
This can be closed out. In case anyone has extended their RSS feeds, I did the following...
In the aggregation.module file, changed the aggregation_add_item function to expect an additional passed parameter:
function _aggregation_add_item($title, $body, $teaser, $original_author, $feed,
$additional_taxonomies, $timestamp = NULL, $original_item_url = NULL, $guid = NULL,
$image_array = NULL, $other = NULL, $cck = NULL)
At line 1364 (after the foreach iteration of $other), added:
if (!is_null($cck))
foreach ($cck AS $key => $val)
$item_object->$key = array(array('value' =>$val))
Then in my custom handler, added:
$cck = array();
if ($c->formID)
$cck['field_formid'] = "{$c->formID}";
if ($c->content_type)
$cck['field_contenttype'] = "{$c->content_type}";
Obviously, you need to create the CCK fields in the Feed Item content type.
#2
I'm trying to parse the followings values! in a node form
<seller> , <auction_type>, <currency> , <price>, <bids>, <auct_end>, ...so I created the cck fieldsfield_seller, field_code , field_aution_type .......i did exactly what you posted in here . ., but i still can not make it work.
I have some questions.
if not, could you plz help me out , to write my costume handler?
example: assuming that my xml tag and cck field looks like this
<seller></seller> -- field_seller$cck = array();if ($c->seller)
$cck['field_seller'] = "{$c->seller}";
if ($c->content_type)
$cck['field_contenttype'] = "{$c->content_type}";
is that what you mean?
well any ways i have try it in both and not succes yet.
---
thx
#3
also! any Idea on how to get an xml attribute
< item id="7288288">to a cck field?