Skip Navigation

[Resolved] Conditional block not working ?

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

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 9 replies, has 2 voices.

Last updated by nicolaS-3 2 years, 7 months ago.

Assisted by: Shane.

Author
Posts
#2335231

Hi,
I have a profile-classifieds one-to-many relationship. When users create their profile they might load or not their own picture. In the single classified content template I have two conditional blocks:
If the user image exists then show the user image:
NOT (
Field User image from Parent: Profile is empty .
)
and this works fine.
If the user image doesn't exist I want to load the usual dummy user icon, but the opposite condition I set (Field User image from Parent: Profile is empty .) doesn't work and the icon isn't shown, why ? is there any workaround you can suggest ?
Thanks
Nicola

#2335347

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nicola,

Thank you for getting in touch.

Can you enable the debugging on the conditional block that you're checking for the empty field on and let me know what the debug data you're getting from this is.

From there we will know how best to proceed.

Thanks,
Shane

#2335423
bbb.png

Hi Shane,
I have activated the debug mode for the conditional block, but being this the first time I use it I don't know how to use it. If I activate the Chrome console I see what in the attached image. Please let me know if there is anything else I have to look for, thanks Regards
Nicola

#2335513

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nicola,

Actually no this isn't what i'm looking for.

What you can do is to provide me with admin access to the site so that I can have a look to see what is happening here.

I've enabled the private fields for your next response.

Thanks,
Shane

#2336153

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nicola,

Thank you for the credentials, however i'm not seeing where you've sent the link to the exact page where you're testing the conditional block.

Can you send this as well.

Thanks,
Shane

#2336301

ooops sorry, ,see previous private message

#2336477

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nicola,

Thank you, I was able to see the issue.

It turns out that the conditional block isn't evaluating the parent data correctly. Can you try using a classic editor block and then adding the following conditional inside the block and let me know if it helps.


[wpv-conditional if="('[types field='user-image' item='@profilo-classified.parent'][/types]' eq '' ]
Displayed image goes here
[/wpv-conditional]

Please let me know if this workaround helps.

Thanks,
Shane

#2336835
ccc.jpg

Hi Shane
I did what you suggested in two ways, adding the image from the media or adding an img tag, none of the two seems to work.
See screenshot attached, did I do anything wrong ? the second one is still saved in the content template
thanks

#2337007

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nicola,

This should now be working.

There was an error in the formatting that I provided to you.

The correct format should be.

[wpv-conditional if="('[types field='user-image' item='@profilo-classified.parent'][/types]' eq '')" ]
<img src="<em><u>hidden link</u></em>" width="200" height="200">
[/wpv-conditional]

Please let me know if everything is ok now.
Thanks,
Shane

#2337077

My issue is resolved now. Thank you!