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


PHP Mage_Sales_Model_Quote_Item_Abstract::setBaseRowTotalInclTax方法代码示例

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


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

示例1: _recalculateParent

 /**
  * Recalculate row information for item based on children calculation
  *
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  * @return  Mage_Tax_Model_Sales_Total_Quote_Subtotal
  */
 protected function _recalculateParent(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $price = 0;
     $basePrice = 0;
     $rowTotal = 0;
     $baseRowTotal = 0;
     $priceInclTax = 0;
     $basePriceInclTax = 0;
     $rowTotalInclTax = 0;
     $baseRowTotalInclTax = 0;
     foreach ($item->getChildren() as $child) {
         $price += $child->getPrice() * $child->getQty();
         $basePrice += $child->getBasePrice() * $child->getQty();
         $rowTotal += $child->getRowTotal();
         $baseRowTotal += $child->getBaseRowTotal();
         $priceInclTax += $child->getPriceInclTax() * $child->getQty();
         $basePriceInclTax += $child->getBasePriceInclTax() * $child->getQty();
         $rowTotalInclTax += $child->getRowTotalInclTax();
         $baseRowTotalInclTax += $child->getBaseRowTotalInclTax();
     }
     /**
      *
      * Customisation To make the custom price work with configurable items
      *
      **/
     if ($item->getCustomPrice()) {
         $customPrice = $item->getCustomPrice();
         $price = $customPrice;
         $basePrice = $customPrice;
         $rowTotal = $customPrice * $item->getQty();
         $baseRowTotal = $customPrice * $item->getQty();
         $priceInclTax = $customPrice;
         $basePriceInclTax = $customPrice;
         $rowTotalInclTax = $customPrice * $item->getQty();
         $baseRowTotalInclTax = $customPrice * $item->getQty();
     }
     $item->setConvertedPrice($price);
     $item->setPrice($basePrice);
     $item->setRowTotal($rowTotal);
     $item->setBaseRowTotal($baseRowTotal);
     $item->setPriceInclTax($priceInclTax);
     $item->setBasePriceInclTax($basePriceInclTax);
     $item->setRowTotalInclTax($rowTotalInclTax);
     $item->setBaseRowTotalInclTax($baseRowTotalInclTax);
     return $this;
 }
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:52,代码来源:Subtotal.php

示例2: _recollectItem

 /**
  * Recollect item price and row total using after taxes subtract.
  * Declare item price including tax attributes
  *
  * @deprecated after 1.4.1
  *
  * @param   Mage_Sales_Model_Quote_Address $address
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  *
  * @return  Mage_Tax_Model_Sales_Total_Quote_Subtotal
  */
 protected function _recollectItem($address, Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $store = $address->getQuote()->getStore();
     $request = $this->_getStoreTaxRequest($address);
     $request->setProductClassId($item->getProduct()->getTaxClassId());
     $rate = $this->_calculator->getRate($request);
     $qty = $item->getTotalQty();
     $price = $taxPrice = $item->getCalculationPriceOriginal();
     $basePrice = $baseTaxPrice = $item->getBaseCalculationPriceOriginal();
     $subtotal = $taxSubtotal = $item->getRowTotal();
     $baseSubtotal = $baseTaxSubtotal = $item->getBaseRowTotal();
     if ($this->_config->discountTax($store)) {
         $item->setDiscountCalculationPrice($price);
         $item->setBaseDiscountCalculationPrice($basePrice);
     }
     /**
      * Use original price for tax calculation
      */
     if ($item->hasCustomPrice() && !$this->_helper->applyTaxOnCustomPrice($store)) {
         $taxPrice = $item->getOriginalPrice();
         $baseTaxPrice = $item->getBaseOriginalPrice();
         $taxSubtotal = $taxPrice * $qty;
         $baseTaxSubtotal = $baseTaxPrice * $qty;
     }
     if ($this->_areTaxRequestsSimilar) {
         $item->setRowTotalInclTax($subtotal);
         $item->setBaseRowTotalInclTax($baseSubtotal);
         $item->setPriceInclTax($price);
         $item->setBasePriceInclTax($basePrice);
         $item->setTaxCalcPrice($taxPrice);
         $item->setBaseTaxCalcPrice($baseTaxPrice);
         $item->setTaxCalcRowTotal($taxSubtotal);
         $item->setBaseTaxCalcRowTotal($baseTaxSubtotal);
     }
     $this->_subtotalInclTax += $subtotal;
     $this->_baseSubtotalInclTax += $baseSubtotal;
     if ($this->_config->getAlgorithm($store) == Mage_Tax_Model_Calculation::CALC_UNIT_BASE) {
         $taxAmount = $this->_calculator->calcTaxAmount($taxPrice, $rate, true);
         $baseTaxAmount = $this->_calculator->calcTaxAmount($baseTaxPrice, $rate, true);
         $unitPrice = $this->_calculator->round($price - $taxAmount);
         $baseUnitPrice = $this->_calculator->round($basePrice - $baseTaxAmount);
         $subtotal = $this->_calculator->round($unitPrice * $qty);
         $baseSubtotal = $this->_calculator->round($baseUnitPrice * $qty);
     } else {
         $taxAmount = $this->_calculator->calcTaxAmount($taxSubtotal, $rate, true, false);
         $baseTaxAmount = $this->_calculator->calcTaxAmount($baseTaxSubtotal, $rate, true, false);
         $unitPrice = ($subtotal - $taxAmount) / $qty;
         $baseUnitPrice = ($baseSubtotal - $baseTaxAmount) / $qty;
         $subtotal = $this->_calculator->round($subtotal - $taxAmount);
         $baseSubtotal = $this->_calculator->round($baseSubtotal - $baseTaxAmount);
     }
     if ($item->hasCustomPrice()) {
         $item->setCustomPrice($unitPrice);
         $item->setBaseCustomPrice($baseUnitPrice);
     }
     $item->setPrice($baseUnitPrice);
     $item->setOriginalPrice($unitPrice);
     $item->setBasePrice($baseUnitPrice);
     $item->setRowTotal($subtotal);
     $item->setBaseRowTotal($baseSubtotal);
     return $this;
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:73,代码来源:Subtotal.php

示例3: _totalBaseProcessItemTax

 /**
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract $item
  * @param Varien_Object $taxRateRequest
  * @param array $taxGroups
  * @param array $itemTaxGroups
  * @param boolean $catalogPriceInclTax
  */
 protected function _totalBaseProcessItemTax($item, $taxRateRequest, &$taxGroups, &$itemTaxGroups, $catalogPriceInclTax)
 {
     $taxRateRequest->setProductClassId($item->getProduct()->getTaxClassId());
     $rate = $this->_calculator->getRate($taxRateRequest);
     $item->setTaxAmount(0);
     $item->setBaseTaxAmount(0);
     $item->setHiddenTaxAmount(0);
     $item->setBaseHiddenTaxAmount(0);
     $item->setTaxPercent($rate);
     $item->setDiscountTaxCompensation(0);
     $rowTotalInclTax = $item->getRowTotalInclTax();
     $recalculateRowTotalInclTax = false;
     if (!isset($rowTotalInclTax)) {
         $item->setRowTotalInclTax($item->getTaxableAmount());
         $item->setBaseRowTotalInclTax($item->getBaseTaxableAmount());
         $recalculateRowTotalInclTax = true;
     }
     $appliedRates = $this->_calculator->getAppliedRates($taxRateRequest);
     if ($catalogPriceInclTax) {
         $taxGroups[(string) $rate]['applied_rates'] = $appliedRates;
         $taxGroups[(string) $rate]['incl_tax'] = $item->getIsPriceInclTax();
         $this->_aggregateTaxPerRate($item, $rate, $taxGroups);
     } else {
         //need to calculate each tax separately
         foreach ($appliedRates as $appliedTax) {
             $taxId = $appliedTax['id'];
             $taxRate = $appliedTax['percent'];
             $taxGroups[$taxId]['applied_rates'] = array($appliedTax);
             $taxGroups[$taxId]['incl_tax'] = $item->getIsPriceInclTax();
             $this->_aggregateTaxPerRate($item, $taxRate, $taxGroups, $taxId, $recalculateRowTotalInclTax);
         }
         //We need to calculate weeeAmountInclTax using multiple tax rate here
         //because the _calculateWeeeTax and _calculateRowWeeeTax only take one tax rate
         if ($this->_weeeHelper->isEnabled() && $this->_weeeHelper->isTaxable()) {
             $this->_calculateWeeeAmountInclTax($item, $appliedRates, false);
             $this->_calculateWeeeAmountInclTax($item, $appliedRates, true);
         }
     }
     if ($rate > 0) {
         $itemTaxGroups[$item->getId()] = $appliedRates;
     }
     return;
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:51,代码来源:Tax.php

示例4: _recalculateParent

 /**
  * Recalculate row information for item based on children calculation
  *
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  * @return  Mage_Tax_Model_Sales_Total_Quote_Subtotal
  */
 protected function _recalculateParent(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $price = 0;
     $basePrice = 0;
     $rowTotal = 0;
     $baseRowTotal = 0;
     $priceInclTax = 0;
     $basePriceInclTax = 0;
     $rowTotalInclTax = 0;
     $baseRowTotalInclTax = 0;
     foreach ($item->getChildren() as $child) {
         $price += $child->getPrice() * $child->getQty();
         $basePrice += $child->getBasePrice() * $child->getQty();
         $rowTotal += $child->getRowTotal();
         $baseRowTotal += $child->getBaseRowTotal();
         $priceInclTax += $child->getPriceInclTax() * $child->getQty();
         $basePriceInclTax += $child->getBasePriceInclTax() * $child->getQty();
         $rowTotalInclTax += $child->getRowTotalInclTax();
         $baseRowTotalInclTax += $child->getBaseRowTotalInclTax();
     }
     $item->setConvertedPrice($price);
     $item->setPrice($basePrice);
     $item->setRowTotal($rowTotal);
     $item->setBaseRowTotal($baseRowTotal);
     $item->setPriceInclTax($priceInclTax);
     $item->setBasePriceInclTax($basePriceInclTax);
     $item->setRowTotalInclTax($rowTotalInclTax);
     $item->setBaseRowTotalInclTax($baseRowTotalInclTax);
     return $this;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:36,代码来源:Subtotal.php

示例5: _recalculateParent

 /**
  * Recalculate row information for item based on children calculation
  *
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  * @return  Mage_Tax_Model_Sales_Total_Quote_Subtotal
  */
 protected function _recalculateParent(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $price = 0;
     $basePrice = 0;
     $rowTotal = 0;
     $baseRowTotal = 0;
     $priceInclTax = 0;
     $basePriceInclTax = 0;
     $rowTotalInclTax = 0;
     $baseRowTotalInclTax = 0;
     foreach ($item->getChildren() as $child) {
         $price += $child->getOriginalPrice();
         $basePrice += $child->getBaseOriginalPrice();
         $rowTotal += $child->getRowTotal();
         $baseRowTotal += $child->getBaseRowTotal();
         $priceInclTax += $child->getPriceInclTax();
         $basePriceInclTax += $child->getBasePriceInclTax();
         $rowTotalInclTax += $child->getRowTotalInclTax();
         $baseRowTotalInclTax += $child->getBaseRowTotalInclTax();
     }
     $item->setOriginalPrice($price);
     $item->setPrice($basePrice);
     $item->setRowTotal($rowTotal);
     $item->setBaseRowTotal($baseRowTotal);
     if ($this->_areTaxRequestsSimilar) {
         $item->setPriceInclTax($priceInclTax);
         $item->setBasePriceInclTax($basePriceInclTax);
         $item->setRowTotalInclTax($rowTotalInclTax);
         $item->setBaseRowTotalInclTax($baseRowTotalInclTax);
     }
     return $this;
 }
开发者ID:joebushi,项目名称:magento-mirror,代码行数:38,代码来源:Subtotal.php

示例6: _aggregateTaxPerRate


//.........这里部分代码省略.........
     $rateKey = (string) $rate;
     $taxSubtotal = $subtotal = $item->getTaxableAmount();
     $baseTaxSubtotal = $baseSubtotal = $item->getBaseTaxableAmount();
     $isWeeeEnabled = $this->_weeeHelper->isEnabled();
     $isWeeeTaxable = $this->_weeeHelper->isTaxable();
     $item->setTaxPercent($rate);
     if (!isset($taxGroups[$rateKey]['totals'])) {
         $taxGroups[$rateKey]['totals'] = array();
         $taxGroups[$rateKey]['base_totals'] = array();
         $taxGroups[$rateKey]['weee_tax'] = array();
         $taxGroups[$rateKey]['base_weee_tax'] = array();
     }
     $hiddenTax = null;
     $baseHiddenTax = null;
     switch ($this->_helper->getCalculationSequence($this->_store)) {
         case Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_EXCL:
         case Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_INCL:
             $rowTax = $this->_calculator->calcTaxAmount($subtotal, $rate, $inclTax, false);
             $baseRowTax = $this->_calculator->calcTaxAmount($baseSubtotal, $rate, $inclTax, false);
             if ($isWeeeEnabled && $isWeeeTaxable) {
                 $weeeTax = $item->getWeeeTaxAppliedRowAmount() * $rate / 100;
                 $baseWeeeTax = $item->getBaseWeeeTaxAppliedRowAmount() * $rate / 100;
                 $rowTax += $weeeTax;
                 $baseRowTax += $baseWeeeTax;
                 $taxGroups[$rateKey]['weee_tax'][] = $this->_deltaRound($weeeTax, $rateKey, $inclTax);
                 $taxGroups[$rateKey]['base_weee_tax'][] = $this->_deltaRound($baseWeeeTax, $rateKey, $inclTax);
             }
             break;
         case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_EXCL:
         case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_INCL:
             if ($this->_helper->applyTaxOnOriginalPrice($this->_store)) {
                 $discount = $item->getOriginalDiscountAmount();
                 $baseDiscount = $item->getBaseOriginalDiscountAmount();
             } else {
                 $discount = $item->getDiscountAmount();
                 $baseDiscount = $item->getBaseDiscountAmount();
             }
             //weee discount should be removed when calculating hidden tax
             if ($isWeeeEnabled) {
                 $discount = $discount - $item->getWeeeDiscount();
                 $baseDiscount = $baseDiscount - $item->getBaseWeeeDiscount();
             }
             $taxSubtotal = max($subtotal - $discount, 0);
             $baseTaxSubtotal = max($baseSubtotal - $baseDiscount, 0);
             $rowTax = $this->_calculator->calcTaxAmount($taxSubtotal, $rate, $inclTax, false);
             $baseRowTax = $this->_calculator->calcTaxAmount($baseTaxSubtotal, $rate, $inclTax, false);
             if ($isWeeeEnabled && $this->_weeeHelper->isTaxable()) {
                 $weeeTax = ($item->getWeeeTaxAppliedRowAmount() - $item->getWeeeDiscount()) * $rate / 100;
                 $rowTax += $weeeTax;
                 $baseWeeeTax = ($item->getBaseWeeeTaxAppliedRowAmount() - $item->getBaseWeeeDiscount()) * $rate / 100;
                 $baseRowTax += $baseWeeeTax;
                 $taxGroups[$rateKey]['weee_tax'][] = $weeeTax;
                 $taxGroups[$rateKey]['base_weee_tax'][] = $baseWeeeTax;
             }
             if (!$item->getNoDiscount() && $item->getWeeeTaxApplied()) {
                 $rowTaxBeforeDiscount = $this->_calculator->calcTaxAmount($subtotal, $rate, $inclTax, false);
                 $baseRowTaxBeforeDiscount = $this->_calculator->calcTaxAmount($baseSubtotal, $rate, $inclTax, false);
                 if ($isWeeeTaxable) {
                     $rowTaxBeforeDiscount += $item->getWeeeTaxAppliedRowAmount() * $rate / 100;
                     $baseRowTaxBeforeDiscount += $item->getBaseWeeeTaxAppliedRowAmount() * $rate / 100;
                 }
             }
             if ($inclTax && $discount > 0) {
                 $hiddenTax = $this->_calculator->calcTaxAmount($discount, $rate, $inclTax, false);
                 $baseHiddenTax = $this->_calculator->calcTaxAmount($baseDiscount, $rate, $inclTax, false);
                 $this->_hiddenTaxes[] = array('rate_key' => $rateKey, 'qty' => 1, 'item' => $item, 'value' => $hiddenTax, 'base_value' => $baseHiddenTax, 'incl_tax' => $inclTax);
             }
             break;
     }
     $rowTax = $this->_deltaRound($rowTax, $rateKey, $inclTax);
     $baseRowTax = $this->_deltaRound($baseRowTax, $rateKey, $inclTax, 'base');
     $item->setTaxAmount(max(0, $rowTax));
     $item->setBaseTaxAmount(max(0, $baseRowTax));
     if (isset($rowTaxBeforeDiscount) && isset($baseRowTaxBeforeDiscount)) {
         $taxBeforeDiscount = max(0, $this->_deltaRound($rowTaxBeforeDiscount, $rateKey, $inclTax, 'tax_before_discount'));
         $baseTaxBeforeDiscount = max(0, $this->_deltaRound($baseRowTaxBeforeDiscount, $rateKey, $inclTax, 'tax_before_discount_base'));
         $item->setDiscountTaxCompensation($taxBeforeDiscount - max(0, $rowTax));
         $item->setBaseDiscountTaxCompensation($baseTaxBeforeDiscount - max(0, $baseRowTax));
     }
     $rowTotalInclTax = $item->getRowTotalInclTax();
     if (!isset($rowTotalInclTax)) {
         $weeeTaxBeforeDiscount = 0;
         $baseWeeeTaxBeforeDiscount = 0;
         if ($isWeeeTaxable) {
             $weeeTaxBeforeDiscount = $item->getWeeeTaxAppliedRowAmount() * $rate / 100;
             $baseWeeeTaxBeforeDiscount = $item->getBaseWeeeTaxAppliedRowAmount() * $rate / 100;
         }
         if ($this->_config->priceIncludesTax($this->_store)) {
             $item->setRowTotalInclTax($subtotal + $weeeTaxBeforeDiscount);
             $item->setBaseRowTotalInclTax($baseSubtotal + $baseWeeeTaxBeforeDiscount);
         } else {
             $taxCompensation = $item->getDiscountTaxCompensation() ? $item->getDiscountTaxCompensation() : 0;
             $item->setRowTotalInclTax($subtotal + $rowTax + $taxCompensation);
             $item->setBaseRowTotalInclTax($baseSubtotal + $baseRowTax + $item->getBaseDiscountTaxCompensation());
         }
     }
     $taxGroups[$rateKey]['totals'][] = max(0, $taxSubtotal);
     $taxGroups[$rateKey]['base_totals'][] = max(0, $baseTaxSubtotal);
     return $this;
 }
开发者ID:blazeriaz,项目名称:youguess,代码行数:101,代码来源:Tax.php


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