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


PHP Mage_Sales_Model_Quote_Address::setSubtotalInclTax方法代码示例

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


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

示例1: _addSubtotalAmount

 /**
  * Add row total item amount to subtotal
  *
  * @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 _addSubtotalAmount(Mage_Sales_Model_Quote_Address $address, $item)
 {
     if ($this->_config->priceIncludesTax($this->_store)) {
         $subTotal = $item->getRowTotalInclTax() - $item->getRowTax();
         $baseSubTotal = $item->getBaseRowTotalInclTax() - $item->getBaseRowTax();
         $address->setTotalAmount('subtotal', $address->getTotalAmount('subtotal') + $subTotal);
         $address->setBaseTotalAmount('subtotal', $address->getBaseTotalAmount('subtotal') + $baseSubTotal);
     } else {
         $address->setTotalAmount('subtotal', $address->getTotalAmount('subtotal') + $item->getRowTotal());
         $address->setBaseTotalAmount('subtotal', $address->getBaseTotalAmount('subtotal') + $item->getBaseRowTotal());
     }
     $address->setSubtotalInclTax($address->getSubtotalInclTax() + $item->getRowTotalInclTax());
     $address->setBaseSubtotalInclTax($address->getBaseSubtotalInclTax() + $item->getBaseRowTotalInclTax());
     return $this;
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:23,代码来源:Subtotal.php

示例2: fetch

 /**
  * Add tax totals information to address object
  *
  * @param   Mage_Sales_Model_Quote_Address $address
  * @return  Mage_Tax_Model_Sales_Total_Quote
  */
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $config = Mage::getSingleton('tax/config');
     $quote = $address->getQuote();
     $store = $quote->getStore();
     $amount = $address->getTaxAmount();
     $fullInfo = array();
     $summary = Mage::getModel('avatax/avatax_estimate')->getSummary($address->getId());
     foreach ($summary as $key => $row) {
         $id = 'avatax-' . $key;
         $fullInfo[$id] = array('rates' => array(array('code' => $row['name'], 'title' => $row['name'], 'percent' => $row['rate'], 'position' => $key, 'priority' => $key, 'rule_id' => 0)), 'percent' => $row['rate'], 'id' => $id, 'process' => 0, 'amount' => $row['amt'], 'base_amount' => $row['amt']);
     }
     if ($amount != 0 || Mage::helper('tax')->displayZeroTax($store)) {
         $address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('tax')->__('Tax'), 'full_info' => $fullInfo, 'value' => $amount, 'area' => null));
     }
     /**
      * Modify subtotal
      */
     if (method_exists($config, "displayCartSubtotalBoth") && method_exists($config, "displayCartSubtotalInclTax") && ($config->displayCartSubtotalBoth($store) || $config->displayCartSubtotalInclTax($store))) {
         $subtotalInclTax = $address->getSubtotal() + $address->getTaxAmount() - $address->getShippingTaxAmount();
         $address->setSubtotalInclTax($subtotalInclTax);
         $address->addTotal(array('code' => 'subtotal', 'title' => Mage::helper('sales')->__('Subtotal'), 'value' => $subtotalInclTax, 'value_incl_tax' => $subtotalInclTax, 'value_excl_tax' => $address->getSubtotal()));
     }
     return $this;
 }
开发者ID:shabirm,项目名称:avatax,代码行数:31,代码来源:Tax.php

示例3: collect

 /**
  * Calculate item price including/excluding tax, row total including/excluding tax
  * and subtotal including/excluding tax.
  * Determine discount price if needed
  *
  * @param   Mage_Sales_Model_Quote_Address $address
  * @return  Mage_Tax_Model_Sales_Total_Quote_Subtotal
  */
 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     $this->_store = $address->getQuote()->getStore();
     $this->_address = $address;
     $this->_subtotalInclTax = 0;
     $this->_baseSubtotalInclTax = 0;
     $this->_subtotal = 0;
     $this->_baseSubtotal = 0;
     $this->_roundingDeltas = array();
     $address->setSubtotalInclTax(0);
     $address->setBaseSubtotalInclTax(0);
     $address->setTotalAmount('subtotal', 0);
     $address->setBaseTotalAmount('subtotal', 0);
     $items = $this->_getAddressItems($address);
     if (!$items) {
         return $this;
     }
     $addressRequest = $this->_getAddressTaxRequest($address);
     $storeRequest = $this->_getStoreTaxRequest($address);
     $this->_calculator->setCustomer($address->getQuote()->getCustomer());
     if ($this->_config->priceIncludesTax($this->_store)) {
         $classIds = array();
         foreach ($items as $item) {
             $classIds[] = $item->getProduct()->getTaxClassId();
             if ($item->getHasChildren()) {
                 foreach ($item->getChildren() as $child) {
                     $classIds[] = $child->getProduct()->getTaxClassId();
                 }
             }
         }
         $classIds = array_unique($classIds);
         $storeRequest->setProductClassId($classIds);
         $addressRequest->setProductClassId($classIds);
         $this->_areTaxRequestsSimilar = $this->_calculator->compareRequests($storeRequest, $addressRequest);
     }
     foreach ($items as $item) {
         if ($item->getParentItem()) {
             continue;
         }
         $origItem = clone $item;
         if ($item->getHasChildren() && $item->isChildrenCalculated()) {
             foreach ($item->getChildren() as $child) {
                 $this->_processItem($child, $addressRequest);
                 if ($child->getTaxPercent() > 0) {
                     $item->setTaxPercent($child->getTaxPercent());
                 }
             }
             $this->_recalculateParent($item);
         } else {
             $this->_processItem($item, $addressRequest);
         }
         if ($origItem->getCustomPrice()) {
             $taxPercent = $item->getTaxPercent();
             $customPrice = $origItem->getCustomPrice();
             $price = $customPrice;
             $taxAmount = $customPrice * ($taxPercent / 100);
             $baseTaxAmount = $customPrice * ($taxPercent / 100);
             $basePrice = $customPrice;
             $rowTotal = $customPrice * $item->getQty();
             $baseRowTotal = $customPrice * $item->getQty();
             $priceInclTax = $customPrice + $taxAmount;
             $basePriceInclTax = $customPrice + $baseTaxAmount;
             $rowTotalInclTax = $priceInclTax * $item->getQty();
             $baseRowTotalInclTax = $basePriceInclTax * $item->getQty();
             $item->setCustomPrice($origItem->getCustomPrice());
             $item->setConvertedPrice($price);
             $item->setPrice($basePrice);
             $item->setRowTotal($rowTotal);
             $item->setBaseRowTotal($baseRowTotal);
             $item->setTaxableAmount($rowTotal);
             $item->setBaseTaxableAmount($baseRowTotal);
             $item->setPriceInclTax($priceInclTax);
             $item->setBasePriceInclTax($basePriceInclTax);
             $item->setRowTotalInclTax($rowTotalInclTax);
             $item->setBaseRowTotalInclTax($baseRowTotalInclTax);
             $count = 0;
             if ($item->getHasChildren()) {
                 foreach ($item->getChildren() as $child) {
                     if ($count === 0) {
                         $child->setTaxableAmount($rowTotal);
                         $child->setBaseTaxableAmount($baseRowTotal);
                     } else {
                         $child->setTaxableAmount(0);
                         $child->setBaseTaxableAmount(0);
                     }
                     $count++;
                 }
             }
         }
         $this->_addSubtotalAmount($address, $item);
     }
     $address->setRoundingDeltas($this->_roundingDeltas);
//.........这里部分代码省略.........
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:101,代码来源:Subtotal.php

示例4: _addSubtotalAmount

 /**
  * Add row total item amount to subtotal
  *
  * @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 _addSubtotalAmount(Mage_Sales_Model_Quote_Address $address, $item)
 {
     $address->setTotalAmount('subtotal', $address->getTotalAmount('subtotal') + $item->getRowTotal());
     $address->setBaseTotalAmount('subtotal', $address->getBaseTotalAmount('subtotal') + $item->getBaseRowTotal());
     $address->setSubtotalInclTax($address->getSubtotalInclTax() + $item->getRowTotalInclTax());
     $address->setBaseSubtotalInclTax($address->getBaseSubtotalInclTax() + $item->getBaseRowTotalInclTax());
     return $this;
 }
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:15,代码来源:Subtotal.php


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