Skip Navigation

[Resolved] Link WooCommerce product to Buddypress topic through relationship

This thread is resolved. Here is a description of the problem and solution.

Problem:

I'm trying to link/add bbPress Forum topic to the Single Product through relationship:

- so that I can display topic/topics on the Single Product page (at least links to the associated topics)

- I can display custom fields/view from the Product in the Forum Topic

Solution:

Here are my suggestions:

https://toolset.com/forums/topic/link-woocommerce-product-to-buddypress-topic-through-relationship/#post-1274463

Relevant Documentation:

https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items

This support ticket is created 5 years, 7 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 4 replies, has 3 voices.

Last updated by gregD-7 5 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#1273159

Tell us what you are trying to do?
I'm trying to link/add Forum topic to the Single Product through relationship:
- so that I can display topic/topics on the Single Product page (at least links to the associated topics)
- I can display custom fields/view from the Product in the Forum Topic

#1273215

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I need more details here based on your structure. Do you mean that you want to establish relationship between two different post types? If yes: have you created a relationship from - Toolset => Relationships?

More info:
=> https://toolset.com/documentation/post-relationships/

#1273597
prod-linked-forums.PNG
IntermPost.PNG
ForumWithNoTopics.PNG
ForumwithLinkedProduct.PNG
prod-linked-forums.PNG
myrel1.PNG

I've defined multi- relationship Product <-> Forum with Intermediate Post with custom Field from Product post.

I linked Forum to Product in the Product details also there is Intermediate post linked to the Forum.

However intermediate Post does not showup as Topic in the Forum. So the question is how to make Intermediate Post appear as Topic in the Forum.

Please see screenshots, let me know if more clarification is required

#1274463

Hello,

Minesh isn't available, I will take care of this thread.

As I know, there isn't built-in forum feature within Buddypress plugin, I assume we are talking about bbPress forum:
hidden link
And Woocommerce "Product" post type

There is a post parent relationship between "Topic" post and "Forum" post:
https://codex.wordpress.org/Function_Reference/register_post_type#hierarchical

Here are my suggestions:
1) In a single "Product" post, you can setup a nested view:

a) Parent post view:
- Query "Forum" posts
- filter by the post type relationship "product-forum":
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items
- in view's loop display below child post view.

b) Child view:
- Query Query "Topic" posts
- filter by the post parent filter
https://toolset.com/documentation/user-guides/filtering-views-query-by-post-parent/
- and display "Topic" post information

2) Similar as above, in a single "Topic" post, you can get related "Forum" post ID,
hidden link
https://toolset.com/documentation/user-guides/views-shortcodes/item-attribute/
$parent is used to retrieve data from a hierarchical parent if the current post is a type of hierarchical post such as a page. If the reference does not match an existing post, the data from the current post will be returned.

use it to display related "product" posts.
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items

For your reference.

#1275037

My issue is resolved now. Thank you!