コード例 #1
0
 /**
  * Get all FPTs
  *
  * @return array
  */
 public function getAllWeee($source = null)
 {
     $allWeee = array();
     $store = $this->_app->getStore();
     if (Mage::registry('current_invoice')) {
         $source = Mage::registry('current_invoice');
     } elseif (Mage::registry('current_creditmemo')) {
         $source = Mage::registry('current_creditmemo');
     } elseif ($source == null) {
         $source = $this->_app->getOrder();
     }
     $helper = Mage::helper('weee');
     if (!$helper->includeInSubtotal($store)) {
         foreach ($source->getAllItems() as $item) {
             foreach ($helper->getApplied($item) as $tax) {
                 $weeeDiscount = isset($tax['weee_discount']) ? $tax['weee_discount'] : 0;
                 $title = $tax['title'];
                 $rowAmount = isset($tax['row_amount']) ? $tax['row_amount'] : 0;
                 $rowAmountInclTax = isset($tax['row_amount_incl_tax']) ? $tax['row_amount_incl_tax'] : 0;
                 $amountDisplayed = $helper->isTaxIncluded() ? $rowAmountInclTax : $rowAmount;
                 if (array_key_exists($title, $allWeee)) {
                     $allWeee[$title] = $allWeee[$title] + $amountDisplayed - $weeeDiscount;
                 } else {
                     $allWeee[$title] = $amountDisplayed - $weeeDiscount;
                 }
             }
         }
     }
     return $allWeee;
 }