Skip Navigation

[Resolved] How to create a specific Post Relation with limitation.

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 6 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

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)

Author
Posts
#614998

For my project, i need something like that:

There is an object called "Set"

In this set, there should be different "Setparts" like "Head", "Body", "Legs", "Main Hand", "Second Hand"

For every part, the user should chose an "Item" for this specific Setpart. Every item can have different qualities. And every different quality can have special advantages.

After the user selects an item for a setpart, for example he selects the item "glove" for "main hand", he also need to set the quality.

When he selects the quality, the advantages of this items should be show.

How can I realize that?

My first idea was to create a posttype called Set

But how can I achieve, that every set part can only be selected once and every set part can only have on item.

And: How can I automatically show the advantages depending on the item and quality chosen?

I am still a starter in toolset.

In the end, it would be gread to have a summary of advantages all those selected items give.

#615128

Dear Holger,

There isn't the exact same feature within Toolset plugins.

Here are my suggestions:
1) Create different post types: "Head", "Body", "Legs", "Main Hand", "Second Hand"
https://toolset.com/documentation/user-guides/create-a-custom-post-type/

2) In all of above post type, setup two custom fields:
a) Number field "quality"
b) Single line field "advantages"
https://toolset.com/documentation/user-guides/using-custom-fields/

3) Create a post type "Set", setup it as a child post type of "Head", "Body", "Legs", "Main Hand", "Second Hand"
https://toolset.com/documentation/user-guides/creating-post-type-relationships/
With only one Number field "Sum quality"

4) So you can create new "Set" posts in WordPress admin side, or in the front-end with CRED form:
https://toolset.com/documentation/user-guides/cred-forms-for-child-content/
There you can setup it's parent "Head", "Body", "Legs", "Main Hand", "Second Hand" posts
When user save a "Set" post, you can use WordPress action hook "save_post" to trigger an PHP function, in this function, get the "quality" field values from parent "Head", "Body", "Legs", "Main Hand", "Second Hand" posts, and save it in to "Sum quality" field
https://codex.wordpress.org/Plugin_API/Action_Reference/save_post
https://codex.wordpress.org/Function_Reference/get_post_meta

5) In the single "Set", you can display it's "Sum quality" field value, and it's parent "Head", "Body", "Legs", "Main Hand", "Second Hand" posts information, and "quality" and "advantages" field values:
https://toolset.com/documentation/user-guides/displaying-fields-of-parent-pages/

#615140

So you think ist not possible without programming knowledge?

Toolset fields can not get values like ACF for example can?

#615148

Q1) So you think ist not possible without programming knowledge?
Yes, I think there isn't the exact same feature within Toolset plugins, and it will need some custom codes, see the my post, step 4)
https://toolset.com/forums/topic/how-to-create-a-specific-post-relation-with-limitation/#post-615128

Q2) Toolset fields can not get values like ACF for example can?
Views shortcode [wpv-post-field] can output field value created by other plugins:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-field

And

Types can control custom fields created by other plugins:
https://toolset.com/faq/how-do-i-convert-existing-custom-types-and-fields-to-types-control/

#615163

thanks.

It would be suggestions to have custom fields, that allow to select previously created Content.

In this way, it would be pretty easy to set Options that are post types or taxonomies. This should really be added to Toolset

The forum ‘Types Community Support’ is closed to new topics and replies.