Example #1
0
 /**
  * Return totals of data object
  *
  * @param  Varien_Object $dataObject
  * @return array
  */
 public function getTotals($dataObject)
 {
     $totals = array();
     $displayWrappingBothPrices = false;
     $displayWrappingIncludeTaxPrice = false;
     $displayCardBothPrices = false;
     $displayCardIncludeTaxPrice = false;
     if ($dataObject instanceof Mage_Sales_Model_Order || $dataObject instanceof Mage_Sales_Model_Order_Invoice || $dataObject instanceof Mage_Sales_Model_Order_Creditmemo) {
         $displayWrappingBothPrices = $this->displaySalesWrappingBothPrices();
         $displayWrappingIncludeTaxPrice = $this->displaySalesWrappingIncludeTaxPrice();
         $displayCardBothPrices = $this->displaySalesCardBothPrices();
         $displayCardIncludeTaxPrice = $this->displaySalesCardIncludeTaxPrice();
     } elseif ($dataObject instanceof Mage_Sales_Model_Quote_Address_Total) {
         $displayWrappingBothPrices = $this->displayCartWrappingBothPrices();
         $displayWrappingIncludeTaxPrice = $this->displayCartWrappingIncludeTaxPrice();
         $displayCardBothPrices = $this->displayCartCardBothPrices();
         $displayCardIncludeTaxPrice = $this->displayCartCardIncludeTaxPrice();
     }
     /**
      * Gift wrapping for order totals
      */
     if ($displayWrappingBothPrices || $displayWrappingIncludeTaxPrice) {
         if ($displayWrappingBothPrices) {
             $this->_addTotalToTotals($totals, 'gw_order_excl', $dataObject->getGwPrice(), $dataObject->getGwBasePrice(), $this->__('Gift Wrapping for Order (Excl. Tax)'));
         }
         $this->_addTotalToTotals($totals, 'gw_order_incl', $dataObject->getGwPrice() + $dataObject->getGwTaxAmount(), $dataObject->getGwBasePrice() + $dataObject->getGwBaseTaxAmount(), $this->__('Gift Wrapping for Order (Incl. Tax)'));
     } else {
         $this->_addTotalToTotals($totals, 'gw_order', $dataObject->getGwPrice(), $dataObject->getGwBasePrice(), $this->__('Gift Wrapping for Order'));
     }
     /**
      * Gift wrapping for items totals
      */
     if ($displayWrappingBothPrices || $displayWrappingIncludeTaxPrice) {
         $this->_addTotalToTotals($totals, 'gw_items_incl', $dataObject->getGwItemsPrice() + $dataObject->getGwItemsTaxAmount(), $dataObject->getGwItemsBasePrice() + $dataObject->getGwItemsBaseTaxAmount(), $this->__('Gift Wrapping for Items (Incl. Tax)'));
         if ($displayWrappingBothPrices) {
             $this->_addTotalToTotals($totals, 'gw_items_excl', $dataObject->getGwItemsPrice(), $dataObject->getGwItemsBasePrice(), $this->__('Gift Wrapping for Items (Excl. Tax)'));
         }
     } else {
         $this->_addTotalToTotals($totals, 'gw_items', $dataObject->getGwItemsPrice(), $dataObject->getGwItemsBasePrice(), $this->__('Gift Wrapping for Items'));
     }
     /**
      * Printed card totals
      */
     if ($displayCardBothPrices || $displayCardIncludeTaxPrice) {
         $this->_addTotalToTotals($totals, 'gw_printed_card_incl', $dataObject->getGwCardPrice() + $dataObject->getGwCardTaxAmount(), $dataObject->getGwCardBasePrice() + $dataObject->getGwCardBaseTaxAmount(), $this->__('Printed Card (Incl. Tax)'));
         if ($displayCardBothPrices) {
             $this->_addTotalToTotals($totals, 'gw_printed_card_excl', $dataObject->getGwCardPrice(), $dataObject->getGwCardBasePrice(), $this->__('Printed Card (Excl. Tax)'));
         }
     } else {
         $this->_addTotalToTotals($totals, 'gw_printed_card', $dataObject->getGwCardPrice(), $dataObject->getGwCardBasePrice(), $this->__('Printed Card'));
     }
     return $totals;
 }