4

I'm trying to change the pop-up window when customers track their orders, the pop-up currently shows:

"Shipment #" I would like to change this to the actual order number.

I have tried the following:

 <h2 class="sub-title"><?php echo $this->__('Order #'),$_order->getRealOrderId();?></h2>

But it doesn't load.

The original file is located in:

default/template/shipping/tracking/popup.phtml

How can I display the Order # instead of the Shipment # on this pop up?

3

Take a look at app/design/frontend/base/default/layout/shipping.xml to find the block for this template.

<reference name="content">
        <block type="shipping/tracking_popup" name="shipping.tracking.popup" template="shipping/tracking/popup.phtml" />
</reference>

Now if you take a look at Mage_Shipping_Block_Tracking_Popup you will notice that you can not get the order object directly.

So in your template file try this before your code above

 $_order = Mage::getModel('sales/order')->load($this->getOrderId());
  • I see your logic but the order number is coming up blank. – SR_Magento Jul 1 '15 at 11:02
  • Try $this->getTrackingInfo()->getOrderId(); instead of $this->getOrderId() because it is deprecated after 1.3.2.3 – Renon Stewart Jul 1 '15 at 13:14
  • no luck, adding that code, stops the page from loading – SR_Magento Jul 1 '15 at 14:46
  • Take a look at popupAction() in app/code/core/Mage/Shipping/controllers/TrackingController.php. What is the content of $shippingInfoModel. See Mage_Shipping_Block_Tracking_Popup::getTrackingInfo() – Renon Stewart Jul 1 '15 at 14:50
3

I had nearly the same problem and needed some information from the shipment address of the order for a tracking link. The following code worked for me in the popup.phtml (Magento 1.9.1.0):

$shippingInfoModel = Mage::getModel('shipping/info')->loadByHash($this->getRequest()->getParam('hash'));
if (array_key_exists('order_id', $shippingInfoModel->_data)) {
    $order_id = $shippingInfoModel->_data['order_id'];
    $order = Mage::getModel('sales/order')->load($order_id);
}
if (array_key_exists('ship_id', $shippingInfoModel->_data)) {
    $ship_id = $shippingInfoModel->_data['ship_id'];
    $order_shipment = Mage::getModel('sales/order_shipment')->load($ship_id);
    $order = $order_shipment->getOrder();
}

Using $order you can get now the order number: $order->getIncrementId();

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.