Mage_Sales_Model_Order_Shipment_Item Class Reference

Inheritance diagram for Mage_Sales_Model_Order_Shipment_Item:

Mage_Core_Model_Abstract Varien_Object

List of all members.

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


Detailed Description

Definition at line 27 of file Item.php.


Member Function Documentation

_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

Returns:
Mage_Sales_Model_Order_Item

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

Returns:
Mage_Sales_Model_Order_Shipment

Definition at line 60 of file Item.php.

00061     {
00062         return $this->_shipment;
00063     }

register (  ) 

Applying qty to order item

Returns:
Mage_Sales_Model_Order_Shipment_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

Parameters:
Mage_Sales_Model_Order_Item $item
Returns:
Mage_Sales_Model_Order_Shipment_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

Parameters:
float $qty
Returns:
Mage_Sales_Model_Order_Invoice_Item

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

Parameters:
Mage_Sales_Model_Order_Shipment $shipment
Returns:
Mage_Sales_Model_Order_Shipment_Item

Definition at line 49 of file Item.php.

00050     {
00051         $this->_shipment = $shipment;
00052         return $this;
00053     }


Member Data Documentation

$_eventObject = 'shipment_item' [protected]

Reimplemented from Mage_Core_Model_Abstract.

Definition at line 30 of file Item.php.

$_eventPrefix = 'sales_shipment_item' [protected]

Reimplemented from Mage_Core_Model_Abstract.

Definition at line 29 of file Item.php.

$_orderItem = null [protected]

Definition at line 33 of file Item.php.

$_shipment = null [protected]

Definition at line 32 of file Item.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:48 2009 for Magento by  doxygen 1.5.8