Magento获取adminhtml网址以查看订单上的单个货件

时间:2013-05-31 16:14:12

标签: magento

我可以生成adminhtml"查看订单"来自magento increment_id的订单的网址如下:

<?php
$order_id = Mage::getModel('sales/order')->loadByIncrementId('100001234')->getId();
?>
<a href="<?php echo Mage::helper('adminhtml')->getUrl('adminhtml/sales_order/view', array('order_id' => $order_id)) ?>">
    Click here to view order
</a>

我希望在发货时达到同样的效果。我有以编程方式生成的货件的increment_id。

有没有办法生成一个adminhtml&#34;查看货件&#34; url按装运增量ID(就像我上面的查看订单一样)?

2 个答案:

答案 0 :(得分:2)

这就像是:

<?php
  $shipment_id = Mage::getModel('sales/order_shipment')
    ->loadByIncrementId($shipmentIncrementId)
    ->getId();

  $shipment_url = Mage::helper('adminhtml')
    ->getUrl(
      'adminhtml/sales_order_shipment/view',
      array('shipment_id' => $shipment_id));
?>
<a href="<?php echo $shipment_url ?>">
  Click here to view shipment
</a>

答案 1 :(得分:0)

hi you can use below code
 $shipment = Mage::getModel('sales/order_shipment')->loadByIncrementId($shipmentIncrementId);

and can get more information from magento documnet
http://docs.magentocommerce.com/Mage_Sales/Mage_Sales_Model_Order_Shipment.html( search for http://docs.magentocommerce.com/Mage_Sales/Mage_Sales_Model_Order_Shipment.html)

and http://www.magentodocs.org/1.7.0.2/db/dec/app_2code_2core_2_mage_2_sales_2_model_2_order_2_shipment_2api_8php_source.php()( search for  public function info($shipmentIncrementId))