Answer the question
In order to leave comments, you need to log in
Convert a piece of twig to regular php, how?
Good day to all!
There is a piece of code in the twig template that I can’t convert to normal PHP in any way.
{% for not_calculate in not_calculate_dpd %}
{% if not_calculate.value == attribute(_context, 'shipping_dpd_not_calculate' ~ not_calculate.value) %}
{{ not_calculate.name }}
{% else %}
{{ not_calculate.name }}
{ % endif %}
{% endfor %}
is only interested in the line: {% if not_calculate.value == attribute(_context, 'shipping_dpd_not_calculate' ~ not_calculate.value) %}
thanks for the help.
Answer the question
In order to leave comments, you need to log in
foreach ($not_calculate_dpd as $not_calculate) {
if ($not_calculate['value'] == attribute($_context, 'shipping_dpd_not_calculate' ~ $not_calculate['value'])) {
echo $not_calculate['name'];
} else {
echo $not_calculate['name'];
}
}
foreach ($not_calculate_dpd as $not_calculate) {
echo $not_calculate['name'];
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question