Handle array

How to display array data in a readable email format.

Overview

The issue occurs when form data is stored in a nested array structure, making it unreadable when inserted directly into an email.
Use a Loop action in CF to iterate through the array, format each item within the loop body, and then reference the loop's output variable in the email template.

Answered
ChronoForms v6
vi vismay 17 Jan, 2018
Hello,

with a multiplier I manage to get the following result:

 [Model] => Array
        (
            [0] => Array
                (
                    [colore] => 01
                    [taglia] => XXS
                    [quantita] => 45
                )

            [1] => Array
                (
                    [colore] => 02
                    [taglia] => XXS
                    [quantita] => 34
                )

        )


How can I get now the list in readable form in a email?

In attachment how I set up the field name and ID.

Thanks
Max_admin Max_admin 19 Jan, 2018
Answer
Hi vismay,

You will need to use a "Loop" action, set the "data provider" to {data:Model}, and enable the "return result as var", make sure the loop is before the email, then use your code in the loop body:

Color#{var:loop_name.key}: {var:loop_name.row.colore}<br>


In the email body you can now use {var:loop_name} to get the full output of the loop.

Best regards
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.