Jump to content

backoffice_order email add variables


Recommended Posts

Hi everyone.

I look everywhere but couldnt find a solution yet.

How can we add new variables to the backoffice_order email template?

When creating backoffice order, I want to add the "Order Message" we enter to be visible in the email too.

Plus I want to add customer email and password too.

Link to comment
Share on other sites

Now I can add customer email in the email by editing

/controllers/admin/AdminOrdersController.php #1871

I added '{email}' => $customer->email.

 

But I am having problem with "Order message" part to show in the email template;

I tried;

'{message}' => Tools::nl2br($order_message),

or

'{message}' => Tools::nl2br($message),

 

didnt print the messages in the email.

 

 

How can we add the content of "order message" field when creating order from "backoffice order"?

email template is backoffice_order

Edited by putocito (see edit history)
Link to comment
Share on other sites

Thank you Nemo for the information.

 

But in backoffice order creation, message should be send to email before creating the order. So id_order is 0,

 

Incase anyone needed, Solution I hack is I added another function to Cart.php

public function getBackofficeOrderMessage()
    {
        return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
            SELECT `message`
            FROM `'._DB_PREFIX_.'message`
            WHERE `id_cart` = '.(int)$this->id.'
            ORDER BY `id_message`
        ');
    }

 

and then call that from AdminOrdersController.php and assign to mailvars.

'{order_message}' => $cart->getBackofficeOrderMessage()

Edited by putocito (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...