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


PHP Mage_Sales_Model_Quote_Item_Abstract::getBaseCalculationPrice方法代码示例

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


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

示例1: addItemDiscountPrices

 /**
  * Add additional amounts to discount calculation prices
  *
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  * @param   float $basePrice
  * @param   float $price
  * @return  Mage_SalesRule_Helper_Data
  */
 public function addItemDiscountPrices(Mage_Sales_Model_Quote_Item_Abstract $item, $basePrice, $price)
 {
     $discountPrice = $item->getDiscountCalculationPrice();
     $baseDiscountPrice = $item->getBaseDiscountCalculationPrice();
     if ($discountPrice || $baseDiscountPrice || $basePrice || $price) {
         $discountPrice = $discountPrice ? $discountPrice : $item->getCalculationPrice();
         $baseDiscountPrice = $baseDiscountPrice ? $baseDiscountPrice : $item->getBaseCalculationPrice();
         $this->setItemDiscountPrices($item, $baseDiscountPrice + $basePrice, $discountPrice + $price);
     }
     return $this;
 }
开发者ID:njaeger,项目名称:magento_github,代码行数:19,代码来源:Data.php

示例2: _getItemBasePrice

 /**
  * Return item base price
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract $item
  * @return float
  */
 protected function _getItemBasePrice($item)
 {
     $price = $item->getDiscountCalculationPrice();
     return $price !== null ? $item->getBaseDiscountCalculationPrice() : $item->getBaseCalculationPrice();
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:11,代码来源:Validator.php

示例3: _calcUnitTaxAmount

 /**
  * Calculate unit tax anount based on unit price
  *
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  * @param   float $rate
  * @return  Mage_Tax_Model_Sales_Total_Quote
  */
 protected function _calcUnitTaxAmount(Mage_Sales_Model_Quote_Item_Abstract $item, $rate)
 {
     $store = $item->getStore();
     $inclTax = $this->_usePriceIncludeTax($store);
     $extra = $item->getExtraTaxableAmount();
     $baseExtra = $item->getBaseExtraTaxableAmount();
     if ($inclTax) {
         $price = $store->roundPrice($item->getTaxCalcPrice()) + $extra;
         $basePrice = $store->roundPrice($item->getBaseTaxCalcPrice()) + $baseExtra;
     } else {
         if ($item->hasCustomPrice() && $this->_helper->applyTaxOnCustomPrice($store)) {
             $price = $store->roundPrice($item->getCalculationPrice()) + $extra;
             $basePrice = $store->roundPrice($item->getBaseCalculationPrice()) + $baseExtra;
         } else {
             $price = $store->roundPrice($item->getOriginalPrice()) + $item->getExtraTaxableAmount();
             $basePrice = $store->roundPrice($item->getBaseOriginalPrice()) + $item->getBaseExtraTaxableAmount();
         }
     }
     $discountAmount = $item->getDiscountAmount();
     $baseDiscountAmount = $item->getBaseDiscountAmount();
     $qty = $item->getTotalQty();
     $item->setTaxPercent($rate);
     $rate = $rate / 100;
     $calculationSequence = $this->_config->getCalculationSequence($store);
     switch ($calculationSequence) {
         case Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_EXCL:
             $unitTax = $this->_calculator->calcTaxAmount($price, $rate, $inclTax);
             $baseUnitTax = $this->_calculator->calcTaxAmount($basePrice, $rate, $inclTax);
             break;
         case Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_INCL:
             $unitTax = $this->_calculator->calcTaxAmount($price, $rate, $inclTax);
             $baseUnitTax = $this->_calculator->calcTaxAmount($basePrice, $rate, $inclTax);
             if ($inclTax) {
                 $item->setDiscountCalculationPrice($price);
                 $item->setBaseDiscountCalculationPrice($basePrice);
             } else {
                 $item->setDiscountCalculationPrice($price + $unitTax);
                 $item->setBaseDiscountCalculationPrice($basePrice + $baseUnitTax);
             }
             break;
         case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_EXCL:
         case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_INCL:
             $unitTax = $this->_calculator->calcTaxAmount($price - $discountAmount / $qty, $rate, $inclTax);
             $baseUnitTax = $this->_calculator->calcTaxAmount($basePrice - $baseDiscountAmount / $qty, $rate, $inclTax);
             break;
     }
     $totalTax = $store->roundPrice($qty * $unitTax);
     $totalBaseTax = $store->roundPrice($qty * $baseUnitTax);
     /**
      * Renew item amounts in case if we are working with price include tax
      */
     if ($inclTax) {
         if ($item->hasCustomPrice()) {
             $item->setCustomPrice($item->getPriceInclTax() - $unitTax);
             $item->setBaseCustomPrice($item->getBasePriceInclTax() - $baseUnitTax);
         } else {
             $item->setOriginalPrice($item->getPriceInclTax() - $unitTax);
             $item->setPrice($item->getBasePriceInclTax() - $baseUnitTax);
             $item->setBasePrice($item->getBasePriceInclTax() - $baseUnitTax);
         }
         $item->setRowTotal($item->getRowTotalInclTax() - $totalTax);
         $item->setBaseRowTotal($item->getBaseRowTotalInclTax() - $totalBaseTax);
     }
     $item->setTaxAmount($totalTax);
     $item->setBaseTaxAmount($totalBaseTax);
     return $this;
 }
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:74,代码来源:Tax.php

示例4: getItemBasePrice

 /**
  * Return item base price
  *
  * @param Mage_Sales_Model_Quote_Item_Abstract $item
  *
  * @return float
  */
 public function getItemBasePrice(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $price = $item->getDiscountCalculationPrice();
     return $price !== null ? $item->getBaseDiscountCalculationPrice() : $item->getBaseCalculationPrice();
 }
开发者ID:aoepeople,项目名称:aoe_salesrule,代码行数:12,代码来源:Data.php

示例5: _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_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->getCalculationPrice();
     $basePrice = $baseTaxPrice = $item->getBaseCalculationPrice();
     $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:codercv,项目名称:urbansurprisedev,代码行数:69,代码来源:Subtotal.php

示例6: itemToOrderItem

 /**
  * Convert quote item to order item
  *
  * @param   Mage_Sales_Model_Quote_Item_Abstract $item
  * @return  Mage_Sales_Model_Order_Item
  */
 public function itemToOrderItem(Mage_Sales_Model_Quote_Item_Abstract $item)
 {
     $orderItem = Mage::getModel('sales/order_item')->setStoreId($item->getStoreId())->setQuoteItemId($item->getId())->setProductId($item->getProductId())->setSuperProductId($item->getSuperProductId())->setParentProductId($item->getParentProductId())->setSku($item->getSku())->setName($item->getName())->setDescription($item->getDescription())->setWeight($item->getWeight())->setIsQtyDecimal($item->getIsQtyDecimal())->setQtyOrdered($item->getQty())->setOriginalPrice($item->getOriginalPrice())->setAppliedRuleIds($item->getAppliedRuleIds())->setAdditionalData($item->getAdditionalData())->setPrice($item->getCalculationPrice())->setTaxPercent($item->getTaxPercent())->setTaxAmount($item->getTaxAmount())->setRowWeight($item->getRowWeight())->setRowTotal($item->getRowTotal())->setBasePrice($item->getBaseCalculationPrice())->setBaseOriginalPrice($item->getPrice())->setBaseTaxAmount($item->getBaseTaxAmount())->setBaseRowTotal($item->getBaseRowTotal());
     if (!$item->getNoDiscount()) {
         $orderItem->setDiscountPercent($item->getDiscountPercent())->setDiscountAmount($item->getDiscountAmount())->setBaseDiscountAmount($item->getBaseDiscountAmount());
     }
     Mage::dispatchEvent('sales_convert_quote_item_to_order_item', array('order_item' => $orderItem, 'item' => $item));
     return $orderItem;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:15,代码来源:Quote.php


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