Add Tracking Info On The Order Search Page

If a user logons and searches an order on the front end we want to show the tracking info in the Order Table.

I tried adding some code in the views\orders\search.tpl file but i am unable to get the shipment info in this template , how can i access the same info so that the code below works.

        {if $shipments[$o.order_id]}
            {foreach from=$shipments[$o.order_id] item="shipment"}

                {if $shipment.carrier}
                    {include file="common/carriers.tpl" carrier=$shipment.carrier tracking_number=$shipment.tracking_number shipment_id=$shipment.shipment_id}
                    <li>{if $smarty.capture.carrier_url|trim != ""}<a {if $smarty.capture.carrier_url|strpos:"://"}target="_blank"{/if} href="{$smarty.capture.carrier_url nofilter}">{/if}{$shipment.tracking_number}{if $smarty.capture.carrier_url|trim != ""}</a>{/if}<br><span>{$shipment.shipping}</span></li>