Home›Toolset Professional Support›[Resolved] How to display only posts who do not have related post assigned in many-to-many post relationship
[Resolved] How to display only posts who do not have related post assigned in many-to-many post relationship
This thread is resolved. Here is a description of the problem and solution.
Problem:
How to display only posts who do not have related post assigned in many-to-many post relationship
Solution:
You can use the view's filter hook "wpv_filter_query" to change the view's query on fly to get only posts where many-to-many post relationship post does not have child.
This support ticket is created 4 years, 2 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
i have a many to many relationship between products and showroom.
I want a page with the following:
Show All products
within the product display each showroom the user created (even if the product is not assigned to the showroom)
if the product is assigned to showroom then display an Edit Link and a delete link.
if the product is not assigned to the showroom then display an Add to Showroom link
is there a way to accomplish this without code? i read the views inside of a view but this only shows me the showrooms that have a relationship with the product.
Is there any documentation that you are following?
if the product is assigned to showroom then display an Edit Link and a delete link.
if the product is not assigned to the showroom then display an Add to Showroom link
==>
I would like to have little more clarification here. You want to display the Edit and Delete link for Product or Showroom?
In addition to that, have you created post form to add/edit post?
Let me try and clarify. After thinking about how to solve this with toolset i thought it would be easier to first attempt to just add the links to an individual product page. For example, product 1 is in 1 showroom currently and the user has created 3 showrooms. thew product page would show this
Product 1
Currently In:
Showroom 1: Edit showroom connection | Delete from Showroom
Add to Showroom 2
Add to Showroom 3
is an example of a product page on my site.: hidden link
it uses the content template called "Template for Products 2"
i added an login info to my other ticket so that you can login if you would like.
The hard part os how do you query what show rooms are NOT assigned to a current product. I am not sure how to approach this.
Thank you very much. This is great. It took me a bit to process and understand but I think I got it.
I have a few questiona for you now.:
Q1 : Since we know the parent as well that we want to add can you default the parent on the "add-products-to-showrooms-form"? i have read a few tickets that discussed different ways but i have not been able to successfully implement myself.
Q2: If i just wanted to add a connect to the product and showroom (leaving off the price) would it be possible to just call toolset_connect_post after the user clicks a link and reload the page after completion?
Q3: also, i was wondering something..if you look at the loop of the view you created:
I would like it to say "Add to <SHOWROOM>" but right now it is showing "Add to <Product>" . I am not sure I understand how to reference the showroom name within the cred tag.
New threads created by Minesh and linked to this one are listed below:
We entertain only one question per ticket. this will help other users searching on the forum as well as help us to write correct problem resolution summery for the original issue reported.
Q1 : Since we know the parent as well that we want to add can you default the parent on the "add-products-to-showrooms-form"? i have read a few tickets that discussed different ways but i have not been able to successfully implement myself.
Q2: If i just wanted to add a connect to the product and showroom (leaving off the price) would it be possible to just call toolset_connect_post after the user clicks a link and reload the page after completion?
==>
No, Toolset post-relationship form do not offer any API hooks yet using which you can call the function toolset_connect_post(). You will require to use the post-relationship form to connect the post.