本文整理汇总了PHP中Mage_Sales_Model_Quote_Item_Abstract::getStore方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Item_Abstract::getStore方法的具体用法?PHP Mage_Sales_Model_Quote_Item_Abstract::getStore怎么用?PHP Mage_Sales_Model_Quote_Item_Abstract::getStore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote_Item_Abstract
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote_Item_Abstract::getStore方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
{
$rowTotal = 0;
$baseRowTotal = 0;
$rowTotalInclTax = 0;
$baseRowTotalInclTax = 0;
$rowTax = 0;
$baseRowTax = 0;
$store = $item->getStore();
$qty = $item->getQty();
foreach ($item->getChildren() as $child) {
$rowTotal += $child->getRowTotal();
$baseRowTotal += $child->getBaseRowTotal();
$rowTotalInclTax += $child->getRowTotalInclTax();
$baseRowTotalInclTax += $child->getBaseRowTotalInclTax();
$rowTax += $child->getRowTax();
$baseRowTax += $child->getBaseRowTax();
}
$item->setConvertedPrice($store->roundPrice($rowTotal) / $qty);
$item->setPrice($store->roundPrice($baseRowTotal) / $qty);
$item->setRowTotal($rowTotal);
$item->setBaseRowTotal($baseRowTotal);
$item->setPriceInclTax($store->roundPrice($rowTotalInclTax) / $qty);
$item->setBasePriceInclTax($store->roundPrice($baseRowTotalInclTax) / $qty);
$item->setRowTotalInclTax($rowTotalInclTax);
$item->setBaseRowTotalInclTax($baseRowTotalInclTax);
$item->setRowTax($rowTax);
$item->setBaseRowTax($baseRowTax);
return $this;
}
示例2: _aggregateTaxPerRate
/**
* Aggregate row totals per tax rate in array
*
* @param Mage_Sales_Model_Quote_Item_Abstract $item
* @param float $rate
* @param array $taxGroups
* @return Mage_Tax_Model_Sales_Total_Quote
*/
protected function _aggregateTaxPerRate($item, $rate, &$taxGroups)
{
$store = $item->getStore();
$inclTax = $this->_usePriceIncludeTax($store);
if ($inclTax) {
$subtotal = $item->getTaxCalcRowTotal();
$baseSubtotal = $item->getBaseTaxCalcRowTotal();
} else {
if ($item->hasCustomPrice() && $this->_helper->applyTaxOnCustomPrice($store)) {
$subtotal = $item->getRowTotal();
$baseSubtotal = $item->getBaseRowTotal();
} else {
$subtotal = $item->getTotalQty() * $item->getOriginalPrice();
$baseSubtotal = $item->getTotalQty() * $item->getBaseOriginalPrice();
}
}
$discountAmount = $item->getDiscountAmount();
$baseDiscountAmount = $item->getBaseDiscountAmount();
$qty = $item->getTotalQty();
$rateKey = (string) $rate;
/**
* Add extra amounts which can be taxable too
*/
$calcTotal = $subtotal + $item->getExtraRowTaxableAmount();
$baseCalcTotal = $baseSubtotal + $item->getBaseExtraRowTaxableAmount();
$item->setTaxPercent($rate);
if (!isset($taxGroups[$rateKey]['totals'])) {
$taxGroups[$rateKey]['totals'] = array();
}
if (!isset($taxGroups[$rateKey]['totals'])) {
$taxGroups[$rateKey]['base_totals'] = array();
}
$calculationSequence = $this->_helper->getCalculationSequence($store);
switch ($calculationSequence) {
case Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_EXCL:
$rowTax = $this->_calculator->calcTaxAmount($calcTotal, $rate, $inclTax, false);
$baseRowTax = $this->_calculator->calcTaxAmount($baseCalcTotal, $rate, $inclTax, false);
break;
case Mage_Tax_Model_Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_INCL:
$rowTax = $this->_calculator->calcTaxAmount($calcTotal, $rate, $inclTax, false);
$baseRowTax = $this->_calculator->calcTaxAmount($baseCalcTotal, $rate, $inclTax, false);
$discountPrice = $inclTax ? $subtotal / $qty : ($subtotal + $rowTax) / $qty;
$baseDiscountPrice = $inclTax ? $baseSubtotal / $qty : ($baseSubtotal + $baseRowTax) / $qty;
$item->setDiscountCalculationPrice($discountPrice);
$item->setBaseDiscountCalculationPrice($baseDiscountPrice);
break;
case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_EXCL:
case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_INCL:
$calcTotal = $calcTotal - $discountAmount;
$baseCalcTotal = $baseCalcTotal - $baseDiscountAmount;
$rowTax = $this->_calculator->calcTaxAmount($calcTotal, $rate, $inclTax, false);
$baseRowTax = $this->_calculator->calcTaxAmount($baseCalcTotal, $rate, $inclTax, false);
break;
}
/**
* "Delta" rounding
*/
$delta = isset($this->_roundingDeltas[$rateKey]) ? $this->_roundingDeltas[$rateKey] : 0;
$baseDelta = isset($this->_baseRoundingDeltas[$rateKey]) ? $this->_baseRoundingDeltas[$rateKey] : 0;
$rowTax += $delta;
$baseRowTax += $baseDelta;
$this->_roundingDeltas[$rateKey] = $rowTax - $this->_calculator->round($rowTax);
$this->_baseRoundingDeltas[$rateKey] = $baseRowTax - $this->_calculator->round($baseRowTax);
$rowTax = $this->_calculator->round($rowTax);
$baseRowTax = $this->_calculator->round($baseRowTax);
/**
* Renew item amounts in case if we are working with price include tax
*/
if ($inclTax) {
$unitTax = $this->_calculator->round($rowTax / $qty);
$baseUnitTax = $this->_calculator->round($baseRowTax / $qty);
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() - $rowTax);
$item->setBaseRowTotal($item->getBaseRowTotalInclTax() - $baseRowTax);
}
$item->setTaxAmount($rowTax);
$item->setBaseTaxAmount($baseRowTax);
$taxGroups[$rateKey]['totals'][] = $calcTotal;
$taxGroups[$rateKey]['base_totals'][] = $baseCalcTotal;
return $this;
}