Mugdha Thakare
Mugdha Thakare

Reputation: 1

Twig\Error\SyntaxError Message: Unexpected token "name" of value "is_negotiable" ("end of statement block" expected)

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

Answers (1)

michondr
michondr

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

Related Questions