Jump to content

Order Confirmation Mail Hooks


yasic

Recommended Posts

Hi, i'm starting to get crazy here,

I want to change the order confirmation mail and i want to include:

  • Total products price without taxes
  • Discounts
  • Delivery without taxes
  • All taxes combined (products + delivery)
  • Total price with tax

I can't find the hooks to use in the mail template, the only one that works correctly is total_paid

 

Can someone tell me which hooks to use to get the list above?

Thanks

Link to comment
Share on other sites

Sorry for reposting again, but my problem is really more complicated than i thought,

i need the total price without taxes, the taxes total as well as the price with taxes only for one language which is why i don't know how to change the mail settings in php. anyone?

Link to comment
Share on other sites

Hi yasic,

 

all variables (hooks as you said) for order confirmation mail are prepared in PaymentModule.php class. Look at that file and investigate what variables you can use in mail templates. If you need other ones just add them into that class. Mail templates are separate files for each language so there is no problem to show "price with tax" only for one.

Link to comment
Share on other sites

Hi yasic,

 

all variables (hooks as you said) for order confirmation mail are prepared in PaymentModule.php class. Look at that file and investigate what variables you can use in mail templates. If you need other ones just add them into that class. Mail templates are separate files for each language so there is no problem to show "price with tax" only for one.

 

hi sebkos,

thanks for your help, the problem is i haven't found a site yet where i can see how to write new variables, could you give me an example or a link?

thanks

Link to comment
Share on other sites

Some hints you can find in mentioned file.

 

For example there are shipping costs with and without tax

$order->total_shipping_tax_excl = (float)$this->context->cart->getPackageShippingCost((int)$id_carrier, false, null, $order->product_list);
$order->total_shipping_tax_incl = (float)$this->context->cart->getPackageShippingCost((int)$id_carrier, true, null, $order->product_list);

 

only thing to do is to add them to variables

'{total_shipping_incl}' => Tools::displayPrice($order->total_shipping_tax_incl, $this->context->currency, false),
'{total_shipping_excl}' => Tools::displayPrice($order->total_shipping_tax_excl, $this->context->currency, false),

 

and then use those variables in mail template

<td style="background-color: #dde2e6; padding: 0.6em 0.4em;">{total_shipping_incl}</td>
<td style="background-color: #dde2e6; padding: 0.6em 0.4em;">{total_shipping_excl}</td>

Link to comment
Share on other sites

this makes things clearer, but i tried with the shipping costs first, i added them to the variables and then to the mail template, but now it always shows shipping costs at 0€ and the total_products is now without taxes.

 

what is it that i'm missing?

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