Datas from cloneable group fields

17 November, 2023 01:50:41
eliodata
Topics: 14
Messages: 39
Hello,
I use metabox.io to create my fields.
I generate pdf from woocommerce orders.
Some products have cloneable groups fields, with sub cloneable groups fields...
I would like to display some of these datas into my pdf.

Main group field ID (cloneable): fsbdd_planning

Inside I have 4 datetime picker:
fsbdd_plannmatin
fsbdd_plannmatinfin
fsbdd_plannam
fsbdd_plannamfin

And another group field (cloneable): fsbdd_gpformatr

With 3 fields:
related post: fsbdd_user_formateurrel1
select: fsbdd_dispjourform
select: fsbdd_okformatr

I would like to display the datas from fsbdd_user_formateurrel1

And I also will have to display the datas from
fsbdd_plannmatin
fsbdd_plannmatinfin
fsbdd_plannam
fsbdd_plannamfin

is it possible?

Best regards
17 November, 2023 03:37:39
E2Pdf
Support
Topics: 7
Messages: 3165
Hello,

Can you please create a "temporary" textarea inside the E2Pdf Template and map it with the shortcode that outputs the data from the main fields: fsbdd_planning / fsbdd_gpformatr

Do you get any data? If yes, can you please post it here, or attach an unflattened PDF? You can mark the message "private" so only we can see the message.
We would really appreciate your feedback at WordPress.org!
17 November, 2023 04:36:46
eliodata
Topics: 14
Messages: 39
Using the visual mapper returns me empty fields.
Using this shortcodes:

[e2pdf-wc-product key="fsbdd_planning" meta="true" index="0" parent="true"]

and

[e2pdf-wc-product key="fsbdd_gpformatr" meta="true" index="0" parent="true"]

Dsiplays:

a:2:{i:0;a:5:{s:16:"fsbdd_plannmatin";s:16:"13-11-2023 08:30";s:19:"fsbdd_plannmatinfin";s:16:"13-11-2023
12:00";s:13:"fsbdd_plannam";s:16:"13-11-2023 14:00";s:16:"fsbdd_plannamfin";s:16:"13-11-2023
17:00";s:15:"fsbdd_gpformatr";a:2:{i:0;a:3:{s:24:"fsbdd_user_formateurrel1";s:6:"254135";s:18:"fsbdd_dispjourform";s:5:"Ma
tin";s:15:"fsbdd_okformatr";s:9:"Réservé";}i:1;a:3:{s:24:"fsbdd_user_formateurrel1";s:6:"254017";s:18:"fsbdd_dispjourform";
s:2:"AM";s:15:"fsbdd_okformatr";s:6:"Option";}}}i:1;a:5:{s:16:"fsbdd_plannmatin";s:16:"14-11-2023

and

a:2:{i:0;a:2:{s:24:"fsbdd_user_formateurrel1";s:5:"15754";s:15:"fsbdd_okformatr";s:3:"NON";}i:1;a:2:{s:24:"fsbdd_user_for
mateurrel1";s:6:"254135";s:15:"fsbdd_okformatr";s:3:"NON";}}


I also tried [e2pdf-wc-product key="fsbdd_user_formateurrel1" meta="true" index="0" parent="true"] without any result.

Thank you
17 November, 2023 05:29:38
E2Pdf
Support
Topics: 7
Messages: 3165
Hello,

If you need to get data separately the following shortcodes must be able to work:

1st case:

[e2pdf-wc-product key="fsbdd_planning" meta="true" index="0" parent="true" path="0.fsbdd_plannmatin"]

[e2pdf-wc-product key="fsbdd_planning" meta="true" index="0" parent="true" path="1.fsbdd_plannmatin"]

and so on...

2nd case:

[e2pdf-wc-product key="fsbdd_gpformatr" meta="true" index="0" parent="true" path="0.fsbdd_user_formateurrel1"]

[e2pdf-wc-product key="fsbdd_gpformatr" meta="true" index="0" parent="true" path="1.fsbdd_user_formateurrel1"]

and so on...

If you need to output all entries, you can try to use it as follows:

1st case:

[e2pdf-foreach shortcode="e2pdf-wc-product" key="fsbdd_planning" meta="true" index="0" parent="true"]
[e2pdf-wc-product key="fsbdd_planning" meta="true" index="0" parent="true" path="[e2pdf-foreach-key].fsbdd_plannmatin"]
[/e2pdf-foreach]

2nd case:

[e2pdf-foreach shortcode="e2pdf-wc-product" key="fsbdd_gpformatr" meta="true" index="0" parent="true"]
[e2pdf-wc-product key="fsbdd_gpformatr" meta="true" index="0" parent="true" path="[e2pdf-foreach-key].fsbdd_user_formateurrel1"]
[/e2pdf-foreach]



We would really appreciate your feedback at WordPress.org!
17 November, 2023 06:48:51
eliodata
Topics: 14
Messages: 39
It works!

I also can display some custom fields from the related post like that:
[e2pdf-wp id="dynamic" key="first_name"][e2pdf-wc-product key="fsbdd_gpformatr" meta="true" index="0" parent="true" path="0.fsbdd_user_formateurrel1"][/e2pdf-wp]

Last thing please, is it possible to adapt this shortcode:

[e2pdf-wc-product key="fsbdd_planning" meta="true" index="0" parent="true" path="0.fsbdd_plannmatin"]

to only display the time from the datetimepicker? This one will render "13-11-2023 08:30", sometimes I would like to have only "08:30".

Many thanks!
17 November, 2023 08:12:45
E2Pdf
Support
Topics: 7
Messages: 3165
To display just time, you can try to use one of the following shortcodes:

[e2pdf-format-output explode=" " output="{1}"][e2pdf-wc-product key="fsbdd_planning" meta="true" index="0" parent="true" path="0.fsbdd_plannmatin"][/e2pdf-format-output]

Or

[e2pdf-format-date format="H:s"][e2pdf-wc-product key="fsbdd_planning" meta="true" index="0" parent="true" path="0.fsbdd_plannmatin"][/e2pdf-format-date]
We would really appreciate your feedback at WordPress.org!
17 November, 2023 09:48:44
eliodata
Topics: 14
Messages: 39
The first give wrong time (8:00)
The second works well!

Thank you again for kind, fast and efficient support, as always.
22 November, 2023 00:13:56
eliodata
Topics: 14
Messages: 39
Hello again,
I have another question please. These shortcodes:

[e2pdf-wp id="dynamic" key="first_name"][e2pdf-wc-product key="fsbdd_gpformatr" meta="true" index="0" parent="true" path="0.fsbdd_user_formateurrel1"][/e2pdf-wp]
[e2pdf-wp id="dynamic" key="first_name"][e2pdf-wc-product key="fsbdd_gpformatr" meta="true" index="0" parent="true" path="1.fsbdd_user_formateurrel1"][/e2pdf-wp]
,,,

Give me the first name and last name from "fsbdd_user_formateurrel1"

I would like to have a list like that:
"0.fsbdd_user_formateurrel1", "1.fsbdd_user_formateurrel1", "2.fsbdd_user_formateurrel1"...

All separated by commas. But if I place commas between shortcodes I will have a list of commas without content when some fields are empty. Same with empty breaklines if put one shortocde per line. Is it possible to format it by inserting the commas or br into the shortcodes?

Best regards

22 November, 2023 00:42:01
E2Pdf
Support
Topics: 7
Messages: 3165
Hello,

Try please to use the e2pdf-format-output shortcode:

[e2pdf-format-output explode_filter="array_filter,array_values" explode="|" implode=", "][e2pdf-wp id="dynamic" key="first_name"][e2pdf-wc-product key="fsbdd_gpformatr" meta="true" index="0" parent="true" path="0.fsbdd_user_formateurrel1"][/e2pdf-wp]|[e2pdf-wp id="dynamic" key="first_name"][e2pdf-wc-product key="fsbdd_gpformatr" meta="true" index="0" parent="true" path="1.fsbdd_user_formateurrel1"][/e2pdf-wp][/e2pdf-format-output]

See please that we added | as a delimiter between e2pdf-wp shortcodes.
We would really appreciate your feedback at WordPress.org!
24 November, 2023 01:12:20
eliodata
Topics: 14
Messages: 39
Hi,
Sorry for the delay but I finally change the way I store the datas for some fields. Your code works great!
Thank you, again!