Skip Navigation

[Resolved] View results not filtered as expected when using post ids filter in shortcode attribute

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

Problem: I have a View that uses a shortcode attribute to set a Post IDs filter, but other Post IDs are appearing in the results.

Solution: Check the View's Query Filter and confirm there is a Post ID filter set up.

This support ticket is created 6 years, 5 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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 24 replies, has 2 voices.

Last updated by jesseB-4 6 years, 5 months ago.

Assisted by: Christian Cox.

Author
Posts
#911924

I was just reviewing the code above and I see something that might be a problem. Check this out:

$('.test-revert').click(function() {
  $('.revert-btn').trigger('click');
});

If you have multiple .revert-btn's in the DOM, they will have a click event triggered. That would probably account for why the first one is always being triggered. Have you added any code to limit the scope of the .revert-btn selector?

#911954

That was added to some places for testing purposes and should be commented out; I'll go ahead and remove them. Just curious, where did you find it?

#912015
Screen Shot 2018-06-11 at 3.40.55 PM.png
Screen Shot 2018-06-11 at 3.40.37 PM.png

Please find attached a screenshot of the DevTools Network console information on a successful Revert Order CRED update.

Are these helpful at all? From what I gleaned from them, the AJAX for Complete Order never gets fired and return a 200 OK; doesn't change anything at all. The Revert Order works sometimes and first return a 303 See Other for the redirect and then a second 200 OK when it is updated.

Edited: Still seem like the CRED forms are not capturing the right order to change status; it keeps trying to target the very first order outputted by "Kitchen Orders" when I move the CRED forms to there.

#912083

Just curious, where did you find it?
I was reviewing the code here in the forum post, not on the actual site.

Please find attached a screenshot of the DevTools Network console information on a successful Revert Order CRED update. Are these helpful at all?
I can't see anything obvious here.

If you can set this up on a page without any custom JavaScript click handlers or custom AJAX queries, I can take a look.

#913140

Hi Christian,

Our Toolset contractor Fernando has set up a "Kitchen Orders All Modals AJAX" with a Query filter of "Include only posts with IDs set by the View shortcode attribute "ids" eg. [wpv-view name="view-name" ids="1"]". Its Loop Item includes some custom AJAX inputs to change the Orders status.

In hidden link, I set the shortcode [wpv-view name="kitchen-orders-all-modals-ajax" ids="4904, 4910, 4927"] with the intention of pulling those three Orders for testing.

What can we do to the two views to get "All Modals AJAX" to display the correct Posts (Orders) from "Kitchen Orders"?

#913185

Can you provide login credentials? I have been working from a clone, where I added my own user, but I need login access to this sandbox.

#913641

Okay I understand, I will stand by for your update.

#913648

Hi Christian, you can hop on the live site now. Please find your updated account password in my previous private message.

Also, our custom AJAX is now working for both signed-in and not signed-in users — very happy we managed to resolve this. It seems the "Kitchen Orders" view's filter is not updating as well, however.

Thanks for waiting and cheers.

#914417

In the sandbox, I have [wpv-view name="kitchen-orders" cached="off"] and [wpv-view name="kitchen-orders-modal-2018-06-14" ids="4377, 4904, 4910, 4927"]
The kitchen-orders-modal-2018-06-14 View did not have a post ID filter, so this ids attribute in the shortcode didn't do anything. I added the post ID query filter to the View and now the Orders 4377, 4904, 4910 are showing up in the View results. Order 4927 does not appear in the results because the Order status is "Packaged" and the View filter only displays Processing and Complete.

So I think we have the correct results appearing in the nested View now.

#914849

Thank you! I will adapt your setup for our regular Views.

Since our custom AJAX is working, we will no longer need support to troubleshoot CRED forms not working to update Orders.
We are very close to finishing this project, so I'm very happy to be done with our previous challenges.

Thank you Christian once again for your support for the last few weeks. It has been great working with you.