本文整理汇总了PHP中Mage_Sales_Model_Quote_Address::getShippingTaxAmount方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Address::getShippingTaxAmount方法的具体用法?PHP Mage_Sales_Model_Quote_Address::getShippingTaxAmount怎么用?PHP Mage_Sales_Model_Quote_Address::getShippingTaxAmount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote_Address
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote_Address::getShippingTaxAmount方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetch
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$store = $address->getQuote()->getStore();
$taxConfig = Mage::getSingleton('tax/config');
$salesHelper = Mage::helper('sales');
if ($taxConfig->displayCartSubtotalBoth($store) || $taxConfig->displayCartSubtotalInclTax($store)) {
if ($address->getSubtotalInclTax() > 0) {
$subtotalInclTax = $address->getSubtotalInclTax();
} else {
$subtotalInclTax = $address->getSubtotal() + $address->getTaxAmount() - $address->getShippingTaxAmount() - $address->getPaymentFeeTax();
}
$address->addTotal(array('code' => 'subtotal', 'title' => $salesHelper->__('Subtotal'), 'value' => $subtotalInclTax, 'value_incl_tax' => $subtotalInclTax, 'value_excl_tax' => $address->getSubtotal()));
}
return $this;
}
示例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)
{
$applied = $address->getAppliedTaxes();
$store = $address->getQuote()->getStore();
$amount = $address->getTaxAmount();
$area = null;
if ($this->_config->displayCartTaxWithGrandTotal($store) && $address->getGrandTotal()) {
$area = 'taxes';
}
if ($amount != 0 || $this->_config->displayCartZeroTax($store)) {
$address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('tax')->__('Tax'), 'full_info' => $applied ? $applied : array(), 'value' => $amount, 'area' => $area));
}
$store = $address->getQuote()->getStore();
/**
* Modify subtotal
*/
if ($this->_config->displayCartSubtotalBoth($store) || $this->_config->displayCartSubtotalInclTax($store)) {
if ($address->getSubtotalInclTax() > 0) {
$subtotalInclTax = $address->getSubtotalInclTax();
} else {
$subtotalInclTax = $address->getSubtotal() + $address->getTaxAmount() - $address->getShippingTaxAmount();
}
$address->addTotal(array('code' => 'subtotal', 'title' => Mage::helper('sales')->__('Subtotal'), 'value' => $subtotalInclTax, 'value_incl_tax' => $subtotalInclTax, 'value_excl_tax' => $address->getSubtotal()));
}
return $this;
}
示例3: _calculateShippingTaxByRate
/**
*
* @param Mage_Sales_Model_Quote_Address $address
* @param float $rate
* @param array $appliedRates
* @param string $taxId
*/
protected function _calculateShippingTaxByRate(Mage_Sales_Model_Quote_Address $address, $rate, $appliedRates, $taxId = null)
{
$inclTax = $address->getIsShippingInclTax();
$shipping = $address->getShippingTaxable();
$baseShipping = $address->getBaseShippingTaxable();
$rateKey = $taxId == null ? (string) $rate : $taxId;
$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:
$tax = $this->_calculator->calcTaxAmount($shipping, $rate, $inclTax, false);
$baseTax = $this->_calculator->calcTaxAmount($baseShipping, $rate, $inclTax, false);
break;
case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_EXCL:
case Mage_Tax_Model_Calculation::CALC_TAX_AFTER_DISCOUNT_ON_INCL:
$discountAmount = $address->getShippingDiscountAmount();
$baseDiscountAmount = $address->getBaseShippingDiscountAmount();
$tax = $this->_calculator->calcTaxAmount($shipping - $discountAmount, $rate, $inclTax, false);
$baseTax = $this->_calculator->calcTaxAmount($baseShipping - $baseDiscountAmount, $rate, $inclTax, false);
break;
}
if ($this->_config->getAlgorithm($this->_store) == Mage_Tax_Model_Calculation::CALC_TOTAL_BASE) {
$tax = $this->_deltaRound($tax, $rateKey, $inclTax);
$baseTax = $this->_deltaRound($baseTax, $rateKey, $inclTax, 'base');
$this->_addAmount(max(0, $tax));
$this->_addBaseAmount(max(0, $baseTax));
} else {
$tax = $this->_calculator->round($tax);
$baseTax = $this->_calculator->round($baseTax);
$this->_addAmount(max(0, $tax));
$this->_addBaseAmount(max(0, $baseTax));
}
if ($inclTax && !empty($discountAmount)) {
$taxBeforeDiscount = $this->_calculator->calcTaxAmount($shipping, $rate, $inclTax, false);
$baseTaxBeforeDiscount = $this->_calculator->calcTaxAmount($baseShipping, $rate, $inclTax, false);
if ($this->_config->getAlgorithm($this->_store) == Mage_Tax_Model_Calculation::CALC_TOTAL_BASE) {
$taxBeforeDiscount = $this->_deltaRound($taxBeforeDiscount, $rateKey, $inclTax, 'tax_before_discount');
$baseTaxBeforeDiscount = $this->_deltaRound($baseTaxBeforeDiscount, $rateKey, $inclTax, 'tax_before_discount_base');
} else {
$taxBeforeDiscount = $this->_calculator->round($taxBeforeDiscount);
$baseTaxBeforeDiscount = $this->_calculator->round($baseTaxBeforeDiscount);
}
$hiddenTax = max(0, $taxBeforeDiscount - max(0, $tax));
$baseHiddenTax = max(0, $baseTaxBeforeDiscount - max(0, $baseTax));
$this->_hiddenTaxes[] = array('rate_key' => $rateKey, 'value' => $hiddenTax, 'base_value' => $baseHiddenTax, 'incl_tax' => $inclTax);
}
$address->setShippingTaxAmount($address->getShippingTaxAmount() + max(0, $tax));
$address->setBaseShippingTaxAmount($address->getBaseShippingTaxAmount() + max(0, $baseTax));
$this->_saveAppliedTaxes($address, $appliedRates, $tax, $baseTax, $rate);
}
示例4: 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;
}
示例5: fetch
/**
* Add tax totals information to address object
*
* @param Mage_Sales_Model_Quote_Address $address
* @return $this
*/
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$config = Mage::getSingleton('tax/config');
$quote = $address->getQuote();
$store = $quote->getStore();
$amount = $address->getTaxAmount();
if ($amount != 0 || Mage::helper('tax')->displayZeroTax($store)) {
$address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('tax')->__('Tax'), 'full_info' => $address->getAppliedTaxes(), 'value' => $amount, 'area' => null));
}
/**
* Modify subtotal
*/
if (method_exists($config, "displayCartSubtotalBoth") && method_exists($config, "displayCartSubtotalInclTax") && ($config->displayCartSubtotalBoth($store) || $config->displayCartSubtotalInclTax($store))) {
if ($address->getSubtotalInclTax() > 0) {
$subtotalInclTax = $address->getSubtotalInclTax();
} else {
$subtotalInclTax = $address->getSubtotal() + $address->getTaxAmount() - $address->getShippingTaxAmount();
}
$address->addTotal(array('code' => 'subtotal', 'title' => Mage::helper('sales')->__('Subtotal'), 'value' => $subtotalInclTax, 'value_incl_tax' => $subtotalInclTax, 'value_excl_tax' => $address->getSubtotal()));
}
return $this;
}