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_Model_Shipment_Package
14: */
15: class IllApps_Shipsync_Model_Shipment_Package extends Mage_Core_Model_Abstract
16: {
17: /**
18: * _construct
19: */
20: protected function _construct()
21: {
22: $this->_init('shipping/shipment_package');
23: }
24:
25:
26: /*
27: * Returns parsed item details for ship request
28: *
29: * @return array
30: */
31: public function getContents()
32: {
33: foreach ($this->getItems() as $_item) {
34:
35: $item = Mage::getModel('sales/order_item')->load($_item['id']);
36:
37: $contents[] = array(
38: 'ItemNumber' => $item['id'],
39: 'Description' => $item->getName(),
40: 'ReceivedQuantity' => 1
41: );
42: }
43:
44: return $contents;
45: }
46:
47:
48: /*
49: * Round and return
50: *
51: * @return float
52: */
53: public function getRoundedLength()
54: {
55: return round($this->getLength(), 1) > 0 ? $this->getLength() : 0.1;
56: }
57:
58: /*
59: * Round and return
60: *
61: * @return float
62: */
63: public function getRoundedWidth()
64: {
65: return round($this->getWidth(), 1) > 0 ? $this->getWidth() : 0.1;
66: }
67:
68: /*
69: * If you haven't picked it up by now, there's no hope for you
70: *
71: * @return float
72: */
73: public function getRoundedHeight()
74: {
75: return round($this->getHeight(), 1) > 0 ? $this->getHeight() : 0.1;
76: }
77:
78: /*
79: * Sequence number for shipment
80: *
81: * @return int
82: */
83: public function getSequenceNumber()
84: {
85: return Mage::getStoreConfig('carriers/fedex/mps_shipments') ? ($this->getPackageNumber() + 1) : 1;
86: }
87: }
88: