本文整理汇总了PHP中Magento\Tax\Model\Config::displaySalesTaxWithGrandTotal方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::displaySalesTaxWithGrandTotal方法的具体用法?PHP Config::displaySalesTaxWithGrandTotal怎么用?PHP Config::displaySalesTaxWithGrandTotal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Tax\Model\Config
的用法示例。
在下文中一共展示了Config::displaySalesTaxWithGrandTotal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTotalsForDisplay
/**
* Check if tax amount should be included to grandtotal block
* array(
* $index => array(
* 'amount' => $amount,
* 'label' => $label,
* 'font_size'=> $font_size
* )
* )
* @return array
*/
public function getTotalsForDisplay()
{
$store = $this->getOrder()->getStore();
if ($this->_taxConfig->displaySalesTaxWithGrandTotal($store)) {
return [];
}
$totals = [];
if ($this->_taxConfig->displaySalesFullSummary($store)) {
$totals = $this->getFullTaxInfo();
}
$totals = array_merge($totals, parent::getTotalsForDisplay());
return $totals;
}
示例2: getTotalsForDisplay
/**
* Check if tax amount should be included to grandtotals block
* array(
* $index => array(
* 'amount' => $amount,
* 'label' => $label,
* 'font_size'=> $font_size
* )
* )
* @return array
*/
public function getTotalsForDisplay()
{
$store = $this->getOrder()->getStore();
if (!$this->_taxConfig->displaySalesTaxWithGrandTotal($store)) {
return parent::getTotalsForDisplay();
}
$amount = $this->getOrder()->formatPriceTxt($this->getAmount());
$amountExclTax = $this->getAmount() - $this->getSource()->getTaxAmount();
$amountExclTax = $amountExclTax > 0 ? $amountExclTax : 0;
$amountExclTax = $this->getOrder()->formatPriceTxt($amountExclTax);
$tax = $this->getOrder()->formatPriceTxt($this->getSource()->getTaxAmount());
$fontSize = $this->getFontSize() ? $this->getFontSize() : 7;
$totals = [['amount' => $this->getAmountPrefix() . $amountExclTax, 'label' => __('Grand Total (Excl. Tax)') . ':', 'font_size' => $fontSize]];
if ($this->_taxConfig->displaySalesFullSummary($store)) {
$totals = array_merge($totals, $this->getFullTaxInfo());
}
$totals[] = ['amount' => $this->getAmountPrefix() . $tax, 'label' => __('Tax') . ':', 'font_size' => $fontSize];
$totals[] = ['amount' => $this->getAmountPrefix() . $amount, 'label' => __('Grand Total (Incl. Tax)') . ':', 'font_size' => $fontSize];
return $totals;
}
示例3: _initGrandTotal
/**
* @return $this
*/
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 \Magento\Framework\DataObject(['code' => 'grand_total', 'strong' => true, 'value' => $grandtotalExcl, 'base_value' => $baseGrandtotalExcl, 'label' => __('Grand Total (Excl.Tax)')]);
$totalIncl = new \Magento\Framework\DataObject(['code' => 'grand_total_incl', 'strong' => true, 'value' => $grandtotal, 'base_value' => $baseGrandtotal, 'label' => __('Grand Total (Incl.Tax)')]);
$parent->addTotal($totalExcl, 'grand_total');
$this->_addTax('grand_total');
$parent->addTotal($totalIncl, 'tax');
}
return $this;
}