I created:
Products
Collections (product taxonomy)
Designer (product taxonomy)
Each collection is made up of one or more products and the designer of the collection is the same as the associated products.
I created the custom fields of the products and collections. Now I wish I could connect the collections with the designers. How can I do? I would like to create a select in the custom Group for Term Fields and insert the taxonomy Designer values. it's possible?
I hope I explained myself
thanks
federico
Hi Federico,
Thank you for contacting us and I'd be happy to assist.
I'm afraid, there is no feature available to make a connection between two taxonomies. However, it is possible to connect two post types through "Post Relationships"
https://toolset.com/documentation/post-relationships/
If you're open to the idea of using custom post types and not the custom taxonomies for the "Collections" and "Designers", you can create one relationship between the "Designers" and the "Collections" posts and the other one between the "Collections" and the "Products" posts.
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
I created a custom post designer and a product taxonomy, Collection.
I populated a select with this scritp.
add_filter( 'wpt_field_options', 'populate_select', 10, 3);
function populate_select( $options, $title, $type ){
switch( $title ){
case 'Designer':
$options = array(
);
$args = array(
'post_type' => 'designer',
'posts_per_page' => -1,
'post_status' => 'publish',
'order' => 'ASC',
);
$posts_array = get_posts( $args );
foreach ($posts_array as $post) {
$options[] = array(
'#value' => $post->ID,
'#title' => $post->post_title,
);
}
break;
}
return $options;
}
I don't understand why in the insert of the collection the select is populated correctly while in the edit of the category I can't insert any data.
Hi Federico,
Thanks for writing back.
The function to filter "wpt_field_options" seems to be correct, but I'll need to see exactly where it is not working in the admin area.
Can you please share temporary admin login details along with the link to an example page where this is not inserting any data?
Note: Your next reply will be private and though no changes will be made on your website, please make a complete backup copy, before sharing the access details.
regards,
Waqar
Hi Federico,
Thank you for sharing these details and I apologize for the delay in getting back on this.
I've checked the file "single-collezioni.php" and noticed you've used "toolset_get_related_posts" and "toolset_get_related_post" function to get get the related posts.
As explained in the documentation ( https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/ ), the "toolset_get_related_post" function can be used to get a single related post whereas for complex cases or for multiple related posts, "toolset_get_related_posts" function should be used instead.
For example, you can update those lines to:
print_r($course = toolset_get_related_posts( $product, 'prodotto-collezione', 'parent'));
print_r( $facade = toolset_get_related_post( get_the_ID(), 'designer-collezione', 'parent'));
regards,
Waqar