Mage_Sales_Model_Order_Invoice_Total_Shipping Class Reference

Inheritance diagram for Mage_Sales_Model_Order_Invoice_Total_Shipping:

Mage_Sales_Model_Order_Invoice_Total_Abstract

List of all members.

Public Member Functions

 collect (Mage_Sales_Model_Order_Invoice $invoice)


Detailed Description

Definition at line 34 of file Shipping.php.


Member Function Documentation

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     }


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

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