Hi,
I need some help extending the if then statement from this ticket:
https://toolset.com/forums/topic/if-then-statement-product-attributes-on-custom-datasheet-page/page/2/
I need an extra check, so besides if not empty, I also need if not '-' I tried to add in manually but is doesn't work.
[wpv-conditional if="( '[wpv-post-taxonomy type="pa_zaagmaat" format="slug" item="$parent"]' ne '' )"]
F.e.
[wpv-conditional if="( '[wpv-post-taxonomy type="pa_zaagmaat" format="slug" item="$parent"]' ne '' ) AND ( '[wpv-post-taxonomy type="pa_zaagmaat" format="slug" item="$parent"]' ne '-' ) "]
But it doesn't seem to work?
Thanks, Jelle
Hi Jelle,
Thank you for contacting us and I'd be happy to assist.
Based on the details shared in these two tickets, you'll need to replace the "AND" operator in the conditional statement, with the "OR" operator.
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
Hi Waqar,
Thanks, but this doesn't seem to work as well.
[wpv-conditional if="( '[wpv-post-taxonomy type="pa_zaagmaat" format="slug" item="$parent"]' ne '' ) OR ( '[wpv-post-taxonomy type="pa_zaagmaat" format="slug" item="$parent"]' ne '-' ) "]
Still returns a '-' sign for this attribute.
[wpv-conditional if="( '[wpv-post-taxonomy type="pa_zaagmaat" format="slug" item="$parent"]' ne '' ) OR ( '[wpv-post-taxonomy type="pa_zaagmaat" format="slug" item="$parent"]' ne '-' ) "]
<tr>
<th>Zaagmaat (in mm)</th>
<td>: [show-variation-attribute attribute="zaagmaat" variation_id="[wpv-search-term param="variation_id"]"]</td>
</tr>
[/wpv-conditional]
Thanks for writing back.
Can you please share temporary admin login details, along with the link to the page where you need this conditional to work?
Note: Your next reply will be private and it is recommended to make a complete backup copy, before sharing the access details.
Thank you for sharing these details, but, I keep getting the message about the incorrect password.
Can you please check the username and password again?
I've set your next reply as private again and please also include a link to page(s) where these views can be seen.
Thank you for waiting.
During troubleshooting, I noticed that the condition was failing, because "-" is returned, when the 'name' of the taxonomy is used, but in the conditional evaluation, the 'slug' is being called, which is not equal to "-":
[wpv-conditional if="( '[wpv-post-taxonomy type="pa_zaagmaat" format="slug"]' ne '' )"]
<tr>
<th>Zaagmaat (in mm)</th>
<td>: [wpv-post-taxonomy type="pa_zaagmaat" format="name"]</td>
</tr>
[/wpv-conditional]
You can update the condition to use the format="name" attribute, like this:
[wpv-conditional if="( '[wpv-post-taxonomy type="pa_zaagmaat" format="name"]' ne '' ) AND ( '[wpv-post-taxonomy type="pa_zaagmaat" format="name"]' ne '-' )"]
<tr>
<th>Zaagmaat (in mm)</th>
<td>: [wpv-post-taxonomy type="pa_zaagmaat" format="name"]</td>
</tr>
[/wpv-conditional]
My issue is resolved now. Thank you!