本文整理汇总了PHP中Mage_Tax_Model_Config::displaySalesTaxWithGrandTotal方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Tax_Model_Config::displaySalesTaxWithGrandTotal方法的具体用法?PHP Mage_Tax_Model_Config::displaySalesTaxWithGrandTotal怎么用?PHP Mage_Tax_Model_Config::displaySalesTaxWithGrandTotal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Tax_Model_Config
的用法示例。
在下文中一共展示了Mage_Tax_Model_Config::displaySalesTaxWithGrandTotal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: _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;
}