Magento get adminhtml url to view single shipment on order

Magento get adminhtml url to view single shipment on order

October 12, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento get adminhtml url to view single shipment on order

Generating Magento “View Shipment” URLs by Increment ID

As a Magento developer looking to generate adminhtml URLs for viewing shipments programmatically, you’ve come to the right place. Building upon your existing knowledge of generating order view URLs, let’s dive into how you can achieve the same for shipments.

Retrieving the shipment increment ID

Assuming you have already retrieved the shipment increment ID (e.g., ‘000012345678’), the first step is to load the shipment model using its increment_id. You can accomplish this with the following code:

$shipmentIncrementId = '000012345678';
$shipmentModel = Mage::getModel('sales/order_shipment')->loadByIncrementId($shipmentIncrementId);

Generating the adminhtml shipment view URL

Now that you have loaded the shipment model, you can generate the adminhtml “view shipment” URL using Magento’s built-in helper. Here’s a step-by-step process:

  1. Retrieve the order ID associated with the shipment.
$orderId = $shipmentModel->getOrder()->getId();
  1. Utilize the adminhtml helper to generate the base URL for the shipment view page.
$baseUrl = Mage::helper('adminhtml')->getUrl('adminhtml/sales_shipment/view');
  1. Combine the base URL with the order ID and increment_id as parameters in an associative array.
$params = array(
    'order_id' => $orderId,
    'increment_id' => $shipmentIncrementId
);
  1. Finally, use the getUrl method of the adminhtml helper to generate the complete URL and create a hyperlink.
$shipmentViewUrl = Mage::helper('adminhtml')->getUrl($baseUrl, $params);

<a href="<?php echo $shipmentViewUrl; ?>">
    View Shipment
</a>

Using the generated URL

With the above steps, you will have successfully created an adminhtml “view shipment” URL that can be used to navigate directly to a specific shipment’s details page within your Magento backend. This is particularly useful when generating URLs programmatically or integrating with external systems.

Remember to ensure that the user has sufficient permissions to access the shipment view page. You may need to handle authorization and authentication accordingly, especially if you’re working in an environment where multiple users have different roles and privileges.

Conclusion

In this post, we explored how to generate Magento adminhtml “view shipment” URLs using a shipment’s increment ID. By leveraging Magento’s built-in models and helpers, you can now create dynamic links that allow your team or external systems to quickly access specific shipments within the Magento backend.

Don’t forget to visit LaravelCompany.com for more in-depth tutorials and resources on Magento development best practices. Happy coding!

Admin Orders

Our network