1: <?php
2:
3: /**
4: * ShipSync
5: *
6: * @category IllApps
7: * @package IllApps_Shipsync
8: * @copyright Copyright (c) 2014 EcoMATICS, Inc. DBA IllApps (http://www.illapps.com)
9: * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
10: */
11:
12: /**
13: * IllApps_Shipsync_Block_Adminhtml_Sales_Order_Shipment_Abstract
14: */
15: class IllApps_Shipsync_Block_Adminhtml_Sales_Order_Shipment_Abstract extends Mage_Adminhtml_Block_Sales_Order_Abstract
16: {
17: /**
18: * Get Shipment Id
19: *
20: * @return integer
21: */
22: public function getShipmentId()
23: {
24: return $this->getModel()->getShipmentId();
25: }
26:
27: /**
28: * Get Shipping Packages
29: */
30: public function getShippingPackages()
31: {
32: return Mage::getModel('shipping/shipment_package')
33: ->getCollection()->getItemsByColumnValue('order_shipment_id', $this->getShipmentId());
34: }
35:
36: /**
37: * Set Active Package
38: */
39: public function setActivePackage($package)
40: {
41: $this->getModel()->setActivePackage($package);
42:
43: return $this;
44: }
45:
46: /**
47: * Get Active Package
48: */
49: public function getActivePackage()
50: {
51: return $this->getModel()->getActivePackage();
52: }
53:
54: /**
55: * Get Active Items
56: */
57: public function getActiveItems()
58: {
59: return $this->collectItems();
60: }
61:
62: /**
63: * Collect Items
64: */
65: public function collectItems()
66: {
67: return $this->getModel()->collectItems()->getAllItems();
68: }
69:
70: /**
71: * Get Shipping Label Url
72: *
73: * @param integer $package_id
74: */
75: public function getShippingLabelUrl($package_id)
76: {
77: return $this->getUrl('shipsync/index/label/', array('id' => $package_id));
78: }
79:
80: /**
81: * Get Cod Label Url
82: *
83: * @param integer @package_id
84: */
85: public function getCodLabelUrl($package_id)
86: {
87: return $this->getUrl('shipsync/index/codlabel/', array('id' => $package_id));
88: }
89:
90: /**
91: * Get Return Label Url
92: *
93: * @param integer @package_id
94: */
95: public function getReturnLabelUrl($package_id)
96: {
97: return $this->getUrl('shipsync/index/returnlabel/', array('id' => $package_id));
98: }
99:
100: /**
101: * Get Model
102: *
103: * @return IllApps_Shipsync_Model_Sales_Order_Shipment_Package
104: */
105: public function getModel()
106: {
107: return Mage::getSingleton('shipsync/sales_order_shipment_package');
108: }
109:
110: }
111: