Jump to content

Email Template Problem


clatronic321

Recommended Posts

Hello reader,

 

i have a huge problem with the emails.

 

I want to add the order address to the template "cheque"

 

post-903337-0-31009000-1458557817_thumb.jpg

 

The name of the variables is from the "order_conf"

 

When a customer gets the email. You do not see the shipping address.

 

They see the variables.

 

post-903337-0-82879900-1458558229_thumb.jpg

 

I have to do to fix the errors?

Many thanks.

Link to comment
Share on other sites

You must add this variable to module.

 

If you want to add delivery address to mail:

  1. Open file: /modules/cheque/controllers/front/validation.php
  2. Replace this:
    $mailVars = array(
        '{cheque_name}' => Configuration::get('CHEQUE_NAME'),
        '{cheque_address}' => Configuration::get('CHEQUE_ADDRESS'),
        '{cheque_address_html}' => str_replace("\n", '<br />', Configuration::get('CHEQUE_ADDRESS')));
    

    to:

    $delivery = new Address((int)$cart->id_address_delivery);
    $formattedDelivery = AddressFormat::generateAddress($delivery, array('avoid' => array()), "\n", ' ', array());
            
    $mailVars = array(
        '{delivery_block_txt}' => $formattedDelivery,
        '{cheque_name}' => Configuration::get('CHEQUE_NAME'),
        '{cheque_address}' => Configuration::get('CHEQUE_ADDRESS'),
        '{cheque_address_html}' => str_replace("\n", '<br />', Configuration::get('CHEQUE_ADDRESS')));
  3.  Done ;) 
Link to comment
Share on other sites

Hello Kalifsoup,

 

 

i have replace this to validation.php

 

but it is still the same.

 

I have make a test.

 

In the cheque template is the variable "{ORDER_NAME}"

 

I copy this to another line.

 

post-903337-0-96075100-1458600690_thumb.jpg

 

(The blue line)

 

And then i make a test.

 

post-903337-0-75041800-1458600691_thumb.jpg

 

The same variable in the same Template.

 

It is not working.

 

Where i make an error?

 

My Prestashop version is the 1.6.1.4

 

 

Link to comment
Share on other sites

For test open file: /classes/order/OrderHistory.php and after this:

        if (isset($result['template']) && Validate::isEmail($result['email']))
        {

paste:

            if ($result['template'] == 'cheque')
            {
                $template_vars['delivery_block_txt'] = 'it works!';
            }  

Check {delivery_block_txt} in mail.

Link to comment
Share on other sites

Open file: /classes/order/OrderHistory.php and after this:

    if (isset($result['template']) && Validate::isEmail($result['email']))
    {

paste this:

            // add delivery address to 'cheque.html' mail template
            if ($result['template'] == 'cheque')
            {
                $order = new Order((int) $this->id_order);
                $delivery = new Address((int) $order->id_address_delivery);
                
                $template_vars['delivery_block_html'] = AddressFormat::generateAddress(
                                $delivery, array('avoid' => array()), "\n", ' ', array()
                );
            }

Check {delivery_block_html} in mail.

 
Give me 'Like' if I helped you  :)
  • Like 1
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...