示例#1
0
 /**
  * Collect the order total
  *
  * @param object $address The address instance to collect from
  *
  * @return Sisow_Model_Quote_TaxTotal
  */
 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     $quote = $address->getQuote();
     if ($quote->getId() == null || $address->getAddressType() != "shipping") {
         return $this;
     }
     $payment = $quote->getPayment();
     if (substr($payment->getMethod(), 0, 6) != 'sisow_' && (!count($quote->getPaymentsCollection()) || !$payment->hasMethodInstance())) {
         return $this;
     }
     $methodInstance = $payment->getMethodInstance();
     if (substr($methodInstance->getCode(), 0, 6) != 'sisow_') {
         return $this;
     }
     $helper = Mage::helper('sisow/paymentfee');
     $fee = $helper->getPaymentFeeArray($methodInstance->getCode(), $quote);
     if (!is_array($fee)) {
         return $this;
     }
     $address->setTaxAmount($address->getTaxAmount() + $fee['taxamount']);
     $address->setBaseTaxAmount($address->getBaseTaxAmount() + $fee['base_taxamount']);
     $address->setInvoiceTaxAmount($fee['taxamount']);
     $address->setBaseInvoiceTaxAmount($fee['base_taxamount']);
     return $this;
 }
示例#2
0
 /**
  * Convert quote address model to order
  *
  * @param   Mage_Sales_Model_Quote $quote
  * @return  Mage_Sales_Model_Order
  */
 public function addressToOrder(Mage_Sales_Model_Quote_Address $address, $order = null)
 {
     if (!$order instanceof Mage_Sales_Model_Order) {
         $order = $this->toOrder($address->getQuote());
     }
     $order->setWeight($address->getWeight())->setShippingMethod($address->getShippingMethod())->setShippingDescription($address->getShippingDescription())->setShippingRate($address->getShippingRate())->setSubtotal($address->getSubtotal())->setTaxAmount($address->getTaxAmount())->setDiscountAmount($address->getDiscountAmount())->setShippingAmount($address->getShippingAmount())->setGiftcertAmount($address->getGiftcertAmount())->setCustbalanceAmount($address->getCustbalanceAmount())->setGrandTotal($address->getGrandTotal())->setBaseSubtotal($address->getBaseSubtotal())->setBaseTaxAmount($address->getBaseTaxAmount())->setBaseDiscountAmount($address->getBaseDiscountAmount())->setBaseShippingAmount($address->getBaseShippingAmount())->setBaseGiftcertAmount($address->getBaseGiftcertAmount())->setBaseCustbalanceAmount($address->getBaseCustbalanceAmount())->setBaseGrandTotal($address->getBaseGrandTotal());
     Mage::dispatchEvent('sales_convert_quote_address_to_order', array('address' => $address, 'order' => $order));
     return $order;
 }
示例#3
0
 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     $store = $address->getQuote()->getStore();
     $address->setTaxAmount(0);
     $address->setBaseTaxAmount(0);
     $tax = Mage::getModel('tax/rate_data')->setCustomerClassId($address->getQuote()->getCustomerTaxClassId());
     /* @var $tax Mage_Tax_Model_Rate_Data */
     $taxAddress = $address;
     switch (Mage::getStoreConfig('sales/tax/based_on')) {
         case 'billing':
             $taxAddress = $address->getQuote()->getBillingAddress();
         case 'shipping':
             $tax->setCountryId($taxAddress->getCountryId())->setRegionId($taxAddress->getRegionId())->setPostcode($taxAddress->getPostcode());
             break;
         case 'origin':
             $tax->setCountryId(Mage::getStoreConfig('shipping/origin/country_id', $store))->setRegionId(Mage::getStoreConfig('shipping/origin/region_id', $store))->setPostcode(Mage::getStoreConfig('shipping/origin/postcode', $store));
             break;
     }
     foreach ($address->getAllItems() as $item) {
         $tax->setProductClassId($item->getProduct()->getTaxClassId());
         $rate = $tax->getRate();
         $item->setTaxPercent($rate);
         $item->calcTaxAmount();
         $address->setTaxAmount($address->getTaxAmount() + $item->getTaxAmount());
         $address->setBaseTaxAmount($address->getBaseTaxAmount() + $item->getBaseTaxAmount());
     }
     $shippingTaxClass = Mage::getStoreConfig('sales/tax/shipping_tax_class', $store);
     if ($shippingTaxClass) {
         $tax->setProductClassId($shippingTaxClass);
         if ($rate = $tax->getRate()) {
             $shippingTax = $address->getShippingAmount() * $rate / 100;
             $shippingBaseTax = $address->getBaseShippingAmount() * $rate / 100;
             $shippingTax = $store->roundPrice($shippingTax);
             $shippingBaseTax = $store->roundPrice($shippingBaseTax);
             $address->setTaxAmount($address->getTaxAmount() + $shippingTax);
             $address->setBaseTaxAmount($address->getBaseTaxAmount() + $shippingBaseTax);
         }
     }
     $address->setGrandTotal($address->getGrandTotal() + $address->getTaxAmount());
     $address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBaseTaxAmount());
     return $this;
 }
示例#4
0
 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     $address->setPaymentCharge(0);
     $address->setBasePaymentCharge(0);
     $storeId = Mage::app()->getStore()->getId();
     $items = $address->getAllItems();
     if (!count($items)) {
         return $this;
     }
     $paymentMethod = $address->getQuote()->getPayment()->getMethod();
     $quote = $address->getQuote();
     if ($paymentMethod && substr($paymentMethod, 0, 11) == 'pay_payment') {
         $baseAmount = Mage::helper('pay_payment')->getPaymentCharge($paymentMethod, $address->getQuote());
         $amount = Mage::helper('directory')->currencyConvert($baseAmount, Mage::app()->getWebsite()->getConfig('currency/options/default'), Mage::app()->getStore()->getCurrentCurrencyCode());
         $address->setPaymentCharge($amount);
         $address->setBasePaymentCharge($baseAmount);
         $taxClass = Mage::helper('pay_payment')->getPaymentChargeTaxClass($paymentMethod);
         $taxCalculationModel = Mage::getSingleton('tax/calculation');
         $request = $taxCalculationModel->getRateRequest($quote->getShippingAddress(), $quote->getBillingAddress(), null, $storeId);
         $request->setStore(Mage::app()->getStore());
         $rate = $taxCalculationModel->getRate($request->setProductClassId($taxClass));
         //$rate = 21;
         if ($rate > 0) {
             //                $includesTax = Mage::getStoreConfig('tax/calculation/price_includes_tax');
             $baseChargeTax = round($address->getBasePaymentCharge() / (1 + $rate / 100) * ($rate / 100), 2);
             $chargeTax = round($address->getPaymentCharge() / (1 + $rate / 100) * ($rate / 100), 2);
         } else {
             $baseChargeTax = 0;
             $chargeTax = 0;
         }
         $rates = array();
         $applied = false;
         foreach ($address->getAppliedTaxes() as $arrRate) {
             // maximaal 1 keer de btw voor de extra kosten toevoegen
             if ($arrRate['percent'] == $rate && !$applied) {
                 $applied = true;
                 $arrRate['amount'] = $arrRate['amount'] + $chargeTax;
                 $arrRate['base_amount'] = $arrRate['base_amount'] + $baseChargeTax;
             }
             $rates[] = $arrRate;
         }
         $address->setAppliedTaxes($rates);
         $address->setBaseTaxAmount($address->getBaseTaxAmount() + $baseChargeTax);
         $address->setTaxAmount($address->getTaxAmount() + $chargeTax);
         $address->setGrandTotal($address->getGrandTotal() + $address->getPaymentCharge());
         $address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBasePaymentCharge());
     }
     return $this;
 }
示例#5
0
 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     if (!Mage::getSingleton('checkout/session')->getQuoteId()) {
         return $this;
     }
     $_helper = Mage::helper('msp_cashondelivery');
     $_model = Mage::getModel('msp_cashondelivery/cashondelivery');
     $_subtotal = $address->getSubtotal();
     $quote = $address->getQuote();
     $baseAmount = $_model->getBaseExtraFee($_subtotal);
     $amount = $_model->getExtraFee($_subtotal);
     $codTax = $_helper->getTaxAmount($amount);
     $codBaseTax = $_helper->getTaxAmount($baseAmount);
     if ($quote->getPayment()->getMethod() == $_model->getCode() && $address->getAddressType() == Mage_Sales_Model_Quote_Address::TYPE_SHIPPING) {
         $address->setTaxAmount($address->getTaxAmount() + $codTax);
         $address->setBaseTaxAmount($address->getBaseTaxAmount() + $codBaseTax);
         $this->_saveAppliedTaxes($address, $_helper->getAppliedRates(), $codTax, $codBaseTax, $_helper->getRate());
         $address->setGrandTotal($address->getGrandTotal() + $codTax);
         $address->setBaseGrandTotal($address->getBaseGrandTotal() + $codBaseTax);
     }
     return $this;
 }
 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     $store = $address->getQuote()->getStore();
     $session = Mage::getSingleton('checkout/session');
     $discount = $session->getData('webpos_admin_discount');
     if (!$discount) {
         return $this;
     }
     $items = $address->getAllItems();
     if (!count($items)) {
         return $this;
     }
     $session->setData('webpos_admin_discount', $discount);
     $address->setWebposDiscountAmount($discount);
     $address->setData('webpos_discount_amount', $discount);
     /* Daniel - tax for discount */
     $afterDiscount = Mage::getStoreConfig('tax/calculation/apply_after_discount');
     if ($afterDiscount) {
         $country = Mage::getModel('checkout/session')->getQuote()->getShippingAddress()->getCountry();
         $oldTax = $address->getTaxAmount();
         $oldBaseTax = $address->getBaseTaxAmount();
         if ($country) {
             $rateTax = Mage::getModel('tax/calculation_rate')->getCollection()->addFieldToFilter('tax_country_id', $country)->setOrder('rate', 'DESC')->getFirstItem();
             $address->setTaxAmount(($address->getBaseSubtotal() - $discount + $address->getShippingAmount() + $address->getDiscountAmount()) * $rateTax->getRate() / 100)->setBaseTaxAmount(($address->getBaseSubtotal() - $discount + $address->getShippingAmount() + $address->getDiscountAmount()) * $rateTax->getRate() / 100);
             $taxCalculationModel = Mage::getSingleton('tax/calculation');
             $request = Mage::getSingleton('tax/calculation')->getRateRequest($address, $address->getQuote()->getBillingAddress(), $address->getQuote()->getCustomerTaxClassId(), $store);
             $rate = Mage::getSingleton('tax/calculation')->getRate($request);
             $this->_saveAppliedTaxes($address, $taxCalculationModel->getAppliedRates($request), $address->getTaxAmount(), $address->getBaseTaxAmount(), $rate);
         }
         $address->setGrandTotal($address->getGrandTotal() - $address->getWebposDiscountAmount());
         $address->setBaseGrandTotal($address->getBaseGrandTotal() - $address->getWebposDiscountAmount());
     } else {
         $address->setGrandTotal($address->getGrandTotal() - $address->getWebposDiscountAmount());
         $address->setBaseGrandTotal($address->getBaseGrandTotal() - $address->getWebposDiscountAmount());
     }
     /* end */
     return $this;
 }
示例#7
0
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $checkoutSubtotal = Mage::getSingleton('checkout/session')->getQuote();
     $items = $address->getAllVisibleItems();
     if (!count($items)) {
         return $this;
     }
     if (!$check_tax) {
         $tax = $address->getBaseTaxAmount();
     }
     if (!$check_shipping) {
         $shipping = $address->getBaseShippingInclTax();
     }
     $baseGrandTotal = $address->getBaseGrandTotal();
     $store_id = Mage::app()->getStore()->getId();
     $quote = $address->getQuote();
     /*added by pavan 28/01/14*/
     $quote->setMwStorecreditCheckoutMax($baseGrandTotal);
     $quote->save();
     //Mage::log('currenturl'.$currentUrl, null, 'mytotal.log');
     //	   Mage::log('pavan is here', null, 'mylogfile.log');
     //	   Mage::log($checkoutSubtotal->getData(), null, 'mylogfile.log');
     //Mage::log('getMwStorecredit'.$address->getMwStorecredit(), null, 'mylogfile.log');
     if ($checkoutSubtotal->getData('subtotal') == $checkoutSubtotal->getData('subtotal_with_discount')) {
         $subTotalWithTax = $checkoutSubtotal->getData('subtotal') + $tax;
     } else {
         $couponAmount = $checkoutSubtotal->getData('subtotal_with_discount') - $checkoutSubtotal->getData('subtotal');
         $subTotalWithTax = $checkoutSubtotal->getData('subtotal_with_discount') + $tax;
     }
     // if($subTotalWithTax >= '500') {
     // $shipp = '0';
     // } else {
     // $shipp = '60';
     // }
     // if($address->getMwStorecredit() > ($subTotalWithTax + $shipp) || $address->getMwRewardpointDiscount() > ($subTotalWithTax + $shipp)) {
     // Mage::log('herere'.$address->getMwStorecredit().$subTotalWithTax, null, 'here123.log');
     // $address->setMwStorecredit(0)
     // ->setMwRewardpoint(0)
     // ->save();
     // $quote->setMwStorecredit(0)
     // ->setMwRewardpoint(0)
     // ->save();
     // }
     /*START -- values set to zero if cart quantity changes*/
     if (Mage::app()->getFrontController()->getRequest()->getActionName() == 'couponapply') {
         $quote = $address->getQuote();
         $quote->setMwStorecredit(0)->setMwStorecreditDiscount(0)->setMwStorecreditDiscountShow(0)->save();
         $quote->setMwRewardpoint(0)->setMwRewardpointDiscountShow(0)->setMwRewardpointDiscount(0)->save();
         $address->setMwStorecredit(0)->setMwStorecreditDiscount(0)->setMwStorecreditDiscountShow(0)->save();
         $address->setMwRewardpoint(0)->setMwRewardpointDiscountShow(0)->setMwRewardpointDiscount(0)->save();
     }
     if (Mage::app()->getFrontController()->getRequest()->getActionName() == 'cartqty' || Mage::app()->getFrontController()->getRequest()->getActionName() == 'delete') {
         $quote = $address->getQuote();
         $quote->setCouponCode('')->setMwStorecredit(0)->setMwStorecreditDiscount(0)->setMwStorecreditDiscountShow(0)->save();
         $quote->setCouponCode('')->setMwRewardpoint(0)->setMwRewardpointDiscountShow(0)->setMwRewardpointDiscount(0)->save();
         $address->setCouponCode('')->setMwStorecredit(0)->setMwStorecreditDiscount(0)->setMwStorecreditDiscountShow(0)->save();
     }
     /*END -- values set to zero if cart quantity changes*/
     $amount = $address->getMwStorecreditDiscountShow();
     $credit = $address->getMwStorecredit();
     if ($credit != 0) {
         $title = Mage::helper('storecreditpro')->__('Zoff Bank');
         $address->addTotal(array('code' => $this->getCode(), 'title' => $title, 'value' => -$credit, 'strong' => false));
     }
     return $this;
 }
示例#8
0
 /**
  * @param Mage_Sales_Model_Quote_Address $address
  * @return $this|Mage_Sales_Model_Quote_Address_Total_Abstract
  */
 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     $helper = Mage::helper('mageworx_multifees');
     if ($address->getSubtotal() == 0 && floatval($address->getCustomerCreditAmount()) == 0) {
         return $this;
     }
     if ($this->_collected) {
         return $this;
     }
     ////////////////////////////////////////////////////////////////////
     $subtotalRowTOTAL = 0;
     $CompanyTotal = 0;
     $PersonTotal = 0;
     $quote = Mage::getSingleton('checkout/cart')->getQuote();
     $cartItems = $quote->getAllVisibleItems();
     $userGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
     foreach ($cartItems as $item) {
         $subtotalRow = 0;
         $_product = Mage::getModel('catalog/product')->load($item->getProductId());
         $ids = $_product->getCategoryIds();
         $productId = $item->getProductId();
         $qty = $item->getQty();
         $price = $item->getProduct()->getPrice();
         $subtotalRow = $subtotalRow + $price * $qty;
         //If the product has perception tax for persons
         if (array_search("372", $ids) != false && $subtotalRow >= 100) {
             $PersonTotal = $PersonTotal + $subtotalRow;
         }
         //If the product has perception tax for persons
         if (array_search("373", $ids) != false) {
             $CompanyTotal = $CompanyTotal + $subtotalRow;
         }
     }
     //If the user is Not log in
     if ($userGroupId == 0 || $userGroupId == 8) {
         $subtotalRowTOTAL = $PersonTotal;
         $subtotalRowTOTAL = $subtotalRowTOTAL / 1.18;
     } elseif ($userGroupId == 8) {
         $subtotalRowTOTAL = $CompanyTotal;
         $subtotalRowTOTAL = $subtotalRowTOTAL / 1.18;
     } else {
         $subtotalRowTOTAL = 0;
     }
     //////////////////////////////////////////////////////////////////////////////////////////////////////
     $baseSubtotalRow = floatval($subtotalRowTOTAL);
     $baseSubtotal = floatval($address->getBaseSubtotalWithDiscount());
     $baseShipping = floatval($address->getBaseShippingAmount());
     // - $address->getBaseShippingTaxAmount()
     $baseTax = floatval($address->getBaseTaxAmount());
     //amount
     $address->setMultifeesAmount(0);
     $address->setBaseMultifeesAmount(0);
     $address->setDetailsMultifees(null);
     $quote = $address->getQuote();
     $feeMessages = new Varien_Data_Collection();
     // add payment fee (front and admin)
     if (Mage::app()->getRequest()->getPost('is_payment_fee', false)) {
         $feesPost = Mage::app()->getRequest()->getPost('fee', array());
         foreach ($feesPost as $feeId => $data) {
             if (isset($data['message'])) {
                 $obj = new Varien_Object();
                 $obj->setFeeId($feeId);
                 $obj->setMessage($data['message']);
                 $feeMessages->addItem($obj);
             }
         }
         $helper->addFeesToCart($feesPost, $quote->getStoreId(), false, 2, 0);
     }
     // add shipping fee (front and admin)
     if (Mage::app()->getRequest()->getPost('is_shipping_fee', false)) {
         $feesPost = Mage::app()->getRequest()->getPost('fee', array());
         foreach ($feesPost as $feeId => $data) {
             if (isset($data['message'])) {
                 $obj = new Varien_Object();
                 $obj->setFeeId($feeId);
                 $obj->setMessage($data['message']);
                 $feeMessages->addItem($obj);
             }
         }
         $helper->addFeesToCart($feesPost, $quote->getStoreId(), false, 3, 0);
     }
     $feesData = $helper->getQuoteDetailsMultifees($address->getId());
     // autoadd default cart fees, no hidden
     if (is_null($feesData) && $helper->isEnableCartFees()) {
         $this->autoAddFeesByParams(1, 0, 2, 1, '', $quote, $address, $helper, null);
     }
     // autoadd hidden cart fees
     if ($helper->isEnableCartFees()) {
         $this->autoAddFeesByParams(1, 0, 1, 1, '', $quote, $address, $helper, null);
     }
     // autoadd hidden shipping fees
     if ($helper->isEnableShippingFees() && $address->getShippingMethod()) {
         $this->autoAddFeesByParams(3, 0, 1, 1, strval($address->getShippingMethod()), $quote, $address, $helper, $feeMessages);
     }
     // autoadd hidden fees
     if ($helper->isEnablePaymentFees() && $quote->getPayment()->getMethod()) {
         // autoadd default payment fees, no hidden
         if (is_null($feesData) && Mage::app()->getRequest()->getControllerName() == 'express') {
             $this->autoAddFeesByParams(2, 0, 3, 1, $quote->getPayment()->getMethod(), $quote, $address, $helper, null);
         }
         // autoadd hidden payment fees
         $this->autoAddFeesByParams(2, 0, 1, 1, $quote->getPayment()->getMethod(), $quote, $address, $helper, $feeMessages);
     }
     $feesData = $helper->getQuoteDetailsMultifees($address->getId());
     if (!is_array($feesData) || count($feesData) == 0) {
         return $this;
     }
     // check conditions added fees
     // get all possible fees
     $possibleFeesCollection = $helper->getMultifees(0, 0, 0, 0, '', $quote, $address);
     $possibleFees = array();
     foreach ($possibleFeesCollection as $fee) {
         $possibleFees[$fee->getId()] = $fee;
     }
     $store = $quote->getStore();
     $baseMultifeesAmount = 0;
     $baseMultifeesTaxAmount = 0;
     foreach ($feesData as $feeId => $data) {
         if (!isset($data['options']) || !isset($possibleFees[$feeId])) {
             unset($feesData[$feeId]);
             continue;
         }
         $baseMultifeesLeft = 0;
         $appliedTotals = $data['applied_totals'];
         foreach ($appliedTotals as $field) {
             switch ($field) {
                 case 'subtotal':
                     $baseMultifeesLeft += $baseSubtotal;
                     break;
                 case 'shipping':
                     $baseMultifeesLeft += $baseShipping;
                     break;
                 case 'tax':
                     $baseMultifeesLeft += $baseTax;
                     break;
                 case 'rowsubtotal':
                     $baseMultifeesLeft += $baseSubtotalRow;
                     break;
             }
         }
         $taxClassId = $data['tax_class_id'];
         // Caluclation the subtotal/discount with/without tax
         $baseSubtotal = floatval($address->getBaseSubtotal());
         $discountAmount = $address->getBaseDiscountAmount();
         if (Mage::helper('tax')->discountTax()) {
             // check discount with tax
             $discountAmount = floatval($helper->getPriceExcludeTax($discountAmount, $quote, $data['tax_class_id']));
         }
         $baseSubtotal = floatval($baseSubtotal + $discountAmount);
         /////////////////////
         //Custom
         //////////////////////
         $baseSubtotalRow = floatval($baseSubtotalRow + $discountAmount);
         $feePrice = 0;
         $feeTax = 0;
         foreach ($data['options'] as $optionId => $value) {
             if (isset($value['percent'])) {
                 $opBasePrice = $baseMultifeesLeft * $value['percent'] / 100;
             } else {
                 $opBasePrice = $value['base_price'] * $possibleFees[$feeId]->getFoundQty($address->getId());
             }
             $opPrice = $store->convertPrice($opBasePrice);
             if ($helper->isTaxСalculationIncludesTax()) {
                 $opBaseTax = $opBasePrice - $helper->getPriceExcludeTax($opBasePrice, $quote, $taxClassId, $address);
                 $opTax = $opPrice - $helper->getPriceExcludeTax($opPrice, $quote, $taxClassId, $address);
             } else {
                 // add tax
                 $opBasePrice += $opBaseTax = $helper->getTaxPrice($opBasePrice, $quote, $taxClassId, $address);
                 $opPrice += $opTax = $helper->getTaxPrice($opPrice, $quote, $taxClassId, $address);
             }
             // round price
             $opBasePrice = $store->roundPrice($opBasePrice);
             $opPrice = $store->roundPrice($opPrice);
             $opBaseTax = $store->roundPrice($opBaseTax);
             $opTax = $store->roundPrice($opTax);
             //$opPrice, $opBasePrice = inclTax
             $feesData[$feeId]['options'][$optionId]['base_price'] = $opBasePrice;
             $feesData[$feeId]['options'][$optionId]['price'] = $opPrice;
             $feesData[$feeId]['options'][$optionId]['base_tax'] = $opBaseTax;
             $feesData[$feeId]['options'][$optionId]['tax'] = $opTax;
             $feeTax += $opBaseTax;
             $feePrice += $opBasePrice;
         }
         $feesData[$feeId]['base_price'] = $feePrice;
         $feesData[$feeId]['price'] = $store->convertPrice($feePrice);
         $feesData[$feeId]['base_tax'] = $feeTax;
         $feesData[$feeId]['tax'] = $store->convertPrice($feeTax);
         $baseMultifeesAmount += $feePrice;
         $baseMultifeesTaxAmount += $feeTax;
     }
     $multifeesAmount = $store->roundPrice($store->convertPrice($baseMultifeesAmount));
     $baseMultifeesAmount = $store->roundPrice($baseMultifeesAmount);
     $multifeesTaxAmount = $store->roundPrice($store->convertPrice($baseMultifeesTaxAmount));
     $baseMultifeesTaxAmount = $store->roundPrice($baseMultifeesTaxAmount);
     if ($helper->isIncludeFeeInShippingPrice()) {
         $address->setBaseShippingAmount($baseMultifeesAmount - $baseMultifeesTaxAmount + $address->getBaseShippingAmount());
         $address->setShippingAmount($multifeesAmount - $multifeesTaxAmount + $address->getShippingAmount());
         $address->setBaseShippingTaxAmount($baseMultifeesTaxAmount + $address->getBaseShippingTaxAmount());
         $address->setShippingTaxAmount($multifeesTaxAmount + $address->getShippingTaxAmount());
         $address->setBaseShippingInclTax($baseMultifeesAmount + $address->getBaseShippingInclTax());
         $address->setShippingInclTax($multifeesAmount + $address->getShippingInclTax());
         $address->setBaseGrandTotal($address->getBaseGrandTotal() + $baseMultifeesAmount - $baseMultifeesTaxAmount);
         $address->setGrandTotal($address->getGrandTotal() + $multifeesAmount - $multifeesTaxAmount);
     } else {
         $address->setBaseMultifeesAmount($baseMultifeesAmount);
         $address->setMultifeesAmount($multifeesAmount);
         $address->setBaseMultifeesTaxAmount($baseMultifeesTaxAmount);
         $address->setMultifeesTaxAmount($multifeesTaxAmount);
         $address->setDetailsMultifees(serialize($feesData));
         $address->setBaseTotalAmount('multifees', $baseMultifeesAmount);
         $address->setTotalAmount('multifees', $multifeesAmount);
     }
     $address->setBaseTaxAmount($address->getBaseTaxAmount() + $baseMultifeesTaxAmount);
     $address->setTaxAmount($address->getTaxAmount() + $multifeesTaxAmount);
     // emulation $this->_saveAppliedTaxes($address, $applied, $tax, $baseTax, $rate);
     $appliedTaxes = $address->getAppliedTaxes();
     if (is_array($appliedTaxes)) {
         foreach ($appliedTaxes as $row) {
             if (isset($appliedTaxes[$row['id']]['amount'])) {
                 $appliedTaxes[$row['id']]['amount'] += $multifeesTaxAmount;
                 $appliedTaxes[$row['id']]['base_amount'] += $baseMultifeesTaxAmount;
                 break;
             }
         }
         $address->setAppliedTaxes($appliedTaxes);
     }
     $this->_collected = true;
     return $this;
 }