Subject may be vague but let me explain.

I have two content types
[1] car content which holds some cck fields that carry data for a specific trim of a car: for example an (X5) trim of the BMW car, that content type has cck fields like (rim size, seat material...etc).

[2] listing content type has the same (rim size, seat material) cck fields along with other cck fields that doesn't exist in the "car" content type, and has also a "Trim" cck field which is a select list.

What I want to do is when selecting "X5" trim, all common cck fields (rim size, seat material) among the two content types will be auto populated or auto filled with values from the "car" content type.

Is this possible? please point me to the right direction, I have been searching forever without an answer.


drupalshrek’s picture

Hello, I'm sorry but I don't understand. Please try and explain more clearly. Give an example.


mas0h’s picture

Let me try to explain, we have like I said in my previous post two content types:

1- Car content type which has some fields of car specifications like (rim size, seat material, engine size, transmission type...etc) which are standard of a specific trim of a car brand. Take for example: BMW car brand --> fifth series, the fifth series itself comes with a variety of trims, each trim has different specs than the others regarding those cck fields, so the first trim has rim size of 17 inch, engine size is like 2000 cc, transmission type is autmatic for example, however the second trim has 19 inch rim size, engine size is 2800 cc, and transmission type is tiptronic. So every node in this content type will carry the specs of a trim.

2- the second content type is used when someone tries to add listing. This content type has the same cck fields as the "car" content type along with other cck fields which hold data like contact details, Driven KMs, and asking price.
and instead of providing all the previous data again which was already entered when creating a trim, he will only choose the trim cck field which will represent one of the trims from the "car" content type. Once he selects the trim, all common fields between the two content types gets auto filled or populated from the "car" content type.

I hope I have been clear enough this time.

WorldFallz’s picture

instead of duplicating the data, you could just use an entityreference field and format the entityreference to display the info from the parent type. Alternatively, you could use entityreference_prepopulate to actually duplicate the values. I usually use the first method, but it all depends on whether or not you want to normalize the data.

mas0h’s picture

Thanks WroldFallz! your first method is exactly what I needed, I will give it a try and get back to you with results and questions :)

mas0h’s picture

I know this is old, but you mentioned that I could duplicate values from the referenced entity fileds with entityreference_prepoplute, could you please describe how this could be done.

As I understand entity referecne prepopulate only allows prepopulating the reference filed itself in the destination node>
What I wanna achieve is to prepopulate fields in the destination node (form) from the values from the source (refrenced) entity or node.

mas0h’s picture

First problem is search or views filter! now I have "listing" content type which has a "Trim" cck field which is an entity reference to "car" content type, The "car" content type itself contains fields like "rim size, engine size, and transmission type" which are term reference cck fields ( referenced to taxonomy terms ).

Is there a possible way to make a views filter to show listings based on say "rim size" taxonomy term?

WorldFallz’s picture

Just add a relationship for the referenced entity-- then you'll have access to its fields to use in views like the main entity.

mas0h’s picture

Thanks bro! it worked.