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?
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?
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.
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.
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"?
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.
Okay I understand, I will stand by for your update.
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.
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.
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.