• Resolved mmoretti

    (@mmoretti)


    Hello,

    In the vendor-new-order.php file, we have a part that he gives the “subtotal commission” “tax subtotal” “shipping subtotal” and “total”.
    how to leave only the “total” of these 4 lines? how to remove the others 3?

    I think its something here :
    “foreach ($totals as $total_key => $total)”
    but i dont know the vars to edit this…. someone can helpme?

Viewing 3 replies - 1 through 3 (of 3 total)
  • @mmoretti, Override the “vendor-new-order.php” template file and add this following code :

    foreach ($totals as $total_key => $total) {
    if($total_key == 'total') { ?>
    <tr>
           	<th scope="row" colspan="2" style="text-align:left; border: 1px solid #eee;"><?php echo $total['label']; ?></th>
           	<td style="text-align:left; border: 1px solid #eee;"><?php echo $total['value']; ?></td>
       	</tr>
       	<?php
    }
    }
    Thread Starter mmoretti

    (@mmoretti)

    <?php
    /**
     * The template for displaying demo plugin content.
     *
     * Override this template by copying it to yourtheme/dc-product-vendor/emails/vendor-new-order.php
     *
     * @author 		WC Marketplace
     * @package 	dc-product-vendor/Templates
     * @version   0.0.1
     */
    if (!defined('ABSPATH'))
        exit; // Exit if accessed directly 
    global $WCMp;
    $vendor = get_wcmp_vendor(absint($vendor_id));
    do_action( 'woocommerce_email_header', $email_heading, $email );
    ?>
    
    <p><?php printf(__('Um novo pedido de %s, está sendo processado. Segue os detalhes :', 'dc-woocommerce-multi-vendor'), $order->get_billing_first_name() . ' ' . $order->get_billing_last_name()); ?></p>
    
    <?php do_action('woocommerce_email_before_order_table', $order, true, false); ?>
    <table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
        <thead>
            <tr>
                <?php do_action('wcmp_before_vendor_order_table_header', $order, $vendor->term_id); ?>
                <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e('Produto', 'dc-woocommerce-multi-vendor'); ?></th>
                <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e('Quantidade', 'dc-woocommerce-multi-vendor'); ?></th>
                <th scope="col" style="text-align:left; border: 1px solid #eee;"><?php _e('valor', 'dc-woocommerce-multi-vendor'); ?></th>
                <?php do_action('wcmp_after_vendor_order_table_header', $order, $vendor->term_id); ?>
            </tr>
        </thead>
        <tbody>
            <?php
            $vendor->vendor_order_item_table($order, $vendor->term_id);
    
            ?>
        </tbody>
    </table>
    <?php
    if (apply_filters('show_cust_order_calulations_field', true, $vendor->id)) {
        ?>
        <table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
            <?php
            $totals = $vendor->wcmp_vendor_get_order_item_totals($order, $vendor->term_id);
            if ($totals) {
                foreach ($totals as $total_key => $total) {
                    if($total_key == 'total') { ?>
    <tr>
           	<th scope="row" colspan="2" style="text-align:left; border: 1px solid #eee;"><?php echo $total['label']; ?></th>
           	<td style="text-align:left; border: 1px solid #eee;"><?php echo $total['value']; ?></td>
       	</tr><?php
                }
            }
            ?>
        </table>
        <?php
    }
    if (apply_filters('show_cust_address_field', true, $vendor->id)) {
        ?>
        <h2><?php _e('Contatos do cliente:', 'dc-woocommerce-multi-vendor'); ?></h2>
        <?php if ($order->get_billing_email()) { ?>
            <p><strong><?php _e('Nome:', 'dc-woocommerce-multi-vendor'); ?></strong> <?php echo $order->get_billing_first_name() . ' ' . $order->get_billing_last_name(); ?></p>
            <p><strong><?php _e('Email:', 'dc-woocommerce-multi-vendor'); ?></strong> <?php echo $order->get_billing_email(); ?></p>
        <?php } ?>
        <?php if ($order->get_billing_phone()) { ?>
            <p><strong><?php _e('Telefone:', 'dc-woocommerce-multi-vendor'); ?></strong> <?php echo $order->get_billing_phone(); ?></p>
        <?php
        }
    }
    if (apply_filters('show_cust_billing_address_field', true, $vendor->id)) {
        ?>
        <table cellspacing="0" cellpadding="0" style="width: 100%; vertical-align: top;" border="0">
            <tr>
                <td valign="top" width="50%">
                    <h3><?php _e('Endere?o de cobran?a:', 'dc-woocommerce-multi-vendor'); ?></h3>
                    <p><?php echo $order->get_formatted_billing_address(); ?></p>
                </td>
            </tr>
        </table>
        <?php }
    ?>
    
    <?php if (apply_filters('show_cust_shipping_address_field', true, $vendor->id)) { ?> 
        <?php if (( $shipping = $order->get_formatted_shipping_address())) { ?>
            <table cellspacing="0" cellpadding="0" style="width: 100%; vertical-align: top;" border="0">
                <tr>
                    <td valign="top" width="50%">
                        <h3><?php _e('Endere?o de envio:', 'dc-woocommerce-multi-vendor'); ?></h3>
                        <p><?php echo $shipping; ?></p>
                    </td>
                </tr>
            </table>
        <?php
        }
    }
    ?>
    
    <?php do_action('wcmp_email_footer'); ?>

    Comission, tax and shipping remain, i think i didnt follow right your advice….

    The reason it was not working, because you didn’t close the : if ($totals) { ending equals to }

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Email template’ is closed to new replies.