Send an email displaying the clone values

Support General Send an email displaying the clone values

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #41253
    Leora DodrillLeora Dodrill
    Participant

    Is 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>
    #41256
    PeterPeter
    Moderator

    Hello,

    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/

    #41322
    Leora DodrillLeora Dodrill
    Participant

    Hello,
    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 %}

    #41323
    Leora DodrillLeora Dodrill
    Participant

    Hello,
    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 ) %}

    #41339
    PeterPeter
    Moderator

    Hello,

    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/#twig

    If 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.

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.