Hello,
I have the following scenario, i have course content type,every course has instructors ( i have instructor_name and instructor_id and language), and i have instructor content type. all my content is provided in two languages.
edit: im importing data using feeds xpath parser
One issue i have is that the instructor name cck field in course is formated as "first_name middle_name grandfather_name last_name", but instructor content type name/title is "first_name last_name".
I was planning to associate instructors as taxonomy to course content type, and use NAT module to associate it with instructor nodes! but as you can see , name would not work!
a better approach would be (i think) is to use instructor_id (which is unique if combined with language) as a reference, so i want something like NAT but that references a cck field instead of title! how can i do that ?
edit: i understand now that node reference is the way to go (although i could fix the incoming feed and use NAT), but how to use instructor_id from the feed to create node reference when importing feeds, i have the code to retrive the node id of the instructor with a given instructor_id, i just cant figure where to put it in use :S
Comments
.
Activate the Node Reference module (it's default in CCK) and use a node reference field.
Raf, the problem is that i
Raf, the problem is that i want to "automatically" reference a node, and based on a cck field of that node and not its title !
.
I think what i need to do is the following:
# read feed and fill fields (using feeds and xpath parser)
# on submit, make default value for another field be obtained by processing a value of a field given in first step, this involves writing an sql query to select node ids which have a cck field with the same value as the the one we got using feeds.
of course im stuck with the code part, and im not sure yet this will work. i was hoping i can solve this with referencing a view and passing the value from feeds to it ... but i could not get that to work
UPDATE: Using php_compute plugin for feeds_tamper( http://drupal.org/node/951336 ) allows me to get the nid, but so far im unable to handle multiple values.UPDATE: Ive done this now using feeds_tamper, writing a customized plugin that does the SQL query and returns the values!
Have the same issue here, can you help
Kind off issue on my side, is it possible to share your customized plugin?