1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10:
11:
12: 13: 14:
15: class IllApps_Shipsync_Block_Adminhtml_Sales_Order_Shipment_View extends Mage_Adminhtml_Block_Sales_Order_Shipment_View
16: {
17:
18: 19: 20:
21: public function __construct()
22: {
23: parent::__construct();
24:
25:
26: $shipmentPackage = Mage::getModel('shipping/shipment_package');
27:
28:
29: $packages = $shipmentPackage->getCollection();
30:
31: if ($packages) {
32: $this->_addButton('view_shipment_packages', array(
33: 'label' => Mage::helper('sales')->__('View Shipment Packages'),
34: 'onclick' => 'setLocation(\'' . $this->getUrl('shipsync/index/packages', array(
35: 'shipment_id' => $this->getShipment()->getId()
36: )) . '\')'
37: ));
38: }
39:
40:
41:
42: foreach ($packages->getData() as $package) {
43:
44: if ($shipmentPackage->load($package['package_id'])->getOrderShipmentId() == $this->getShipment()->getId()) {
45:
46: $url = $this->getUrl('shipsync/index/label/', array(
47: 'id' => $package['package_id']
48: ));
49:
50:
51: if ($package['cod_label_image'] != "") {
52:
53: $codurl = $this->getUrl('shipsync/index/codlabel/', array(
54: 'id' => $package['package_id']
55: ));
56:
57:
58: $this->_addButton('reprint_cod_label', array(
59: 'label' => Mage::helper('sales')->__('Print COD Label'),
60: 'onclick' => 'setLocation(\'' . $codurl . '\')'
61: ));
62: }
63:
64: if ($package['return_label_image'] != "") {
65: $returnurl = $this->getUrl('shipsync/index/returnlabel/', array(
66: 'id' => $package['package_id']
67: ));
68:
69:
70: $this->_addButton('reprint_return_label', array(
71: 'label' => Mage::helper('sales')->__('Print Return Label'),
72: 'onclick' => 'setLocation(\'' . $returnurl . '\')'
73: ));
74: }
75:
76:
77: $this->_addButton('reprint_label', array(
78: 'label' => Mage::helper('sales')->__('Print Label'),
79: 'onclick' => 'setLocation(\'' . $url . '\')'
80: ));
81: }
82: }
83: }
84: }
85: