本文整理汇总了PHP中Mage_Tax_Model_Config类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Tax_Model_Config类的具体用法?PHP Mage_Tax_Model_Config怎么用?PHP Mage_Tax_Model_Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Tax_Model_Config类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: discountTax
/**
* Get configuration setting "Apply Discount On Prices Including Tax" value
* Always apply discount first since AvaTax does not support line-level item discount amounts
*
* @param null|int $store
* @return bool
*/
public function discountTax($store = null)
{
if (Mage::helper('avatax')->isAvataxEnabled($store)) {
return false;
}
return parent::discountTax($store);
}
开发者ID:virtual97,项目名称:avatax,代码行数:14,代码来源:Config.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)
{
$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;
}
开发者ID:redesignMob,项目名称:extensii,代码行数:32,代码来源:Tax.php
示例3: _needSubtractShippingTax
/**
* Check if we need subtract store tax amount from shipping
*
* @deprecated after 1.4.0.0
* @param Mage_Sales_Model_Quote_Address $address
* @return bool
*/
protected function _needSubtractShippingTax($address)
{
$store = $address->getQuote()->getStore();
if ($this->_config->shippingPriceIncludesTax($store) || $this->_config->getNeedUseShippingExcludeTax()) {
return true;
}
return false;
}
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:15,代码来源:Shipping.php
示例4: initTotals
/**
* Initialize reward points totals
*
* @return Enterprise_Reward_Block_Sales_Order_Total
*/
public function initTotals()
{
$store = $this->getStore();
$source = $this->getSource();
$parent = $this->getParentBlock();
$grandototal = $parent->getTotal('grand_total');
if (!$grandototal || !(double) $source->getGrandTotal()) {
return $this;
}
try {
if ($this->getOrder()->getDcOrderId() || $this->getOrder()->getFailedCalculation()) {
if ($this->_config->displaySalesTaxWithGrandTotal($store)) {
$value = $source->getImportDutyTax();
$baseValue = $source->getBaseImportDutyTax();
$title = $this->getOrder()->getDeliveryDutyType() == Dutycalculator_Charge_Helper_Data::DC_DELIVERY_TYPE_DDU ? $this->getOrder()->getFailedCalculation() ? 'Any import duty & taxes are paid upon delivery and are not included in the final price' : 'Estimated import duty & taxes (Not included in grand total, paid upon delivery)' : 'Import duty and taxes';
if ($source->getDcOrderId()) {
$title .= ' (<a href="' . Mage::getStoreConfig('dc_charge_extension/dccharge/calculation_details_uri') . $source->getDcOrderId() . '/" target="_blank">View details</a>)';
}
$importDutyAndTaxes = new Varien_Object(array('code' => 'import_duty_tax', 'strong' => false, 'label' => $title, 'no_escape' => true, 'value' => $source instanceof Mage_Sales_Model_Order_Creditmemo ? -$value : $value, 'base_value' => $source instanceof Mage_Sales_Model_Order_Creditmemo ? -$baseValue : $baseValue));
$grandTotal = $parent->getTotal('grand_total');
$grandTotalIncl = $parent->getTotal('grand_total_incl');
if ($grandTotal) {
$newGrandTotalExcl = max($grandTotal->value - $source->getImportDutyTax(), 0);
$newGrandTotalBaseExcl = max($grandTotal->base_value - $source->getBaseImportDutyTax(), 0);
$totalExcl = new Varien_Object(array('code' => 'grand_total', 'strong' => true, 'value' => $newGrandTotalExcl, 'base_value' => $newGrandTotalBaseExcl, 'label' => $grandTotal->getLabel()));
$parent->addTotal($totalExcl, 'grand_total');
if (!$grandTotalIncl) {
$totalIncl = new Varien_Object(array('code' => 'grand_total_incl', 'strong' => true, 'value' => $this->getOrder()->getGrandTotal(), 'base_value' => $this->getOrder()->getBaseGrandTotal(), 'label' => $this->__('Grand Total (Incl.Tax)')));
$parent->addTotal($totalIncl, 'tax');
}
}
} else {
$value = $source->getImportDutyTax();
$baseValue = $source->getBaseImportDutyTax();
$title = $this->getOrder()->getDeliveryDutyType() == Dutycalculator_Charge_Helper_Data::DC_DELIVERY_TYPE_DDU ? $this->getOrder()->getFailedCalculation() ? 'Any import duty & taxes are paid upon delivery and are not included in the final price' : 'Estimated import duty & taxes (Not included in grand total, paid upon delivery)' : 'Import duty and taxes';
if ($source->getDcOrderId()) {
$title .= ' (<a href="' . Mage::getStoreConfig('dc_charge_extension/dccharge/calculation_details_uri') . $source->getDcOrderId() . '/" target="_blank">View details</a>)';
}
$importDutyAndTaxes = new Varien_Object(array('code' => 'import_duty_tax', 'strong' => false, 'label' => $title, 'no_escape' => true, 'value' => $source instanceof Mage_Sales_Model_Order_Creditmemo ? -$value : $value, 'base_value' => $source instanceof Mage_Sales_Model_Order_Creditmemo ? -$baseValue : $baseValue));
}
$parent->addTotal($importDutyAndTaxes, $this->getAfterCondition());
}
} catch (Exception $ex) {
}
return $this;
}
开发者ID:Fishead-Communications,项目名称:dutycalculator_charge_import_duty,代码行数:51,代码来源:Total.php
示例5: priceIncludesTax
public function priceIncludesTax($store = null)
{
$bid_id = Mage::getSingleton('core/session')->getData('bid_id');
if (!$bid_id) {
return parent::priceIncludesTax($store);
} else {
if ((int) Mage::getStoreConfig('auction/tax/is_included_tax') == 1) {
return true;
} else {
return false;
}
}
}
开发者ID:ashfaqphplhr,项目名称:artificiallawnsforturf,代码行数:13,代码来源:TaxConfig.php
示例6: 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();
$items = $this->_getAddressItems($address);
$discountTaxCompensation = 0;
foreach ($items as $item) {
$discountTaxCompensation += $item->getDiscountTaxCompensation();
}
$taxAmount = $amount + $discountTaxCompensation;
/*
* when weee discount is not included in extraTaxAmount, we need to add it to the total tax
*/
if ($this->_weeeHelper->isEnabled()) {
if (!$this->_weeeHelper->includeInSubtotal()) {
$taxAmount += $address->getWeeeDiscount();
}
}
$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() + $taxAmount - $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;
}
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:46,代码来源:Tax.php
示例7: _initGrandTotal
protected function _initGrandTotal()
{
$store = $this->getStore();
$parent = $this->getParentBlock();
$grandototal = $parent->getTotal('grand_total');
if (!$grandototal || !(double) $this->_source->getGrandTotal()) {
return $this;
}
if ($this->_config->displaySalesTaxWithGrandTotal($store)) {
$grandtotal = $this->_source->getGrandTotal();
$baseGrandtotal = $this->_source->getBaseGrandTotal();
$grandtotalExcl = $grandtotal - $this->_source->getTaxAmount();
$baseGrandtotalExcl = $baseGrandtotal - $this->_source->getBaseTaxAmount();
$grandtotalExcl = max($grandtotalExcl, 0);
$baseGrandtotalExcl = max($baseGrandtotalExcl, 0);
$totalExcl = new Varien_Object(array('code' => 'grand_total', 'strong' => true, 'value' => $grandtotalExcl, 'base_value' => $baseGrandtotalExcl, 'label' => $this->__('Grand Total (Excl.Tax)')));
$totalIncl = new Varien_Object(array('code' => 'grand_total_incl', 'strong' => true, 'value' => $grandtotal, 'base_value' => $baseGrandtotal, 'label' => $this->__('Grand Total (Incl.Tax)')));
$parent->addTotal($totalExcl, 'grand_total');
$this->_addTax('grand_total');
$parent->addTotal($totalIncl, 'tax');
}
return $this;
}
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:23,代码来源:Tax.php
示例8: shippingPriceIncludesTax
/**
* Check if shipping prices include tax
*
* @param Mage_Core_Model_Store|int $store
* @return bool
*/
public function shippingPriceIncludesTax($store = null)
{
if ($this->_getDataHelper()->isServiceEnabled($store)) {
if ($this->_getTaxDataHelper()->priceIncludesTax($store)) {
return true;
}
return false;
}
return parent::shippingPriceIncludesTax($store);
}
开发者ID:onepica,项目名称:avatax,代码行数:16,代码来源:Config.php
示例9: isCrossBorderTradeEnabled
/**
* Return whether cross border trade is enabled or not
*
* @param null|int $store
* @return boolean
*/
public function isCrossBorderTradeEnabled($store = null)
{
return (bool) $this->_config->crossBorderTradeEnabled($store);
}
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:10,代码来源:Data.php
示例10: getCalculationAgorithm
/**
* Get tax caclulation algorithm code
*
* @param null|int $store
* @return string
*/
public function getCalculationAgorithm($store = null)
{
return $this->_config->getAlgorithm($store);
}
开发者ID:jpbender,项目名称:mage_virtual,代码行数:10,代码来源:Data.php
示例11: collect
/**
* Collect totals information about shipping
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Mage_Sales_Model_Quote_Address_Total_Shipping
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
parent::collect($address);
$calc = $this->_calculator;
$store = $address->getQuote()->getStore();
$storeTaxRequest = $calc->getRateOriginRequest($store);
$addressTaxRequest = $calc->getRateRequest($address, $address->getQuote()->getBillingAddress(), $address->getQuote()->getCustomerTaxClassId(), $store);
$shippingTaxClass = $this->_config->getShippingTaxClass($store);
$storeTaxRequest->setProductClassId($shippingTaxClass);
$addressTaxRequest->setProductClassId($shippingTaxClass);
$priceIncludesTax = $this->_config->shippingPriceIncludesTax($store);
if ($priceIncludesTax) {
$this->_areTaxRequestsSimilar = $calc->compareRequests($addressTaxRequest, $storeTaxRequest);
}
$shipping = $taxShipping = $address->getShippingAmount();
$baseShipping = $baseTaxShipping = $address->getBaseShippingAmount();
$rate = $calc->getRate($addressTaxRequest);
if ($priceIncludesTax) {
if ($this->_areTaxRequestsSimilar) {
$tax = $this->_round($calc->calcTaxAmount($shipping, $rate, true, false), $rate, true);
$baseTax = $this->_round($calc->calcTaxAmount($baseShipping, $rate, true, false), $rate, true, 'base');
$taxShipping = $shipping;
$baseTaxShipping = $baseShipping;
$shipping = $shipping - $tax;
$baseShipping = $baseShipping - $baseTax;
$taxable = $taxShipping;
$baseTaxable = $baseTaxShipping;
$isPriceInclTax = true;
} else {
$storeRate = $calc->getStoreRate($addressTaxRequest, $store);
$storeTax = $calc->calcTaxAmount($shipping, $storeRate, true, false);
$baseStoreTax = $calc->calcTaxAmount($baseShipping, $storeRate, true, false);
$shipping = $calc->round($shipping - $storeTax);
$baseShipping = $calc->round($baseShipping - $baseStoreTax);
$tax = $this->_round($calc->calcTaxAmount($shipping, $rate, false, false), $rate, false);
$baseTax = $this->_round($calc->calcTaxAmount($baseShipping, $rate, false, false), $rate, false, 'base');
$taxShipping = $shipping + $tax;
$baseTaxShipping = $baseShipping + $baseTax;
$taxable = $shipping;
$baseTaxable = $baseShipping;
$isPriceInclTax = false;
}
} else {
$tax = $this->_round($calc->calcTaxAmount($shipping, $rate, false, false), $rate, false);
$baseTax = $this->_round($calc->calcTaxAmount($baseShipping, $rate, false, false), $rate, false, 'base');
$taxShipping = $shipping + $tax;
$baseTaxShipping = $baseShipping + $baseTax;
$taxable = $shipping;
$baseTaxable = $baseShipping;
$isPriceInclTax = false;
}
$address->setTotalAmount('shipping', $shipping);
$address->setBaseTotalAmount('shipping', $baseShipping);
$address->setShippingInclTax($taxShipping);
$address->setBaseShippingInclTax($baseTaxShipping);
$address->setShippingTaxable($taxable);
$address->setBaseShippingTaxable($baseTaxable);
$address->setIsShippingInclTax($isPriceInclTax);
if ($this->_config->discountTax($store)) {
$address->setShippingAmountForDiscount($taxShipping);
$address->setBaseShippingAmountForDiscount($baseTaxShipping);
}
return $this;
}
开发者ID:relue,项目名称:magento2,代码行数:70,代码来源:Shipping.php
示例12: displaySalesShippingBoth
/**
* Check if display sales shipping include and exclude tax
*
* @param mixed $store
* @return bool
*/
public function displaySalesShippingBoth($store = null)
{
if ($this->_getDataHelper()->isAvataxEnabled($store)) {
return false;
}
return parent::displaySalesShippingBoth($store);
}
开发者ID:shabirm,项目名称:avatax,代码行数:13,代码来源:Config.php
示例13: _totalBaseCalculation
/**
* Calculate item price and row total including/excluding tax based on total price rounding level
*
* @param Mage_Sales_Model_Quote_Item_Abstract $item
* @param Varien_Object $request
* @return Mage_Tax_Model_Sales_Total_Quote_Subtotal
*/
protected function _totalBaseCalculation($item, $request)
{
$calc = $this->_calculator;
$request->setProductClassId($item->getProduct()->getTaxClassId());
$rate = $calc->getRate($request);
$qty = $item->getTotalQty();
$price = $taxPrice = $item->getCalculationPriceOriginal();
$basePrice = $baseTaxPrice = $item->getBaseCalculationPriceOriginal();
$subtotal = $taxSubtotal = $item->getRowTotal();
$baseSubtotal = $baseTaxSubtotal = $item->getBaseRowTotal();
$taxOnOrigPrice = !$this->_helper->applyTaxOnCustomPrice($this->_store) && $item->hasCustomPrice();
if ($taxOnOrigPrice) {
$origSubtotal = $item->getOriginalPrice() * $qty;
$baseOrigSubtotal = $item->getBaseOriginalPrice() * $qty;
}
$item->setTaxPercent($rate);
if ($this->_config->priceIncludesTax($this->_store)) {
if ($this->_sameRateAsStore($request)) {
if ($taxOnOrigPrice) {
$rowTax = $this->_deltaRound($calc->calcTaxAmount($origSubtotal, $rate, true, false), $rate, true);
$baseRowTax = $this->_deltaRound($calc->calcTaxAmount($baseOrigSubtotal, $rate, true, false), $rate, true, 'base');
$taxable = $origSubtotal;
$baseTaxable = $baseOrigSubtotal;
} else {
$rowTax = $this->_deltaRound($calc->calcTaxAmount($subtotal, $rate, true, false), $rate, true);
$baseRowTax = $this->_deltaRound($calc->calcTaxAmount($baseSubtotal, $rate, true, false), $rate, true, 'base');
$taxable = $subtotal;
$baseTaxable = $baseSubtotal;
}
$taxPrice = $price;
$baseTaxPrice = $basePrice;
$taxSubtotal = $subtotal;
$baseTaxSubtotal = $baseSubtotal;
$subtotal = $subtotal - $rowTax;
$baseSubtotal = $baseSubtotal - $baseRowTax;
$price = $calc->round($subtotal / $qty);
$basePrice = $calc->round($baseSubtotal / $qty);
$isPriceInclTax = true;
} else {
$storeRate = $calc->getStoreRate($request, $this->_store);
if ($taxOnOrigPrice) {
$storeTax = $calc->calcTaxAmount($origSubtotal, $storeRate, true, false);
$baseStoreTax = $calc->calcTaxAmount($baseOrigSubtotal, $storeRate, true, false);
} else {
$storeTax = $calc->calcTaxAmount($subtotal, $storeRate, true, false);
$baseStoreTax = $calc->calcTaxAmount($baseSubtotal, $storeRate, true, false);
}
$subtotal = $calc->round($subtotal - $storeTax);
$baseSubtotal = $calc->round($baseSubtotal - $baseStoreTax);
$price = $calc->round($subtotal / $qty);
$basePrice = $calc->round($baseSubtotal / $qty);
$rowTax = $this->_deltaRound($calc->calcTaxAmount($subtotal, $rate, false, false), $rate, true);
$baseRowTax = $this->_deltaRound($calc->calcTaxAmount($baseSubtotal, $rate, false, false), $rate, true, 'base');
$taxSubtotal = $subtotal + $rowTax;
$baseTaxSubtotal = $baseSubtotal + $baseRowTax;
$taxPrice = $calc->round($taxSubtotal / $qty);
$baseTaxPrice = $calc->round($baseTaxSubtotal / $qty);
$taxable = $subtotal;
$baseTaxable = $baseSubtotal;
$isPriceInclTax = false;
}
} else {
if ($taxOnOrigPrice) {
$rowTax = $this->_deltaRound($calc->calcTaxAmount($origSubtotal, $rate, false, false), $rate, true);
$baseRowTax = $this->_deltaRound($calc->calcTaxAmount($baseOrigSubtotal, $rate, false, false), $rate, true, 'base');
$taxable = $origSubtotal;
$baseTaxable = $baseOrigSubtotal;
} else {
$rowTax = $this->_deltaRound($calc->calcTaxAmount($subtotal, $rate, false, false), $rate, true);
$baseRowTax = $this->_deltaRound($calc->calcTaxAmount($baseSubtotal, $rate, false, false), $rate, true, 'base');
$taxable = $subtotal;
$baseTaxable = $baseSubtotal;
}
$taxSubtotal = $subtotal + $rowTax;
$baseTaxSubtotal = $baseSubtotal + $baseRowTax;
$taxPrice = $calc->round($taxSubtotal / $qty);
$baseTaxPrice = $calc->round($baseTaxSubtotal / $qty);
$isPriceInclTax = false;
}
if ($item->hasCustomPrice()) {
/**
* Initialize item original price before declaring custom price
*/
$item->getOriginalPrice();
$item->setCustomPrice($price);
$item->setBaseCustomPrice($basePrice);
} else {
$item->setConvertedPrice($price);
}
$item->setPrice($basePrice);
$item->setBasePrice($basePrice);
$item->setRowTotal($subtotal);
$item->setBaseRowTotal($baseSubtotal);
//.........这里部分代码省略.........
开发者ID:natxetee,项目名称:magento2,代码行数:101,代码来源:Subtotal.php
示例14: testPriceIncludesTaxNonDefault
/**
* @magentoConfigFixture current_store tax/calculation/price_includes_tax 1
*/
public function testPriceIncludesTaxNonDefault()
{
$this->assertTrue($this->_model->priceIncludesTax());
}
开发者ID:nayanchamp,项目名称:magento2,代码行数:7,代码来源:ConfigTest.php
注:本文中的Mage_Tax_Model_Config类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论