Jump to content

Edit History

pepperoni

pepperoni

Hi,

I have been searching in the forum and saw that other people are interested to achieve this but looks like there hasn't been any solution for this. A bit sad really.

There are many courriers out there that use more than one parameter to track parcels. So by default prestashop uses a single parameter, tracking id and I'm trying to add another one, the post code.

I have managed to add it in one of the places, there more though.

Unfortunately looks like this is a core change. I have edited the file AdminOrdersController in controllers/admin/.

Around line 487 there is this

$templateVars = array(
  '{followup}' => str_replace('@', $order->shipping_number, $carrier->url),
  '{firstname}' => $customer->firstname,
  '{lastname}' => $customer->lastname,
  '{id_order}' => $order->id,
  '{shipping_number}' => $order->shipping_number,
  '{order_name}' => $order->getUniqReference()
);

I found out this code is responsible for the email the buyer gets with the tracking url.

Now to add the postcode I'm querying the db. So before this piece of code I do this:

$post_code = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
  SELECT a.postcode
  FROM `' . _DB_PREFIX_ . 'address` a
  WHERE a.id_address = '.(int)$order->id_address_invoice.' ');

This will give me an array as a result.

The the {followup} would become like this:

'{followup}'=> str_replace('@', $order->shipping_number, $carrier->url)."&postcode=".$post_code[0]['postcode'],

That is because I want my tracking url to be like this:

https://apc-overnight.com/track-parcel.php?id=[22 DIGIT IDENTIFIER]&postcode=[POSTCODE]

This is all fine but there are more places to tweak.

- In the BO the Order page. There is a place to enter the tracking id and that is a link too.

- For customer, the order history page has a link there too.

How can I achieve this and progress further?

Any help is much appreciated.

many thanks

Otto

 

 

prestashop version 1.6

pepperoni

pepperoni

Hi,

I have been searching in the forum and saw that other people are interested to achieve this but looks like there hasn't been any solution for this. A bit sad really.

There are many courriers out there that use more than one parameter to track parcels. So by default prestashop uses a single parameter, tracking id and I'm trying to add another one, the post code.

I have managed to add it in one of the places, there more though.

Unfortunately looks like this is a core change. I have edited the file AdminOrdersController in controllers/admin/.

Around line 487 there is this

$templateVars = array(
  '{followup}' => str_replace('@', $order->shipping_number, $carrier->url),
  '{firstname}' => $customer->firstname,
  '{lastname}' => $customer->lastname,
  '{id_order}' => $order->id,
  '{shipping_number}' => $order->shipping_number,
  '{order_name}' => $order->getUniqReference()
);

I found out this code is responsible for the email the buyer gets with the tracking url.

Now to add the postcode I'm querying the db. So before this piece of code I do this:

$post_code = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
  SELECT a.postcode
  FROM `' . _DB_PREFIX_ . 'address` a
  WHERE a.id_address = '.(int)$order->id_address_invoice.' ');

This will give me an array as a result.

The the {followup} would become like this:

'{followup}'=> str_replace('@', $order->shipping_number, $carrier->url)."&postcode=".$post_code[0]['postcode'],

That is because I want my tracking url to be like this:

https://apc-overnight.com/track-parcel.php?id=[22 DIGIT IDENTIFIER]&postcode=[POSTCODE]

This is all fine but there are more places to tweak.

- In the BO the Order page. There is a place to enter the tracking id and that is a link too.

- For customer, the order history page has a link there too.

How can I achieve this and progress further?

Any help is much appreciated.

many thanks

Otto

×
×
  • Create New...