Reputation: 1
twig code - I have created one checkbox for is_negotiable variable. I want to read the value of checkbox and print the message on frontend whether it is negotiable or not .
<tr>
<td id="is-negotiable">
{% if '{{objProductDetails['is_negotiable']}} == 1' %}
<p>Negotiable</p>
{% else %}
<p>Not Negotiable</p>
{% endif %}
</td>
</tr>
Upvotes: 0
Views: 7295
Reputation: 191
do it simply as:
<td id="is-negotiable">
{% if objProductDetails.is_negotiable == 1 %}
<p>Negotiable</p>
{% else %}
<p>Not Negotiable</p>
{% endif %}
</td>
when you're in the {% %}
block, you are already accessing variables the same way as in {{ }}
block
Upvotes: 3