Seller Name/Lastname function in Mail Templates (Woocommerce)

  • Home
  • Forums
  • Dokan
  • Seller Name/Lastname function in Mail Templates (Woocommerce)
This topic contains 11 reply and 5 voices, and was last updated by Aaron M 10 years, 2 months ago
Viewing 11 Posts - 1 through 11 (of 11 total)
Author Posts
June 19, 2014 at 3:53 pm 22191
Aaron M Hi, Im trying to integrate the seller name and last name in the email templates when an order is made. So I have put admin-new-order.php in wp-content/themes/dokan/woocommerce/emails/ to override the default woocommerce template but or it doesent send, or it doesnt work. I tried with : 1- (Dokan Variable) 2 -seller_first_name . ' ' . $order->seller_last_name ); ?> (Woocommerce variable?) 3 - (Dokan Variable) 4 - (Dokan Variable) Anybody could help me with that, I'm stuck here Thanks in Advance!
June 19, 2014 at 8:12 pm 22202
Will Will

Just a quick thought but double check you’re using the actual Dokan theme and not a child theme? If you’re not using a child theme I’d suggest you do that so you don’t overwrite these emails when you update the theme.

June 19, 2014 at 9:50 pm 22207
Rubens Rubens

Hi Will, Im using the child theme Thank you for the light 🙂

June 19, 2014 at 9:53 pm 22208
Will Will

If you’re using the child theme then you should be putting it in wp-content/themes/dokan-child/woocommerce/emails/ I believe – not in the Dokan theme.

June 19, 2014 at 10:02 pm 22210
Rubens Rubens

Yes done. It’s safer this way. Still looking how to include the variable ^^

June 22, 2014 at 1:23 pm 22292
Sk Sk

Hello Rubens,

you could use the fowlling hook to send mail.

do_action( 'dokan_checkout_update_order_meta', $order_id );

$order_id is order post ID. you could get all information through it.

To write email template please check dokan default templates from dokan/includes/emails
and check mail sending function from dokan/classes/email.php

Thank you.

July 23, 2014 at 1:57 pm 24011
Aaron M Aaron M

hi Rubens, you could add the seller info to emails?

July 23, 2014 at 5:03 pm 24016
Rubens Rubens

>> Sk_Shaikat: Thank you but what I just need is the variables to show the seller First and Last name into the emails.
>> Aaron: Nop I haven’t succeeded to add the seller infos variables into the Mails

August 3, 2014 at 6:07 pm 24436
Sk Sk

Hello Rubens,

write this function in dokan/function.php

function order_email_include_saler_name( $order ) {
        $saler_id = dokan_get_seller_id_by_order( $order->id );
        $saler_info = get_user_by( 'id', $saler_id );

        ?>
        <table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">
            
            <tfoot>
                <tr>
                    <th scope="row" style="text-align:left; width: 57%; border: 1px solid #eee; <?php  echo 'border-top-width: 4px;'; ?>"><?php _e( 'Saler Name:' ); ?></th>
                    <td style="text-align:left; border: 1px solid #eee; <?php  echo 'border-top-width: 4px;'; ?>"><?php echo $saler_info->display_name; ?></td>
                </tr>
            </tfoot>
        </table>
        <?php
    }

and this add action in construct function


add_action( 'woocommerce_email_after_order_table', array( $this, 'order_email_include_saler_name' ) );

Thank you

August 30, 2014 at 2:23 pm 26068
SCHAEPPER SCHAEPPER

Hi, thanks for this function. Is there a way to change the parameter to show the shop name instead of the Seller Name? The shop name is more meaningful for the buyer than the seller name. Thanks in advance for any tips.

August 31, 2014 at 12:35 pm 26112
Sk Sk

Hello SCHAEPPER,
just use the following function rather than that.

[php]
function order_email_include_saler_name( $order ) {
$saller_id = dokan_get_seller_id_by_order( $order->id );
$store_info = dokan_get_store_info( $saller_id );

?>
<table cellspacing="0" cellpadding="6" style="width: 100%; border: 1px solid #eee;" border="1" bordercolor="#eee">

<tfoot>
<tr>
<th scope="row" style="text-align:left; width: 57%; border: 1px solid #eee; <?php echo ‘border-top-width: 4px;’; ?>"><?php _e( ‘Store Name:’ ); ?></th>
<td style="text-align:left; border: 1px solid #eee; <?php echo ‘border-top-width: 4px;’; ?>"><?php echo esc_html( $store_info[‘store_name’] ); ?></td>
</tr>
</tfoot>
</table>
<?php
}
[/php]

Thank you 🙂

September 1, 2014 at 1:34 am 26125
Aaron M Aaron M

works perfect, thanks sk_shaikat

Viewing 11 Posts - 1 through 11 (of 11 total)