Tracking Number not showing in invoice.tpl email

Hi all,



No matter what I try I cannot get {$shipping.tracking_number} to return anything, I created a shipment for my order:



#9 #22 09/02/2011 09/01/2011 Support Andrew



Shipment #9 on 09/01/2011 by Custom shipping method (andy8520) (DHL)



So my question is when I get my email confirmation for order #22 why does it not show my my tracking number:



Here is the code in invoice.tpl:


```php





{if $shipping.tracking_number}


{$lang.tracking_number}:

{$shipping.tracking_number}



{/if}

```

One strange observation in the cscart_orders table there is nothing showing for 'shipping_ids' is that normal?

Thanks all.

Andy

If you are using shipments , then tracking number should be included in the shipment notification not INVOICE, but not clickable where it will take you to the tracking page of the shipping company . I actually modified it where the Tracking number is clickable. If interested I can post what I did.



Joe

Thank you Joe for the guidance.



Any advice on how I can specify in the order status manager that it should use the shipping template and not the invoice template?



Any help would be appreciated.

before I can give you any advise, what version are you using?

[quote name='gasngrills' timestamp='1315272975' post='121035']

before I can give you any advise, what version are you using?

[/quote]



Hi gasngrills,



I have the most recent version of CS-Cart, it was installed 3 weeks ago.



Thank you very much for your help here.



Andy

[quote name='andrewslack' timestamp='1315291023' post='121042']

Hi gasngrills,



I have the most recent version of CS-Cart, it was installed 3 weeks ago.



Thank you very much for your help here.



Andy

[/quote]



If you are using CS-Cart 2.2.2 Pro, then use the shipments feature by enabling it in settings/general - (Allow users to create shipments) . Now when you create a shipment, the customer receives an email with the tracking #.

It should show in the invoice whether you are using the shipments feature or not.



This is what the code snippet should look like:

{if $tracking_number_exists}

{$lang.tracking_number}:

{foreach from=$order_info.shipping item="shipping" name="f_shipp"}
{if $shipping.tracking_number}{$shipping.tracking_number}{if !$smarty.foreach.f_shipp.last},{/if}{/if}
{/foreach}

{/if}

Hi The Tool,



Sadly that is not working :(



It works in the Community Edition but not the Pro version see, it is quite strange.



I looked deeply at this and found the following:


  1. I have added manually a test shipment and it is shown in shipments section of my order.
  2. When I open the Invoice tracking info is missing
  3. When I open the packing slip from order details page again the tracking number is missing
  4. When I open that shipment and print packing slip from there the tracking number is shown. Weird…

    I have looked deeply inside the code and in core/fn.cart.php found this inside the function fn_get_order_info:


<br />
$additional_data = db_get_hash_single_array("SELECT type, data FROM ?:order_data WHERE order_id = ?i", array('type', 'data'), $order_id);<br />
...<br />
// Get shipping information<br />
if (!empty($additional_data['L'])) {<br />
$order['shipping'] = unserialize($additional_data['L']);<br />
}<br />

```<br />
<br />
Looking inside the order_data table I do not see any record added with type 'L'.<br />
And it is quite strange that in the Community edition everything works perfect, but in Pro when I add a new shipping no record is added in that table... The related code is the same in both versions.<br />
<br />
Any ideas/suggestions are welcome.<br />
Thanks in advance

[quote name=‘andrewslack’ timestamp=‘1315398747’ post=‘121145’]

Hi The Tool,



Sadly that is not working :(



It works in the Community Edition but not the Pro version see, it is quite strange.



I looked deeply at this and found the following:


  1. I have added manually a test shipment and it is shown in shipments section of my order.
  2. When I open the Invoice tracking info is missing
  3. When I open the packing slip from order details page again the tracking number is missing
  4. When I open that shipment and print packing slip from there the tracking number is shown. Weird…

    I have looked deeply inside the code and in core/fn.cart.php found this inside the function fn_get_order_info:


<br />
$additional_data = db_get_hash_single_array("SELECT type, data FROM ?:order_data WHERE order_id = ?i", array('type', 'data'), $order_id);<br />
...<br />
// Get shipping information<br />
if (!empty($additional_data['L'])) {<br />
$order['shipping'] = unserialize($additional_data['L']);<br />
}<br />

```<br />
<br />
Looking inside the order_data table I do not see any record added with type 'L'.<br />
And it is quite strange that in the Community edition everything works perfect, but in Pro when I add a new shipping no record is added in that table... The related code is the same in both versions.<br />
<br />
Any ideas/suggestions are welcome.<br />
Thanks in advance<br />
[/quote]<br />
<br />
That is because shipping and shipments are two different things, when CS-Cart added the shipment feature to the 2.0.x branch , now you can use either/or but not both. I personally don't like this but I chose shipment since it gives me the ability to split shipments. When you create a shipment you have the option to notify the customer and the tracking # will be included in the that email. In the community edition shipment is not available so the normal shipping option to be used which will add tracking # to INVOICE . I really hate this functionality of the software, but that is what it is, sometimes the simple things are missing in cs-cart.

[quote name='The Tool' timestamp='1315327953' post='121078']

It should show in the invoice whether you are using the shipments feature or not.



This is what the code snippet should look like:

{if $tracking_number_exists}

{$lang.tracking_number}:

{foreach from=$order_info.shipping item="shipping" name="f_shipp"}
{if $shipping.tracking_number}{$shipping.tracking_number}{if !$smarty.foreach.f_shipp.last},{/if}{/if}
{/foreach}

{/if}


[/quote]



Unfortunately that is not the case as far as I can tell, shipping.tracking_number and shipment.tracking_number are two different things, when shipments is enabled then the normal input fields in order detail page in back end for tracking info is gone . You can't use both at the same time.

Exact same issue along with the mails not sending for the status



Our cart work flow has several status in the workflow

incomplete → processed → being packed → dispatched



dispatch has the tracking information added via shipment method, its merged via a php scripts from XML barcode scanners



I'm trying to get the cart to send email for dispatched status with the tracking number included,

(So they phone the courier company and not the client)



I've added the new carrier as per instructions and seems to be working correctly



But I can't get emails to send? Print packaging slip won't pull the tracking id number in “Order View”

But if I access it via the shipments menu and select print packaging slip it does pull the tracking id and the carrier correctly



Cash Offered for anyone that can figure this one?



Just need help from someone who has sent the emails correctly for shipments custom carrier (NOT UPS or USPS)





Want to use .tpl some thing like this, but this won't execute via the header status



--------------

Dear {$order_info.s_firstname} {$order_info.s_lastname},


Your order #{$order_info.order_id} has been shipped from our warehouse and should be with you soon.


Your order has been sent with {$shipment.carrier} and the tracking number is {if $shipment.tracking_number} ({$shipment.tracking_number}){/if}




Please ensure someone is available to sign for this parcel.



Thank you for shopping with us.


-----------------


Version2.1.4

[quote name='djstevie84' timestamp='1318371136' post='123473']

Exact same issue along with the mails not sending for the status



Our cart work flow has several status in the workflow

incomplete → processed → being packed → dispatched



dispatch has the tracking information added via shipment method, its merged via a php scripts from XML barcode scanners



I'm trying to get the cart to send email for dispatched status with the tracking number included,

(So they phone the courier company and not the client)



I've added the new carrier as per instructions and seems to be working correctly



But I can't get emails to send? Print packaging slip won't pull the tracking id number in “Order View”

But if I access it via the shipments menu and select print packaging slip it does pull the tracking id and the carrier correctly



Cash Offered for anyone that can figure this one?



Just need help from someone who has sent the emails correctly for shipments custom carrier (NOT UPS or USPS)





Want to use .tpl some thing like this, but this won't execute via the header status



--------------

Dear {$order_info.s_firstname} {$order_info.s_lastname},


Your order #{$order_info.order_id} has been shipped from our warehouse and should be with you soon.


Your order has been sent with {$shipment.carrier} and the tracking number is {if $shipment.tracking_number} ({$shipment.tracking_number}){/if}




Please ensure someone is available to sign for this parcel.



Thank you for shopping with us.


-----------------


Version2.1.4
[/quote]

The emails the customer receives when order status changes is not the same email as the shipment notification, if you want the tracking # included in the email the customer receives when the status changes to dispatched, you must edit the your skins/YOUR_SKIN/mail/orders/order_notification.tpl

In this file you can change what the customer receives for any order status. I have done this to send custom emails for each of my order status by creating different .tpl files and include them in the order_notification.tpl file like this:

{$order_header}

{if $order_info.status == 'C'}
{include file="orders/completed.tpl"}
{elseif $order_info.status == 'B'}
{include file="orders/back_order.tpl"}
{else}
.......
In your case you will need to include the tpl file you created or the file shipments/shipment_products.tpl when you dispatched status is chosen

This have worked great for me since I have total control over the emails sent to my customers.

Hope this helps

Joe

[quote name='gasngrills' timestamp='1318431170' post='123532']

The emails the customer receives when order status changes is not the same email as the shipment notification, if you want the tracking # included in the email the customer receives when the status changes to dispatched, you must edit the your skins/YOUR_SKIN/mail/orders/order_notification.tpl



In this file you can change what the customer receives for any order status. I have done this to send custom emails for each of my order status by creating different .tpl files and include them in the order_notification.tpl file like this:



{$order_header}


{if $order_info.status == 'C'}

{include file=“orders/completed.tpl”}

{elseif $order_info.status == 'B'}

{include file=“orders/back_order.tpl”}

{else}



In your case you will need to include the tpl file you created or the file shipments/shipment_products.tpl when you dispatched status is chosen



This have worked great for me since I have total control over the emails sent to my customers.



Hope this helps



Joe

[/quote]



Hi figured out how to get the .tpl to send,



But the tracking id is not pushing, it seems its not being pulled in



Stephen

Hi to everyone,



i want to make a change in this .tpl. I need to use the shipping_id variable, how can i get it from the database.



For example i write this code but i don't get something:



[color=#696969]{$lang.shipping_method}: {$shipping.shipping_id}
[/color]



with variable $shipping.shipping_id nothing works, i tried and the $shipment.shipping_id but the same nothing works.

Can someone help me how can i get the shipping_id ?



Thanks