I have a set of products. Some of them are a parent to other products. I need my /product page to show all of the products, but arrange them in groups. I guess you could think of some of the products as product-groups but I don't want the groups (parent posts) to have a different url structure or setup. They are the same in every way, except some are parents to other products.
- I tried creating a relationship but you aren't allowed to relate one type to itself.
- I tried to make a related post custom field but it doesn't allow linking to the same type.
I can think of ways to do this that are more fragile but I want a solution that the client is less likely to break.
Hello. Thank you for contacting the Toolset support.
Well - self-join relationship is not supported yet with Types.
- I tried creating a relationship but you aren't allowed to relate one type to itself.
- I tried to make a related post custom field but it doesn't allow linking to the same type.
=> its not possible to create a self join relationship.
I think I have a workaround to suggest - You should add a dropdown select field to your custom field group and fill its value dynamically.
Once you created the field - then you should use following hook to populate the dropdown select options dynamically.
For example - Create a custom select field namely "select products" with your custom field group and then added following code to your current theme's functions.php file that is used to populate the dropdown with existing essay post type entries :
If you add/edit the essay post - you will see the "select product" select field is available to select the options and you can save the ID of the selected option with custom field "select product".