Forums

CF7 - How to sort email data from repeater clones?

mknaus 17 May, 2021
Hi @all,

currently I'm working on an internal order form with a repeater area to add several articles to an order. This is all working great so far, but the problem I have now, is that the data in the email seems to be re-sorted, as the array is rearranged while creating the email and I can't find a way to modify this. Submitting the form results in a structure like this:

Item1.Name
Item2.Name
Item1.Quantity
Item2.Quantity
Item1.OrderNr
Item2.OrderNr

But I would need have the data kept together per Item (cloned row), as there are quite a few options for each item:

Item1.Name
Item1.Quantity
Item1.OrderNr
...

Do you have any clues for me how I could modify this behaviour?
Thank you so much!

Regards,
Martin
GreyHead 18 May, 2021
Hi Martin,

Can you turn on Debugging to see what the format of the submitted data is?

Bob
mknaus 18 May, 2021
Hi GreyHead,

sure I've attached the Debug Output below:
Array
(
    [pages] => Array
        (
            [requested] => 2
            [default] => 1
            [this] => 2
            [accepted] => Array
                (
                    [1] => true
                    [2] => true
                )

            [active] => 2
            [tokens] => Array
                (
                    [1] => 0fbc9ca5-2168-435b-a7d4-098255b12a29
                    [2] => 2519be66-c7d8-47ea-b870-bab8b29b1fdf
                )

            [chain] => Array
                (
                    [1] => 2
                )

        )

    [__lastsave] => 1621330743
    [_data] => Array
        (
            [1] => Array
                (
                    [format] => html
                    [Itemid] => 1405
                    [option] => com_chronoforms7
                    [view] => form
                )

            [2] => Array
                (
                    [chronoform] => bestellformular-kompression
                    [gpage] => end_page
                    [patnr] => 52878
                    [vorgang] => Rezept
                    [vorgangsnr_rezept] => 100587
                    [Item] => Array
                        (
                            [1] => Array
                                (
                                    [Artikelnummer] => 1234
                                    [Menge] => 1
                                    [hersteller] => Bort
                                    [markequalitt] => normal
                                    [klasse] => CCL1
                                    [form] => AD
                                    [lnge] => normal
                                    [fussspitze] => kurz
                                    [haftrand] => Trikotrand
                                    [farbe] => grey
                                )

                            [2] => Array
                                (
                                    [Artikelnummer] => 56789
                                    [Menge] => 1
                                    [hersteller] => Thuasne
                                    [markequalitt] => value
                                    [klasse] => CCL2
                                    [form] => AG
                                    [lnge] => normal
                                    [fussspitze] => kurz
                                    [haftrand] => Trikotrand
                                    [farbe] => black
                                )

                        )

                    [__loops] => Array
                        (
                            [34] => Array
                                (
                                    [1] => 1
                                    [2] => 1
                                )

                        )

                    [absender] => username
                    [email] => useremail
                    [filiale] => test
                    [format] => html
                    [Itemid] => 1405
                    [option] => com_chronoforms7
                    [view] => form
                )

        )

    [_vars] => Array
        (
            [2] => Array
                (
                    [end_page_validation] => true
                    [settings_admin_email] => true
                )

        )

    [_clear] => 2
)
Array
(
    [chronoform] => bestellformular-kompression
    [gpage] => end_page
    [patnr] => 52878
    [vorgang] => Rezept
    [vorgangsnr_rezept] => 100587
    [Item] => Array
        (
            [1] => Array
                (
                    [Artikelnummer] => 1234
                    [Menge] => 1
                    [hersteller] => Bort
                    [markequalitt] => normal
                    [klasse] => CCL1
                    [form] => AD
                    [lnge] => normal
                    [fussspitze] => kurz
                    [haftrand] => Trikotrand
                    [farbe] => grey
                )

            [2] => Array
                (
                    [Artikelnummer] => 56789
                    [Menge] => 1
                    [hersteller] => Thuasne
                    [markequalitt] => value
                    [klasse] => CCL2
                    [form] => AG
                    [lnge] => normal
                    [fussspitze] => kurz
                    [haftrand] => Trikotrand
                    [farbe] => black
                )

        )

    [__loops] => Array
        (
            [34] => Array
                (
                    [1] => 1
                    [2] => 1
                )

        )

    [absender] => username
    [email] => emailaddress
    [filiale] => test
    [format] => html
    [Itemid] => 1405
    [option] => com_chronoforms7
    [view] => form
    [__cf_token] => 0fbc9ca5-2168-435b-a7d4-098255b12a29
)
Array
(
    [end_page_validation] => Array
        (
            [log] => Automatic validation enabled.
            [var] => true
        )

    [settings_admin_email] => Array
        (
            [recipients] => Array
                (
                    [0] => emailaddress
                )

            [subject] => Formular Bestellformular-Kompression empfangen.
            [body] => removed HTML body
            [from_name] => sendername
            [from_email] => senderemail
            [result] => the Mail sent successfully.
            [var] => true
        )

    [end_page_datalog] => Array
        (
            [data] => Array
                (
                    [aid] => NULL
                    [form_id] => 6
                    [uid] => 032b17b6-9399-4522-972c-ab189678b76d
                    [user_id] => 600
                    [created] => 2021-05-18 09:39:03
                    [modified] => NULL
                    [ipaddress] => 172.16.10.1
                    [page] => 2
                    [data] => {"3":"52878","30":"Rezept","4":"100587","31":"","9":{"1":"1234","2":"56789"},"5":{"1":"1","2":"1"},"6":{"1":"Bort","2":"Thuasne"},"8":{"1":"normal","2":"value"},"10":{"1":"CCL1","2":"CCL2"},"23":{"1":"AD","2":"AG"},"12":{"1":"","2":""},"25":{"1":"normal","2":"normal"},"26":{"1":"kurz","2":"kurz"},"27":{"1":"kurz","2":"kurz"},"28":{"1":"Trikotrand","2":"Trikotrand"},"29":{"1":"grey","2":"black"},"38":"mknaus","40":"emailaddress","39":"test","__loops":{"34":{"1":"1","2":"1"}}}
                )

            [var] => Array
                (
                    [aid] => 24
                    [form_id] => 6
                    [uid] => 032b17b6-9399-4522-972c-ab189678b76d
                    [user_id] => 600
                    [created] => 2021-05-18 09:39:03
                    [modified] => NULL
                    [ipaddress] => 172.16.10.1
                    [page] => 2
                    [data] => {"3":"52878","30":"Rezept","4":"100587","31":"","9":{"1":"1234","2":"56789"},"5":{"1":"1","2":"1"},"6":{"1":"Bort","2":"Thuasne"},"8":{"1":"normal","2":"value"},"10":{"1":"CCL1","2":"CCL2"},"23":{"1":"AD","2":"AG"},"12":{"1":"","2":""},"25":{"1":"normal","2":"normal"},"26":{"1":"kurz","2":"kurz"},"27":{"1":"kurz","2":"kurz"},"28":{"1":"Trikotrand","2":"Trikotrand"},"29":{"1":"grey","2":"black"},"38":"mknaus","40":"emailaddress","39":"test","__loops":{"34":{"1":"1","2":"1"}}}
                )

        )

)
This results in an email body like this:


But it should keep all Item properties of each Item together, so first all properties of the first item, then all of the second, and so on.

Regards,
Martin
Eddi Bournell 19 May, 2021
Vielleicht kannst du davon etwas verwenden : https://www.chronoengine.com/forums/posts/t109244/p396302#p396302
You need to login to be able to post a reply.