在内容类型中使用2个字段 field_parent =参考术语 此字段引用词汇"父项"
我有一个名为'field_chich'的第二个字段。 该字段必须是"Field_parent" 术语的子项
样品： field_parent - ＆gt;苹果 Field_child - ＆gt;绿色在分类学中我看到了 苹果 - 绿色 梨 - 绿色
For a project i would like to achieve the following:
Using 2 fields in a content type field_parent = reference to term This field references to vocabulary 'parent terms'
I have a second field called 'field_child'. This field has to be a child term of the 'field_parent' term
sample: field_parent --> apples field_child --> green
in taxonomy I see Apples - green Pears - green
How can I achieve this? Is there any module available or snippet.
If your problem is with doing this via feeds (from your comment to me), I'd try the following:
It looks like you're already using the feeds module and that your incoming terms are mapped to your term reference. Good! It also sounds like you have a hierarchical vocabulary. Good.
Now, I'd just have one single term reference field on your node. No need to have one for the first level and one for the second level of your vocab. Just have ONE term reference field, and set that single term reference field to take an unlimited (or whatever number greater than 1) number of values in the 'Manage fields' page of your content type. (It won't just take one for the parent and one for the child, but both can be set once).
Download and install the Feeds Tamper module, which allows you to process results in various ways during the feeds import. Once your feeds tamper module is installed, when you go to /admin/structure/feeds, you should see a 'Tamper' link where you can configure your tamper settings.
For this to work properly, I'm assuming you can make your import file be in the form of 'Apples;Green' for the hierarchical terms -- i.e. that you can provide them in one column, separated by a special character, and that that column is mapped to your one single term reference field. If you can do that, then you can set your tamper to parse them out and set both the parent and child of the vocabulary this way.
Go to the 'Tamper' link, find the field that represents this taxonomy and select 'Add plugin'. Then select the 'Explode' plugin and specify the special character that will separate your parent/child terms.
Test with an import, and let me know if that gets it working properly....
I used the Hierarchical taxonomy module. Now I can import feeds with parent /child taxonomy using it AND the Feeds Tamper module. It works perfect; you only need one import run.