当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Sales_Model_Quote_Address::setBaseTaxAmount方法代码示例

本文整理汇总了PHP中Mage_Sales_Model_Quote_Address::setBaseTaxAmount方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Address::setBaseTaxAmount方法的具体用法?PHP Mage_Sales_Model_Quote_Address::setBaseTaxAmount怎么用?PHP Mage_Sales_Model_Quote_Address::setBaseTaxAmount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Sales_Model_Quote_Address的用法示例。


在下文中一共展示了Mage_Sales_Model_Quote_Address::setBaseTaxAmount方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: collect

 /**
  * 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;
 }
开发者ID:wouter90,项目名称:sisowpayment,代码行数:32,代码来源:TaxTotal.php

示例2: collect

 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;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:42,代码来源:Tax.php

示例3: collect

 /**
  * Does nothing, calculates no taxes.
  *
  * @param   Mage_Sales_Model_Quote_Address $address
  * @return  Mage_Tax_Model_Sales_Total_Quote
  */
 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     // parent::collect($address);
     $store = $address->getQuote()->getStore();
     $address->setTaxAmount(0);
     $address->setBaseTaxAmount(0);
     //$address->setShippingTaxAmount(0);
     //$address->setBaseShippingTaxAmount(0);
     $address->setAppliedTaxes(array());
     return $this;
 }
开发者ID:Eximagen,项目名称:pfizer,代码行数:17,代码来源:Tax.php

示例4: collect

 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;
 }
开发者ID:paynl,项目名称:magento-plugin,代码行数:49,代码来源:Paymentcharge.php

示例5: collect

 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;
 }
开发者ID:xiaoguizhidao,项目名称:bilderrahmen,代码行数:22,代码来源:Tax.php

示例6: _resetAddressValues

 /**
  * Reset address values
  *
  * @param \Mage_Sales_Model_Quote_Address $address
  * @return $this
  */
 protected function _resetAddressValues(Mage_Sales_Model_Quote_Address $address)
 {
     $address->setTotalAmount($this->getCode(), 0);
     $address->setBaseTotalAmount($this->getCode(), 0);
     $address->setTaxAmount(0);
     $address->setBaseTaxAmount(0);
     $address->setShippingTaxAmount(0);
     $address->setBaseShippingTaxAmount(0);
     $address->setSubtotal(0);
     $address->setSubtotalInclTax(0);
     $address->setBaseSubtotalInclTax(0);
     $address->setTotalAmount('subtotal', 0);
     $address->setBaseTotalAmount('subtotal', 0);
     $address->setGwItemsTaxAmount(0);
     $address->setGwItemsBaseTaxAmount(0);
     $address->setGwBaseTaxAmount(0);
     $address->setGwTaxAmount(0);
     $address->setGwCardBaseTaxAmount(0);
     $address->setGwCardTaxAmount(0);
     return $this;
 }
开发者ID:onepica,项目名称:avatax,代码行数:27,代码来源:Tax.php

示例7: _convertTotals

 /**
  * Convert totals from ROPE request to quote address
  *
  * @param  Mage_Sales_Model_Quote_Address $address
  * @return void
  */
 protected function _convertTotals($address)
 {
     $address->setTaxAmount((double) $this->_request->total_tax_amount);
     $address->setBaseTaxAmount((double) $this->_request->total_tax_amount);
     /** @var $taxConfig Mage_Tax_Model_Config */
     $taxConfig = Mage::getSingleton('tax/config');
     $taxConfig->setShippingPriceIncludeTax(true);
     $method = 'rakuten_tablerate';
     $carrierTitle = 'Rakuten Checkout';
     $methodTitle = 'Tablerate';
     $rate = $this->_createShippingRate($method, $carrierTitle, $methodTitle)->setPrice((double) $this->_request->shipping);
     $address->addShippingRate($rate)->setShippingMethod($method)->setShippingAmountForDiscount(0);
     $address->setGrandTotal((double) $this->_request->total);
     $address->setBaseGrandTotal((double) $this->_request->total);
 }
开发者ID:rakuten-deutschland,项目名称:checkout-magento,代码行数:21,代码来源:Rope.php


注:本文中的Mage_Sales_Model_Quote_Address::setBaseTaxAmount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。