0

I would like to have a tracking form to track the package.

I would like to have that form in my sidebar.

This is how it works

Track your package form -> User inputs order Id -> Popup appears with tracking content

Can someone tell me how to implement that?

2

The tracking data that Magento stores is very limited. Beyond the tracking number and the name of the carrier there's not a lot to see but if this is data data you want you would go about that something like this;

The tracking data is stored in the table sales_flat_shipment_track so using the appropriate resource model you can filter the collection by the given tracking number. This will return a collection from which you can retrieve the first item and the data of that tracking item. (untested code, please test first)

$tracking number = 'ABCDEFG'; // input from user

$tracking_collection = Mage::getResourceModel('sales/order_shipment_track')
             ->addAttributeTofilter('track_number', $tracking number);

if (!$tracking_collection->count())
{
    echo "No order found";
}
else 
{
    $tracking_item = $collection->getFirstItem();
    var_dump($tracking_item->getData());
}

Now for the part where you provide a user a form to retrieve the data, this can be done by adding a simple phtml file with a form in the local.xml.

<reference name="left">
  <block type="core/template" name="tracking_info" template="tracker/form.phtml"/>
</reference>

Actually letting the form submit something to the above mentioned code and returning something will probably involve creating an extension with a controller that handles the post and returns the info. This Magento-4u tutorial should help you with that.

Now if you meant retrieving tracking data from the respective carrier (postal service) this will depend completely on what carrier you're using and might be a bit too broad to go into in this post.

| improve this answer | |
1

How are you shipping this? If you're using UPS and their Worldship product, you can have custom reference fields that can be set to record the sales order number and invoice number in UPS Quantum View's database.

The tracking results page can then be totally outside of Magento and customer emails can be sent with a tracking link that directly interfaces with UPS Quantum View tracking or you can have your sidebar form that pulls up a customized popup page that uses the UPS tracking API to provide a track by reference function with full tracking information from origin to signature from UPS.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.