Skip Navigation

[Resolved] Importing CSV information for a Many to Many posts relationship

This support ticket is created 6 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 6 years, 3 months ago.

Assigned support staff: Luo Yang.

Author
Posts
#448850

Hello,

I am trying to Create a woocommerce car parts site but i can't figure out how to solve a problem.

My problem is that I don't know how to relate products with car models. I was thinking to use the many to many relationship, through an intermediary called "position", wich is a custom number who refers to an equivalence among products, and it is a regular reference to us to know wich part can be use in wich car.

My car database has 3 Fields, Make, Model and Engine; I was thinking to create a post type called "Vehicles", each vehicle will use a custom taxonomy called "Make", finally another custom Post Type called "Engine", wich will be child of "Vehicles".

My problem is when i'm relating Products with Engines , i don't know wich "Vehicle" im relating to, because some different Vehicles use the same Engine.

I also was thinking about using "Position" as a parent instead of a child, so it would be a one to many relationship, but i dont know how it would work.

There is another thing, i need to import all this information, im using "WP all import plugin" to do this, so i have 2 different Databases, one for products and other for Cars, by the way, each of this databases contains a column with "Position" field for each car and each product.

PS: I can reconfigure all databases to a better setup according to your advice.

Could you help me solve this? do you know a better way to achieve this?

Best Regards

#449035

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Dear Diego,

There are two kinds of many-to-many relationships within Types plugin:
1) the intermediary object is a custom post type
2) the intermediary object is a custom taxonomy

In your case, I suggest you try the second way: use a custom taxonomy as the intermediary object.

For example, you can create three custom post types: Make, Model-cpt and Engine-cpt
Two custom taxonomy: Model and Engine
register taxonomy "Model" to post type "Make" and "Model-cpt"
register taxonomy "Engine" to post type "Make" and "Engine-cpt"

Then follow our document to setup the csv file, and import it into database:
https://toolset.com/documentation/user-guides/how-to-import-content-into-wordpress-using-csv/

#449194

Thank you Lou, i like that option better. I have a couple of questions about it.

Those CPT will be connected through the taxonomy automatically, or should i connected in an other setting?

I guess, then i'll need to create 2 different custom views to show products or cars, through the Custom Intermediary Taxonomy?

#449573

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Q1) Should i connected in an other setting?
You will need to connect them manually,

Q2) i'll need to create 2 different custom views to show products or cars, through the Custom Intermediary Taxonomy?
You can setup nested view to get the related "Model-cpt" posts and "Engine-cpt" posts in a single "Make" post.

For example, in the a single "Make" post, create a nested view to display the "Model-cpt" posts:
1) Parent view, list terms of taxonomy "Model", filter with:
Taxonomy is set by the page where this View is inserted

2) Child view, list "Model-cpt" posts, filter with:
Select posts with taxonomy:
Categories set by the parent Taxonomy View

Same as above, you can create another nested view to list related "Engine-cpt" posts in a single "Make" post.