Skip Navigation

[Resolved] List production in the product with same relation

This support ticket is created 4 years, 9 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/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by nelsonh 4 years, 9 months ago.

Assisted by: Waqar.

Author
Posts
#1541235

Tell us what you are trying to do? I have create one to many relation between collection and products. I have successfully listed all related products in the collection, now I want to list collection and other product in the same collection in a product page related to the particular collection

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?hidden link

#1541731

Hi Nelson,

Thank you for contacting us and I'd be happy to assist.

Assuming that you have a one-to-many post-relationship "collections-products", you can get the post ID of the collection post related to the current product, using the "item" attribute like this:
( ref: https://toolset.com/documentation/user-guides/views/views-shortcodes/item-attribute/ )


[wpv-post-id item='@collections-products.parent']

Next, you can create a new post view that shows product posts, with a post-relationship query filter, that shows only those posts which are in the "Collections Products" relationship with the post whose ID is passed through a shortcode attribute "wpvrelatedto".
( ref: https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items )

You can then place this new view's shortcode in your single product page's template, like this:


[wpv-view name="slug-of-view" wpvrelatedto="[wpv-post-id item='@collections-products.parent']"]

Please update "slug-of-view" and "collections-products" slugs with the actual slugs used on your website.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1542345

My issue is resolved now. Thank you!