Kentico Email template

Manoj Meena asked on April 15, 2019 12:34

Hi All,

we need to hide an element if that element has value as 0 , anything greater than 0 should let that element be displayed in email.

we tried below option, but in email it came as next point mentioned

closed Quantity: #closedQuantity#
{% if (#openQuantity# !=0) { %}openQuantity:#openQuantity#{% } #%}

but in email it came as

{% if (0 !=0) { %}openQuantity:0{% } |(user)Atest@test.com|(hash)7348eb9873b8972fc75c49ff4857f5d477cdaa4a569b0f2996d5e74a2d11926d%}

Recent Answers


Dragoljub Ilic answered on April 15, 2019 13:23 (last edited on December 10, 2019 02:31)

Hi,

I'm not sure if it's related, but it looks to me like that you have one open bracket extra in your code: {% if ((#openQuantity# !=0) { %}openQuantity:#openQuantity#{% } |(identity)GlobalAdministrator%}

Best regards, Dragoljub

0 votesVote for this answer Mark as a Correct answer

Manoj Meena answered on April 15, 2019 14:07

That was wrongly put, even after removing that it doesnt work

is there any other way or logic?

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 15, 2019 17:53 (last edited on December 10, 2019 02:31)

First off, is this email template populated with custom code? Meaning you're creating a macro object openQuantity and assigning a value to it somewhere in code?

Secondly, when you reference the macro, why are you using #openQuantity#? If you've properly created the object using the API, then you simply access it like so without the #:

{% if (openQuantity != 0) { %}
openQuantity: {%openQuantity%}
{% } |(identity)GlobalAdministrator%}
0 votesVote for this answer Mark as a Correct answer

Manoj Meena answered on April 16, 2019 11:18

yes its populated through custom code,

All the objects are taking # and showing data properly in email template.

however the if condition is not working. need to know how to write a logic to hide field when not needed

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on April 16, 2019 14:23

Maybe your custom code isn't correct. Post it here and we'll take a look.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.