I'm struggling with these two cases, inside nested loops I can't update directly the object, nor checking for the array that I'm populating. Note that ALL_PRODUCTS, ALL_VARIANTS, ALL_SKU are all HubDb table rows.
Are there any workaround? I need to update the top object in the hierarchy, based on properties that are present in nested children objects.
{% set PRODUCTS = [] %}
{% for product in ALL_PRODUCTS %}
{% for v in ALL_VARIANTS %}
{% if v.idproduct == product.id_ls %}
{% for s in ALL_SKU %}
{% if s.idvariant == v.id_ls and s.publishing != 'n' %}
{# TRYING TO UPDATE DIRECTLY THE OBJECT I'M LOOPING THROUGH, DOESN'T WORK #}
{% do product.update({'batterie_input': s.batterie_input}) %}
{% do PRODUCTS.append(product) %}
{# TRYING TO CHECK THE UPDATED ARRAY AFTER APPEND, DOESN'T WORK, IT ONLY WORKS AFTER THE LOOP HAS FINISHED #}
{{ PRODUCTS }}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endfor %}