Public Member Functions | |
_construct () | |
setShipment (Mage_Sales_Model_Order_Shipment $shipment) | |
getShipment () | |
setOrderItem (Mage_Sales_Model_Order_Item $item) | |
getOrderItem () | |
setQty ($qty) | |
register () | |
Protected Attributes | |
$_eventPrefix = 'sales_shipment_item' | |
$_eventObject = 'shipment_item' | |
$_shipment = null | |
$_orderItem = null |
Definition at line 27 of file Item.php.
_construct | ( | ) |
Initialize resource model
Reimplemented from Varien_Object.
Definition at line 38 of file Item.php.
00039 { 00040 $this->_init('sales/order_shipment_item'); 00041 }
getOrderItem | ( | ) |
Retrieve order item instance
Definition at line 83 of file Item.php.
00084 { 00085 if (is_null($this->_orderItem)) { 00086 if ($this->getShipment()) { 00087 $this->_orderItem = $this->getShipment()->getOrder()->getItemById($this->getOrderItemId()); 00088 } 00089 else { 00090 $this->_orderItem = Mage::getModel('sales/order_item') 00091 ->load($this->getOrderItemId()); 00092 } 00093 } 00094 return $this->_orderItem; 00095 }
getShipment | ( | ) |
Retrieve Shipment instance
Definition at line 60 of file Item.php.
register | ( | ) |
Applying qty to order item
Definition at line 131 of file Item.php.
00132 { 00133 $this->getOrderItem()->setQtyShipped( 00134 $this->getOrderItem()->getQtyShipped()+$this->getQty() 00135 ); 00136 return $this; 00137 }
setOrderItem | ( | Mage_Sales_Model_Order_Item $ | item | ) |
Declare order item instance
Mage_Sales_Model_Order_Item | $item |
Definition at line 71 of file Item.php.
00072 { 00073 $this->_orderItem = $item; 00074 $this->setOrderItemId($item->getId()); 00075 return $this; 00076 }
setQty | ( | $ | qty | ) |
Declare qty
float | $qty |
Check qty availability
Definition at line 103 of file Item.php.
00104 { 00105 if ($this->getOrderItem()->getIsQtyDecimal()) { 00106 $qty = (float) $qty; 00107 } 00108 else { 00109 $qty = (int) $qty; 00110 } 00111 $qty = $qty > 0 ? $qty : 0; 00112 /** 00113 * Check qty availability 00114 */ 00115 if ($qty <= $this->getOrderItem()->getQtyToShip() || $this->getOrderItem()->isDummy(true)) { 00116 $this->setData('qty', $qty); 00117 } 00118 else { 00119 Mage::throwException( 00120 Mage::helper('sales')->__('Invalid qty to ship for item "%s"', $this->getName()) 00121 ); 00122 } 00123 return $this; 00124 }
setShipment | ( | Mage_Sales_Model_Order_Shipment $ | shipment | ) |
Declare Shipment instance
Mage_Sales_Model_Order_Shipment | $shipment |
Definition at line 49 of file Item.php.
$_eventObject = 'shipment_item' [protected] |
$_eventPrefix = 'sales_shipment_item' [protected] |