That got it working! Thank you Jamal and tier 2! So, would this be considered a bug?
And I actually need a bit more help but with a different issue on this same project. I have a conditional that is not behaving as expected. Should I open a new ticket or can you help me here with that?
Please share more details about this conditional. Where it is being used? What would you expect for an example post? Where can we see the result on the frontend?
You may also want to share the credentials to your website in this ticket too because they get automatically removed when a ticket is resolved. The staging site would be better if the issue appears on it too.
Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **
My apologies for the late reply, but I do not work on Wednesdays and Thursdays.
Unfortunately, the provided password does not allow me to access the wp-admin area. I successfully log in and I can see the top bar, but when I try to access wp-admin I get disconnected and redirected to the login form. Can you check from your side or provide another user in your next reply.
Can you also give me an example of a post that will be displayed in the view and explain why the conditional is not working as expected?
Try logging in again with the same credentials. It should allow you into the dashboard correctly now.
As for the conditional, i'm actually testing a field on a post that has NOT been created yet, so I expect it to evaluate as null, but it doesn't seem to be the case...
Thank you, I confirm that the credentials are working for me now.
Can you give an example of a URL to check this further?
Any requisition with status approved and sunstatus ordering should work for an example.
I am sure you will understand that we work on several customers' websites and we can't be familiar with everyone.
Please provide the URL to an example and explains what would you expect and what do you actually get:
1. I go to xxx
2. I do xxx
3. I expect to have xxx
4. Instead I get xxx
OK, check this out:
hidden link
See where there is a block of text under the entry for 'laptop'? That's what should show once the form has been filled and submitted, so, below that where "ordered by" is blank, there should be a form showing.
The conditional is : " [wpv-conditional if="( $(wpcf-ordered-by).item(@item-to-order.child) eq '' )"] "
The template is "omni items by type"
it seems to me that the form should be displayed until the "ordered by" field has been filled... hopefully this is enough detail....
My apologies for the late reply, but I do not work on Wednesdays and Thursdays.
Unfortunately, this URL does not work on the staging site, it returns 404 hidden link
- hidden link
Can you provide an example from the staging site?
hidden link
The form should only show when the Requisition is in Approved - Ordering status, and the form has not been submitted. once the form is submitted, the conditional should hide it.
The form will create an Item Order. And there is a custom code in the theme's functions.php file that will set a custom field for the created post, specifically line 160 check this screenshot hidden link
But, the conditional is looking for a value in the custom field "ordered-by" in the Req Item post instead of the Item Order post. Does it make sense?
I am not sure for what post do you want to set the "ordered-by" custom field to the current user's email?
- If it is the Req Item post, then the custom code should be corrected to save the email in the Req Item post instead of the Item Order post.
- If it is the Item Order post, then the conditional shortcode should check the related Item Order post. If it exists and/or if it has a value in "ordered-by" custom field.
Does this make sense?
That makes sense. I changed my conditional to the following:
[wpv-conditional if="( $(wpcf-ordered-by).item(@item-to-order.child) eq '' )"]
It's still not doing what I expect...
I'm sorry for being dense. Can you help me get it setup to display the form until it is submitted, then display the template in its place? As I have it now, It will display the submitted info as a message after the form is submitted, but if you refresh the page or leave and come back, the form still displays, and the template is not.
The field it should be checking is on the ITEM ORDER post. The post doesn't exist until the form is submitted. I don't know what i'm missing... What SHOULD my conditional be to accomplish this?
Instead of checking against the "ordered-by" field on the order post, why not just check against the ID. If an ID is greater than 1, then the order already exists, if it is not, then display the form.
[wpv-conditional if="( '[wpv-post-id item="@item-to-order.child"]' gt '0' )" evaluate="false"]
<!-- notice the attribute evaluate="false", the condition is not matched, then display the form -->
[cred_form form="new-item-order"]
[/wpv-conditional]
[wpv-conditional if="( '[wpv-post-id item="@item-to-order.child"]' gt '0' )"]
<!-- the condition is matched, then display the order template -->
<p>Order ID: [wpv-post-id item="@item-to-order.child"]</p>
[/wpv-conditional]
I disconnected the current order on Req item #1460 and I can see the form now. hidden link
After submitting the form, which will create an order on the Req Item, I can now see the "template" hidden link
Note that you can put a content template and pass the order item to it like this:
[wpv-conditional if="( '[wpv-post-id item="@item-to-order.child"]' gt '0' )"]
[wpv-post-body view_template="the content template name or slug" item="@item-to-order.child"]
[/wpv-conditional]
If you need to check against the order-by custom field, you can put it inside the above condition. But, frankly, I do not see why.
That makes sense, and works as I expect and intend. Thank you Jamal!
My issue is resolved now. Thank you!