Jump to content

Why is {shipping_number} empty?


Dove99x

Recommended Posts

I'm having trouble adding tracking number to email as it is showing up as blank version 1.6.1.7 . I went into "class/order/OrderHistory.php" and updated the code

$topic = $result['osname'];
            $data = array(
                '{lastname}' => $result['lastname'],
                '{firstname}' => $result['firstname'],
                '{id_order}' => (int)$this->id_order,
                '{order_name}' => $order->getUniqReference()
            );

to this below, but the when email template is sent out the {shipping_number} is empty. How can I fix this?

$topic = $result['osname'];
$data = array(
'{lastname}' => $result['lastname'],
'{firstname}' => $result['firstname'],
'{id_order}' => (int)$this->id_order,
'{shipping_number}' => $order->shipping_number,
'{order_name}' => $order->getUniqReference()
);
Link to comment
Share on other sites

Hi, you mean the mail that is received by the user that sends a message through the previous orders page?

 

If a tracking number is updated in the back office, users usually receive an email updating them. I'd like to add that tracking code to that shipping email:

HI {FIRSTNAME} {LASTNAME},

YOUR ORDER HAS BEEN SHIPPED    

ORDER {ORDER_NAME} - SHIPPED
Your order with the reference {order_name} has been shipped. Your tracking number is {shipping_number}

Problem is {shipping_number} is blank in the user email - even though in the back office there is a tracking number.

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

Ok! your logic seems correct. First be sure that you changed the correct email template. 

 

There are two possible sources of the mail templates. The first one is on the _root_directory/mails/ the second is _current_theme_/mails

 

be sure you are changing the second one.

 

Also check if the $order->shipping_number is not empty.

 

so I say you try this code 

$topic = $result['osname'];
$data = array(
'{lastname}' => $result['lastname'],
'{firstname}' => $result['firstname'],
'{id_order}' => (int)$this->id_order,
'{shipping_number}' => $order->shipping_number ? $order->shipping_number : 'NO NUMBER WAS GIVEN',
'{order_name}' => $order->getUniqReference()
);
Link to comment
Share on other sites

I suggest you use something like this 

$topic = $result['osname'];
$tracking_num = Db::getInstance()->getValue(
        'SELECT tracking_number FROM '._DB_PREFIX_.'order_carrier '
        .'WHERE id_order = '.$this->id_order
    );
$data = array(
'{lastname}' => $result['lastname'],
'{firstname}' => $result['firstname'],
'{id_order}' => (int)$this->id_order,
'{shipping_number}' => $tracking_num,
'{order_name}' => $order->getUniqReference()
);
Edited by BalzoT (see edit history)
Link to comment
Share on other sites

  • 2 years later...
  • 1 year later...

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