Send an email displaying the clone values
- This topic has 4 replies, 2 voices, and was last updated 2 years ago by
Peter.
-
AuthorPosts
-
March 29, 2023 at 4:57 AM #41253
Leora Dodrill
ParticipantIs it possible to use this rwmb_get_field_settings code inside rwmb_frontend_after_process action in order to send an email displaying the clone values? I tried implode but it didn't work because I don't know how to specifically call the clone: $Output = implode(",", $item_selection);
<?php $field = rwmb_get_field_settings( 'my_field_id' ); $options = $field['options']; $values = rwmb_meta( 'my_field_id' ); ?> <ul> <?php foreach ( $values as $clone ) : ?> <li> <ul> <?php foreach ( $clone as $value ) : ?> <li> Value: <?= $value ?><br> Label: <?= $options[ $value ] ?> </li> <?php endforeach ?> </ul> </li> <?php endforeach ?> </ul>
March 29, 2023 at 6:40 PM #41256Peter
ModeratorHello,
Yes, it is possible. But you need to pass the post ID to the third parameter of the function
rwmb_get_field_settings()
to get the field settings. For example:$field = rwmb_get_field_settings( 'my_field_id', '', $post_id );
Read more on the documentation https://docs.metabox.io/functions/rwmb-get-field-settings/
April 4, 2023 at 3:48 AM #41322Leora Dodrill
ParticipantHello,
I just can't get it to work in email. I do have it working in Views and now would like to use orderby: 'clone.select_d8hqbs14ib6.label', order: 'ASC' but this is missing something. Can you help, please?{% for clone in post.item_selection_group, orderby: 'clone.select_d8hqbs14ib6.label', order: 'ASC' }
<td class="cs-items">{{ clone.select_d8hqbs14ib6.label }}</td>
<td class="cs-items">{{ clone.number_e37aexcx7p }}</td>
<td class="cs-items">{{ clone.brand_and_item_description }}</td>
<td class="cs-items">{{ clone.size }}</td>
<td class="cs-items">{% for item in clone.checkbox_vuqlhl9pcq %}
{{ item.value }}
{% endfor %}</td>
<td class="cs-items">{{ clone.first_alternate }}<br>{{ clone.second_alternate }}<br>{{ clone.third_alternate }}</td>
<td class="cs-items">{{ mb.checkbox( clone.prefer_organic, 'Yes', 'No' ) }}</td>
<td class="cs-items">{{ mb.checkbox( clone.organic_only, 'Yes', 'No' ) }}</td>
</tr>
{% endfor %}April 4, 2023 at 4:20 AM #41323Leora Dodrill
ParticipantHello,
I see that loops are scoped so need to declare set before the loop. I'm having trouble now because posts_per_page must be wrong?{% set args = { post_type: 'item_selection_group', posts_per_page: -1, orderby: 'date', order: 'ASC' }
%}
{% set post.item_selection_group = mb.get_posts( args ) %}April 4, 2023 at 11:32 PM #41339Peter
ModeratorHello,
There are some issues in your View code:
- If you want to set the variable, don't use the dot (.)
{% set item_selection_group = mb.get_posts( args ) %}
- There is no format to use the order in the for loop like that
{% for clone in post.item_selection_group, orderby: 'clone.select_d8hqbs14ib6.label', order: 'ASC' }
If you are new to Twig, please read more in the documentation
https://docs.metabox.io/extensions/mb-views/#twigIf you are not able to accomplish the task, please create a customization service request here https://metabox.io/contact/, our development team will help you with an extra fee.
-
AuthorPosts
- You must be logged in to reply to this topic.