Sauter la navigation

[Résolu] Query filter with in a view doesn’t work properly if there is no related post

This support ticket is created Il y a 1 mois et 2 semaines. 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

Ce sujet contient 0 réponses, a 1 voix.

Dernière mise à jour par cassianS Il y a 1 mois.

Assisté par: Minesh.

Auteur
Publications
#2798144

I am trying to:
- I created a simple view to display a text from post type "A" with a query filter. The filter selects items in a relationship of post type "A" and "B" using "The post with ID set by the shortcode attribute".
- Some posts of the post type "A" do not have a related post of the post type "B". But a view instead of showing nothing, displays a text field of the first post "A". This creates a huge mess and it looks like a bug in my opinion.
- When I place an id of the related post into shortcode attribute the view's query filter still doesn't work.
- However, if I use other query filter options and the view doesn't have a shortcode attribute in it I don't see such issue. In this case if no related posts - view would display nothing.

Link to a page where the issue can be seen:
lien caché

#2798430

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please share problem URL and tell me for what post you do not have related post available or for what post there is no related post-relationship post available and also share what view you are using.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2799598

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Can you please check now:
- lien caché

Does it works as expeted? if no:

Can you please setup two test post where with one you want to display the doctor name and for another it should not display the doctro name.

#2799866

Hi Minesh. Thank you! It is working properly now! May I ask what did you do so I could use it in future development?
Also, I am trying to use the view with a shortcode in conditional output. The idea is to check is there are no doctor posts connected to report request post, so I could display a data conditionally.
However, it doesn't work.
Here is example
[wpv-conditional if="( "[wpv-view name='display-doctors-first-name-related-to-report-request' relatedreportrequest="[wpv-post-id item='@report-request-report-order-estimation.parent']"]" eq '' )"]
YEY
[/wpv-conditional]

I tried to put a shortcode view in PHP snippet shortcode but it doesn't work either (I get an error).
add_shortcode('doctors-first-name-related-to-report-request', function(){
return wpv_do_shortcode('[wpv-view name="display-doctors-first-name-related-to-report-request" relatedreportrequest="[wpv-post-id item='@report-request-report-order-estimation.parent']"]');
});

Do you think it is possible at all to use such view in conditional output?

#2800089

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Glad to know that you see is working as expected.

With both the view that displays the Doctor first name and last name I've setup correct Query Filters:
- lien caché
- lien caché

As per our support policy we entertain only one question per ticket. This will help other users searhing on the forum as well as help us to write correct problem resolution summery. I'll split the ticket with your new question. You're welcome to mark resolve this ticket.

#2800174

Thank you a lot, Minesh! I think I got what you did to fix the view. I see I used "in any relationship" instead of pointing to specific relationship in a Query filter.