Public Member Functions | |
collect (Mage_Sales_Model_Order_Invoice $invoice) |
Definition at line 34 of file Shipping.php.
collect | ( | Mage_Sales_Model_Order_Invoice $ | invoice | ) |
Check shipping amount in previus invoices
Reimplemented from Mage_Sales_Model_Order_Invoice_Total_Abstract.
Definition at line 36 of file Shipping.php.
00037 { 00038 $invoice->setShippingAmount(0); 00039 $invoice->setBaseShippingAmount(0); 00040 00041 $orderShippingAmount = $invoice->getOrder()->getShippingAmount(); 00042 $baseOrderShippingAmount = $invoice->getOrder()->getBaseShippingAmount(); 00043 if ($orderShippingAmount) { 00044 /** 00045 * Check shipping amount in previus invoices 00046 */ 00047 foreach ($invoice->getOrder()->getInvoiceCollection() as $previusInvoice) { 00048 if ($previusInvoice->getShippingAmount() && !$previusInvoice->isCanceled()) { 00049 return $this; 00050 } 00051 } 00052 $invoice->setShippingAmount($orderShippingAmount); 00053 $invoice->setBaseShippingAmount($baseOrderShippingAmount); 00054 00055 $invoice->setGrandTotal($invoice->getGrandTotal()+$orderShippingAmount); 00056 $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal()+$baseOrderShippingAmount); 00057 } 00058 return $this; 00059 }