Public Member Functions | |
_construct () | |
setCreditmemo (Mage_Sales_Model_Order_Creditmemo $creditmemo) | |
getCreditmemo () | |
setOrderItem (Mage_Sales_Model_Order_Item $item) | |
getOrderItem () | |
setQty ($qty) | |
register () | |
cancel () | |
calcRowTotal () | |
Protected Attributes | |
$_eventPrefix = 'sales_creditmemo_item' | |
$_eventObject = 'creditmemo_item' | |
$_creditmemo = null | |
$_orderItem = null |
Definition at line 27 of file Item.php.
_construct | ( | ) |
Initialize resource model
Reimplemented from Varien_Object.
Definition at line 37 of file Item.php.
00038 { 00039 $this->_init('sales/order_creditmemo_item'); 00040 }
calcRowTotal | ( | ) |
Invoice item row total calculation
Definition at line 151 of file Item.php.
00152 { 00153 $rowTotal = $this->getOrderItem()->getRowTotal()/$this->getOrderItem()->getQtyOrdered()*$this->getQty(); 00154 $baseRowTotal = $this->getOrderItem()->getBaseRowTotal()/$this->getOrderItem()->getQtyOrdered()*$this->getQty(); 00155 00156 $this->setRowTotal($this->getCreditmemo()->getStore()->roundPrice($rowTotal)); 00157 $this->setBaseRowTotal($this->getCreditmemo()->getStore()->roundPrice($baseRowTotal)); 00158 return $this; 00159 }
cancel | ( | ) |
Definition at line 138 of file Item.php.
00139 { 00140 $this->getOrderItem()->setQtyRefunded( 00141 $this->getOrderItem()->getQtyRefunded()-$this->getQty() 00142 ); 00143 return $this; 00144 }
getOrderItem | ( | ) |
Retrieve order item instance
Definition at line 82 of file Item.php.
00083 { 00084 if (is_null($this->_orderItem)) { 00085 if ($this->getCreditmemo()) { 00086 $this->_orderItem = $this->getCreditmemo()->getOrder()->getItemById($this->getOrderItemId()); 00087 } 00088 else { 00089 $this->_orderItem = Mage::getModel('sales/order_item') 00090 ->load($this->getOrderItemId()); 00091 } 00092 } 00093 return $this->_orderItem; 00094 }
register | ( | ) |
Applying qty to order item
Definition at line 130 of file Item.php.
00131 { 00132 $this->getOrderItem()->setQtyRefunded( 00133 $this->getOrderItem()->getQtyRefunded()+$this->getQty() 00134 ); 00135 return $this; 00136 }
setCreditmemo | ( | Mage_Sales_Model_Order_Creditmemo $ | creditmemo | ) |
Declare creditmemo instance
Mage_Sales_Model_Order_Creditmemo | $creditmemo |
Definition at line 48 of file Item.php.
setOrderItem | ( | Mage_Sales_Model_Order_Item $ | item | ) |
Declare order item instance
Mage_Sales_Model_Order_Item | $item |
Definition at line 70 of file Item.php.
00071 { 00072 $this->_orderItem = $item; 00073 $this->setOrderItemId($item->getId()); 00074 return $this; 00075 }
setQty | ( | $ | qty | ) |
Declare qty
float | $qty |
Check qty availability
Definition at line 102 of file Item.php.
00103 { 00104 if ($this->getOrderItem()->getIsQtyDecimal()) { 00105 $qty = (float) $qty; 00106 } 00107 else { 00108 $qty = (int) $qty; 00109 } 00110 $qty = $qty > 0 ? $qty : 0; 00111 /** 00112 * Check qty availability 00113 */ 00114 if ($qty <= $this->getOrderItem()->getQtyToRefund() || $this->getOrderItem()->isDummy()) { 00115 $this->setData('qty', $qty); 00116 } 00117 else { 00118 Mage::throwException( 00119 Mage::helper('sales')->__('Invalid qty to refund item "%s"', $this->getName()) 00120 ); 00121 } 00122 return $this; 00123 }
$_eventObject = 'creditmemo_item' [protected] |
$_eventPrefix = 'sales_creditmemo_item' [protected] |