Add tracking numbers to "shipped" order status

  • Posts: 57
  • Thank you received: 2
9 years 9 months ago #163281

I was wondering, here in the Netherlands, an with a lot of webshops its common that in the e-mail you get that your order has been shipped, you get a trackingnumber for your order.

However so far, I've not bene able to see this in Hikashop. I was wondering if this is even possible right now? Or maybe with a plugin?
Basically, what I'd like to have is that when the order status gets changed, to "shipped":

That in the backend you can select the order status "shipped" and notify the customer, + add a tracking number, prntscr.com/409gwx and maybe the website to track the order with?

Perhaps, this can be achieved by custom fields? But I've not been able to find any informatiion about that yet? Can someone please comfirm if this can be done?

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 9 months ago #163288

Hi,

The tracking number can indeed be added thanks to the custom fields.
Via the menu Display > Custom fields, you can create one custom field in the table "order" and hide it for the frontend.
Then when editing the order status, fill the infos related on the tracking number.

You can create two fields, one for the shipping company, and one for the tracking number.

Finally, you can edit the order_status_notification email and add the custom field data if the order status is "shipped".
It will require only some PHP code.

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 2
9 years 9 months ago #163412

Great! I was already afraid that this would not be possible.

So Xavier, I want to accomplish the following,

When an order is shipped with shipping company, X (PostNL) I want it to display the trackingnumber and as a hyperlink,
with 2 VARIABLES in it,

- $tracking_number
- $zip_code

That will result in the following url

www.postnlpakketten.nl/klantenservice/tr...B=[b$tracking_number [/b]&P=$zip_code

And I want that to display as a hyperlink

so, would this work?

If shipping company = $PostNL (equal too) ; 
do:
<a href="http://www.postnlpakketten.nl/klantenservice/tracktrace/basicsearch.aspx?lang=nl&amp;B=$tracking_number&amp;P=$zip_code" target="_blank"><strong>$tracking_number</strong></a>
else;
You can track your shipment with 17track, by clicking this url http://www.17track.net/en/result/post.shtml?nums=$tracking_number
Your tracking number is $tracking_number

Could this be done with Hikashop's email templates you think? Thanks!

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 9 months ago #163415

Hi,

You can use code like:

<?php
$shippingClass = hikashop_get('class.shipping');
$shipping_name = '';
if(!is_numeric($data->cart->order_shipping_id)){
	$shipping_name=$shippingClass->getShippingName($data->cart->order_shipping_method,$data->cart->order_shipping_id);
}
if($shipping_name == 'SHIPPING_METHOD_NAME'){
	echo '<a href="http://www.postnlpakketten.nl/klantenservice/tracktrace/basicsearch.aspx?lang=nl&B='.$data->order->tracking_number.'&P='.$data->order->zip_code.'" target="_blank"><strong>'.$data->order->tracking_number.'</strong></a>';
}else{
	echo 'You can track your shipment with 17track, by clicking this url http://www.17track.net/en/result/post.shtml?nums='.$data->order->tracking_number.'<br/>Your tracking number is '.$data->order->tracking_number;
}
?>

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 2
9 years 9 months ago #163590

Hey Xavier, looks promising! I just have a question, if I edit the e-mail templates right? What happens after I update hikashop? Will the edits be lost? And need to be reput there? Or else?

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 9 months ago #163611

Hi,

If you edit the emails directly via FTP, yes you will have to do the modifications again after each updates.
Thanks to the business edition, you can edit the emails via the menu System > Emails and you will not lose changes when updating.

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 2
9 years 9 months ago #163679

Great answer! Thank you!

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 2
9 years 9 months ago #164193

Hi Xavier,

Just wondering,

- The e-mail that I need to edit for the notification of shipping, is called order status notification right?
prntscr.com/409r9g

- I made the following shipping methods:



- I added 1 custom field, tracking_number under the Order table. See screenshot:


The code will work this way? So now when the shipping method is PostNL <10KG, it will get the postnl url right?

- Another thing is that, the zip_code is a variable too, could that be asked for too with the code? the user must have that filled in during the order. and it is needed for the postnl track and trace?

I believe you need address_post_code for that?

Could you please add that?
<?php
$shippingClass = hikashop_get('class.shipping');
$shipping_name = '';
if(!is_numeric($data->cart->order_shipping_id)){
	$shipping_name=$shippingClass->getShippingName($data->cart->order_shipping_method,$data->cart->order_shipping_id);
}
if($shipping_name == 'PostNL Pakket < 10KG'){
	echo '<a href="http://www.postnlpakketten.nl/klantenservice/tracktrace/basicsearch.aspx?lang=nl&B='.$data->order->tracking_number.'&P='.$data->order->zip_code.'" target="_blank"><strong>'.$data->order->tracking_number.'</strong></a>';
}else{
	echo 'You can track your shipment with 17track, by clicking this url http://www.17track.net/en/result/post.shtml?nums='.$data->order->tracking_number.'<br/>Your tracking number is '.$data->order->tracking_number;
}
?>

Last edit: 9 years 9 months ago by iwally.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 9 months ago #164215

Hi,

Yes the code work this way.
To have the zip_code, thanks to use this code:

<?php
$shippingClass = hikashop_get('class.shipping');
$shipping_name = '';
if(!is_numeric($data->cart->order_shipping_id)){
	$shipping_name=$shippingClass->getShippingName($data->cart->order_shipping_method,$data->cart->order_shipping_id);
}
if($shipping_name == 'PostNL Pakket < 10KG'){
	$zip_code = $fieldsClass->show($field,$data->cart->shipping_address->address_post_code,'00000');
	echo '<a href="http://www.postnlpakketten.nl/klantenservice/tracktrace/basicsearch.aspx?lang=nl&B='.$data->order->tracking_number.'&P='.$zip_code.'" target="_blank"><strong>'.$data->order->tracking_number.'</strong></a>';
}else{
	echo 'You can track your shipment with 17track, by clicking this url http://www.17track.net/en/result/post.shtml?nums='.$data->order->tracking_number.'<br/>Your tracking number is '.$data->order->tracking_number;
}
?>

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 2
9 years 9 months ago #164320

Hey Xavier, Thanks again!

I have another question, how can I edit only the shipped status e-mail, I can find the order confirmed e-mail in the backend, but what e-mail template is for the shipped e-mail status? Are they all in the same e-mail template?

Can you explain to me how to do edit only the shipment e-mail?

And another question, if I made a few edits, what is the easiest way to view my changes in the shipment e-mail?

Thanks!

prntscr.com/4331nd

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 9 months ago #164329

Hi,

Yes they are all in the same email, "order status notification".
So you have to add an if condition like:

<?php
if($data->mail_status == 'shipped'){
  // Display what you want
} 
?>

The easiest way is to edit an order status in the backend, and enable the option to notify the customer.
This will display you the content of the email in the popup, no need to send it.

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 2
9 years 9 months ago #164408

Hey Xavier,

I have another question,

I added this to as a Hikashop translation to the e-mail template,
<?php echo JText::_('HIKA_MY_ACCOUNT') ?>

However, that text is not recognized, so I added a language override in Joomla for Dutch to make it:
HIKA_MY_ACCOUNT = Mijn Account.

However, now when my back-end is on English, and I try to send the e-mail to customers, the template looks like this, everything is in Dutch except for my translation of HIKA_MY_ACCOUNT.

Why and how do you put that on English too?

prntscr.com/43brsr

I added a custom link to the e-mail saying, "my account" I added a Joomla translation for MY_ACCOUNT to the Dutch translation, but in the e-mail the language is still English. for that variable? Why?

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
9 years 9 months ago #164483

Hello,
Did you added it like this :

HIKA_MY_ACCOUNT = Mijn Account.
Because you should add it like this :
HIKA_MY_ACCOUNT = "Mijn Account."

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 2
9 years 9 months ago #164524

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
9 years 9 months ago #164599

Hi,

When using the Joomla language overrides, you don't need the double quotes.
Mohamed was thinking that you were using our translation override system through HikaShop > Configuration > Language.

Could you try to use our system instead of the Joomla one ? To see if that change anything ? (don't put spaces in the string).

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 2
9 years 9 months ago #164644

Hi! I think I have found my problem, ;) My e-mail template won't translate to dutch. Everything is in English, nothing in Dutch.
Even when I put the administrator language on Dutch, the e-mail template at notify customer stays in English.

I did what you said, and that works, but I can't get the -email to be in Dutch anymore? Have I done something wrong? Please tell me ;)

EDIT: NEVERMIND!

I put the defeault site language on Englosh ;) Stupid sorry

Last edit: 9 years 9 months ago by iwally.

Please Log in or Create an account to join the conversation.

  • Posts: 57
  • Thank you received: 2
9 years 8 months ago #170187

Hey Xavier,

I dont know what happened but I can no longer add the tracking number on the change status of the order?
prntscr.com/4jxct8

Did I remove some code? Or what did I do? The field is activated like this,
prntscr.com/4jxd7c

I want the button to be here like, this:

prntscr.com/4jzs5a

Last edit: 9 years 8 months ago by iwally.

Please Log in or Create an account to join the conversation.

  • Posts: 81604
  • Thank you received: 13082
  • MODERATOR
9 years 7 months ago #170249

Hi,

There has never been the display of the custom fields in the order status modification popup.
Normally, you do it in two steps.
First, you open your order and click on the edit icon of the "additional information" area and that will allow you to add the tracking number in the corresponding field.
Second, you change the status of the order and you send the notification.

Please Log in or Create an account to join the conversation.

  • Posts: 5
  • Thank you received: 0
9 years 5 months ago #179414

Hi
how do I make a track & trace code into the mail order shipped

below is the link to post Denmark
without track No.


www.postdanmark.dk/da/Sider/TrackTrace.aspx?view=item&itemid=

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
9 years 5 months ago #179435

Hello,
You can just do as Nicolas said :

First, you open your order and click on the edit icon of the "additional information" area and that will allow you to add the tracking number in the corresponding field.
Second, you change the status of the order and you send the notification.

But note that you'll have to create a " track & trace code" order custom field.

Please Log in or Create an account to join the conversation.

Time to create page: 0.125 seconds
Powered by Kunena Forum