Hi.
I have a question about relation of custom types:
Accesories ans cars
Accesories have
1. Image
2. reference
An example of a list of accesories are
spare 3345
spare 3346
spare 3347
mirror 2
mirror 3....
pilot 1
pilot 2
pilot 3
chasi sidewinder
chasis anglewinder
motor 2
motor 3
motor 4....
Cars have
1. Reference
2. Image
4. sizes
3. List of accesories (of custom type accesories). This accesories are the custom type accesories. This accesories can be 1 accesoies, 2 or 3 or 4. And car 3 can hv 4 accesories, car 6 -> 8 accesories. Each car can have a different number of accesories or the same number of accesories, but many cars can have the same accesories
Car 1 hv spare 3346 and mirror 3 and mirror 4
car 2 have spares 3345 and mirror 1, and brakes 3, brakes 4...
car 3 have spares 3345 and mirror 2, and brakes 3
All cars can have different number of accesories
So.. what is the way when i am in custom type car i can associate a list of accesories that are custom type accesories?
Ans i need to have in front end
Acessories: list of accesories with reference and image
Cars: List of cars. When i click in one car, the appears a single car page data about that car and accessories of that car
Mi idea is to have in the custom type of car fields of cr and anothe sction where i can add accesories that i hv created previously in accesories custom type, selecting it in a dropdown
Is it possible?
Thanks for your time
David
You need 2 Custom Post Types.
1. Accessories > This Post Type is child to the Car Post Type
2. Cars > This Post Type is the parent of Accessories.
Then you create a Car and save it.
After, in the Child Post Section, you can add as many Accessories as you need.
Each parent Post Type can have many Child Posts of the same type, but each Child can only have one Parent of the same kind.
3. Then you create a View that queries Accessories and set a Query Filter as:
- Select posts that are children of...
-- Post where this View is shown
4. After you create a Content Template for your Cars and insert that View there, this will now show the single car and all its Accessories listed in it.
5. To create a simple list of Accessories, you just create a View that queries all Accessories and insert it into a page, as example.
This is related DOC:
https://toolset.com/documentation/user-guides/creating-post-type-relationships/
https://toolset.com/documentation/user-guides/querying-and-displaying-child-posts/
https://toolset.com/documentation/user-guides/view-templates/
https://toolset.com/documentation/user-guides/displaying-related-child-posts/
Hi Beda. That's no solve my problem
In the car post type i want to add accesories from a combobox that list accesories from accesories post type. I don't want to add accesories for only one car. The same accesories are in different cars.
Ford Escort with accessories: 11000, 11001, 11002, 11003
Opel Manta with accessories: 11000, 11001, 11006, 11008
So... in accesories post type i create
11000
11001
11002
11003
11004
In cars post type i create car with its data and i add accesories from post type accesories. I don't want add accesories from car post type. I want to add accesories from a combobox of accesories in car pots type.
See the image that i attach here so you can understant what i Need. Thanks!
1. In the car post type i want to add accesories from a combobox that list accesories from accesories post type. I don't want to add accesories for only one car. The same accesories are in different cars.
This is impossible at the current moment.
- A parent Post type can have many Childs of the sam type
- But those must be created from within the Parent Post type, they cannot be chosen
- Or, you create Child Posts and then pick (choose) the Parent Post
- Accessories can only be assigned to many cars at the same time, if those accessories are Parent Post Types.
2. In cars post type i create car with its data and i add accesories from post type accesories. I don't want add accesories from car post type. I want to add accesories from a combobox of accesories in car pots type.
You can only CHOOSE parent Post Types, but cannot CHOOSE Child post types, they need to be created from the parent post, or, they need to be created as new posts and then there you can CHOOSE parent posts.
This is how Toolset Types works now.
In future, but this will take some time, you can implemented both-way relations so you can achieve what you want, but that is not yet scheduled for release, it is a major update that will also probably require a new Toolset Types Plugin (a new model)
Beda... it's solved, but i use intermediate post type.
One more thing... combobox shows title of custim post type recambios. Is it possible show there a different field like as SKU, if i have that fields in the custom type recambios (accesories)?
Thanks again
No, that is not possible.
It woudl require a change in the Core code of Toolset Types, which I can not support.
But what you can do is head to Toolset > Post Types > your_parent_post_type > Post relationships (parent/child) > your_child_post > Select Fields and then choose what fields you want to display in that MetaBox.
You can fully customize that.
Hi again Beda. I'm in child custom type but i don't se where i can select fields to show.
As I said in my previous post, you need to head to Toolset > Post Types > your_parent_post_type > Post relationships (parent/child) > your_child_post > Select Fields, and not to the Child Post Type edit screen.
Then you will see the option I mention.
ok. Sorry my mistake. But there are only the title of post child and title of parent child, there are not more fields. Is it possible to get more fields of the other parent child, like as referencia (of recambio)?
All Fields of your CHILD post will be listed there.
If those posts have no Childs, you cannot display those posts in the Child Post Metabox
As far I see, "recambios" is a field and it's assigned to the Child Posts, so yes, you can choose that, you did already, as I see in the Screenshot.