Jump to content

Olny show discount if there is a discount in mail templates


Paul de Cocq

Recommended Posts

Hi everyone,

 

For one of our customers we need to make a little tweak in the prestaShop order_conf.html email template. The issue is we want to (see photo) disable the <tr> (circled in red) with the discount tag if the customer has no discount, en we want to enable it when the customer is given a discount.

 

so what i really need is 2 email templates:

 - order_conf.html (default)

 - order_conf2.html (with no discount rule)

 

 

so i'd really appreciate it if anyone can help me in the right direction with this issue.

 

Thanks in advance

Paul

 

 

 

post-723013-0-48430900-1403265196_thumb.png

Link to comment
Share on other sites

Maybe not the most beautifull way to do it, but it works.

If anyone has any suggestions on how to do it in a better way, please let me know ;-) 

if (Validate::isEmail($this->context->customer->email))


    if($order->total_discounts > 0){
       Mail::Send(
         (int)$order->id_lang,
         'order_conf_no_discounts',
         Mail::l('Order confirmation', (int)$order->id_lang),
         $data,
         $this->context->customer->email,
         $this->context->customer->firstname.' '.$this->context->customer->lastname,
         null,
         null,
         $file_attachement,
         null, _PS_MAIL_DIR_, false, (int)$order->id_shop
        );
   }else{
      Mail::Send(
      (int)$order->id_lang,
      'order_conf',
       Mail::l('Order confirmation', (int)$order->id_lang),
       $data,
       $this->context->customer->email,
       $this->context->customer->firstname.' '.$this->context->customer->lastname,
       null,
       null,
       $file_attachement,
       null, _PS_MAIL_DIR_, false, (int)$order->id_shop
     );
}
Edited by Paul de Cocq (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...