Jump to content

Outputting tracking # on order-detail.tpl


Recommended Posts

I just noticed that my customers cannot see their tracking # when they view order details. Since I cannot directly link to a tracking page due to the way my shipping company's website works, I need to be able to give them their tracking #

How can I output this on the order-detail page?

Link to comment
Share on other sites

  • 10 months later...

I have figured out a workaround for this.

After you mark the item as shipped, you have the box in the backend that allows you to enter tracking numbers. This only appears if the item is marked as shipped.

My problem was that I entered the tracking number and the customer got the email, but the tracking number wasn't in the email, only a link to the tracking website...

I think the email template is intended to auto fill in the tracking number when you select the followup URL but it doesn't work with Australia Post.

My solution was to include the tracking number and make it visible in the email.

Here's how it is done:

1. Go to your admin folder --> tabs -->and look for: 'AdminOrders.php'

2. Find the line containing the following code (for me it is line 83):

 '{followup}' => str_replace('@', $order->shipping_number, $carrier->url),



3. Add a new line of code below that line:

 '{shipping_number}' => $order->shipping_number,



4. Save the AdminOrders.php file

5. Go to the mails folder and open in_transit.html

6. Add somewhere in the file:

Your tracking number is: {shipping_number}



7. Save the in_transit.html file!

Voila, your tracking numbers are now sent in the emails when you enter the tracking number in the backend!

Tested it and it is working 100%.

NOTE: This will not add the tracking number to the order detail, this will only send an email to the customer when you enter the tracking number. If they lost it (or say they didn't receive it) even though you sent it before, just re-enter the tracking number in the back office and press "set shipping number." This will re-send the customer the tracking number.

Link to comment
Share on other sites

I have a similar issue in that the way our Courier's website works, the Prestashop system for creating the tracking URL only takes the customer to the homepage of the Courier company, also failing to 'fill in' the form field for the tracking number and submit it.

I have implemented sm3004's solution for the email, which is a good workaround - since we are only ever going to use the one courier company, I have also hardcoded the URL into the mail in_transit.html so that the link takes the customer to the actual tracking page (rather than the company's homepage), removing an extra manual step for the customer.

I have also managed to hardcode a solution to having the tracking number show in the order-detail.tpl page. Once again I have hardcoded the courier URL (this won't suit everyone of course). Here's what I added to order-detail.tpl around line 25:

{if $followup}

{l s='Track and Trace #:'} {$order->shipping_number}
{/if}
{if $followup}

{l s='Click the following link to enter your tracking number and trace your parcel...'}
{$followup|escape:'htmlall':'UTF-8'}
{/if}



The customer still has to copy and paste the tracking number, but at least they are able to find reference to it in the account history, without necessarily having to go through their emails to find it.

Hope this is helpful to someone...

Link to comment
Share on other sites

  • 11 months later...
  • 1 year later...

that aint work for me I am using 1.4.7.2

 

public function postProcess()
{
 global $currentIndex, $cookie;
 /* Update shipping number */
 if (Tools::isSubmit('submitShippingNumber') AND ($id_order = (int)(Tools::getValue('id_order'))) AND Validate::isLoadedObject($order = new Order($id_order)))
 {
  if ($this->tabAccess['edit'] === '1')
  {
   if (!$order->hasBeenShipped())
 die(Tools::displayError('The shipping number can only be set once the order has been shipped.'));
   $_GET['view'.$this->table] = true;
   $shipping_number = pSQL(Tools::getValue('shipping_number'));
   $order->shipping_number = $shipping_number;
   $order->update();
   if ($shipping_number)

   {


 global $_LANGMAIL;
 $customer = new Customer((int)($order->id_customer));
 $carrier = new Carrier((int)($order->id_carrier));
 if (!Validate::isLoadedObject($customer) OR !Validate::isLoadedObject($carrier))
  die(Tools::displayError());
 $templateVars = array(
  '{followup}' => str_replace('@', $order->shipping_number, $carrier->url),
  '{shippin_gnumber}' => $order->shipping_number,
										    '{firstname}' => $customer->firstname,
  '{lastname}' => $customer->lastname,
  '{id_order}' => (int)($order->id)
 );
 @Mail::Send((int)$order->id_lang,
 'in_transit',
 Mail::l('Package in transit',

 (int)$order->id_lang),
 $templateVars,
  $customer->email, $customer->firstname.' '.$customer->lastname, $order->shipping_number, NULL, NULL, NULL,
  _PS_MAIL_DIR_, true);


   }
  }
  else
   $this->_errors[] = Tools::displayError('You do not have permission to edit here.');
 }

Link to comment
Share on other sites

  • 2 weeks later...

I have figured out a workaround for this.

 

After you mark the item as shipped, you have the box in the backend that allows you to enter tracking numbers. This only appears if the item is marked as shipped.

 

My problem was that I entered the tracking number and the customer got the email, but the tracking number wasn't in the email, only a link to the tracking website...

 

I think the email template is intended to auto fill in the tracking number when you select the followup URL but it doesn't work with Australia Post.

 

My solution was to include the tracking number and make it visible in the email.

 

Here's how it is done:

 

1. Go to your admin folder --> tabs -->and look for: 'AdminOrders.php'

 

2. Find the line containing the following code (for me it is line 83):

 '{followup}' => str_replace('@', $order->shipping_number, $carrier->url),

 

3. Add a new line of code below that line:

 '{shipping_number}' => $order->shipping_number,

 

4. Save the AdminOrders.php file

 

5. Go to the mails folder and open in_transit.html

 

6. Add somewhere in the file:

Your tracking number is: {shipping_number}

 

7. Save the in_transit.html file!

 

Voila, your tracking numbers are now sent in the emails when you enter the tracking number in the backend!

 

Tested it and it is working 100%.

 

NOTE: This will not add the tracking number to the order detail, this will only send an email to the customer when you enter the tracking number. If they lost it (or say they didn't receive it) even though you sent it before, just re-enter the tracking number in the back office and press "set shipping number." This will re-send the customer the tracking number.

 

Nice, works on 1.4.8.2 too, txs

Link to comment
Share on other sites

  • 1 month later...

Okay - please excuse my ignorance - I'm only just starting out with PrestaShop so am in the midsts of a massive learning-curve.

 

My issue is that even after marking an order status as 'Shipped', I do not have ANYWHERE in the BO to place the tracking number for the order.

 

Where is that meant to be? I have searched the entire BO and can't find that anywhere - certainly not on the order summary page. Do I need a specific module installed to allow this to be shown?

 

Thanks in advance for any help.

 

 

**EDIT** Have found it - all good; thanks.

Edited by Austra02 (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...