本文整理汇总了PHP中Magento\Tax\Model\Config::displaySalesShippingBoth方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::displaySalesShippingBoth方法的具体用法?PHP Config::displaySalesShippingBoth怎么用?PHP Config::displaySalesShippingBoth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Tax\Model\Config
的用法示例。
在下文中一共展示了Config::displaySalesShippingBoth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkDisplaySettings
/**
* Check if tax calculation type and price display settings are compatible
*
* Invalid settings if
* Tax Calculation Method Based On 'Total' or 'Row'
* and at least one Price Display Settings has 'Including and Excluding Tax' value
*
* @param null|int|bool|string|\Magento\Store\Model\Store $store $store
* @return bool
*/
public function checkDisplaySettings($store = null)
{
if ($this->taxConfig->getAlgorithm($store) == \Magento\Tax\Model\Calculation::CALC_UNIT_BASE) {
return true;
}
return $this->taxConfig->getPriceDisplayType($store) != \Magento\Tax\Model\Config::DISPLAY_TYPE_BOTH && $this->taxConfig->getShippingPriceDisplayType($store) != \Magento\Tax\Model\Config::DISPLAY_TYPE_BOTH && !$this->taxConfig->displayCartPricesBoth($store) && !$this->taxConfig->displayCartSubtotalBoth($store) && !$this->taxConfig->displayCartShippingBoth($store) && !$this->taxConfig->displaySalesPricesBoth($store) && !$this->taxConfig->displaySalesSubtotalBoth($store) && !$this->taxConfig->displaySalesShippingBoth($store);
}
示例2: getTotalsForDisplay
/**
* Get array of arrays with totals information for display in PDF
* array(
* $index => array(
* 'amount' => $amount,
* 'label' => $label,
* 'font_size'=> $font_size
* )
* )
* @return array
*/
public function getTotalsForDisplay()
{
$store = $this->getOrder()->getStore();
$amount = $this->getOrder()->formatPriceTxt($this->getAmount());
$amountInclTax = $this->getSource()->getShippingInclTax();
if (!$amountInclTax) {
$amountInclTax = $this->getAmount() + $this->getSource()->getShippingTaxAmount();
}
$amountInclTax = $this->getOrder()->formatPriceTxt($amountInclTax);
$fontSize = $this->getFontSize() ? $this->getFontSize() : 7;
if ($this->_taxConfig->displaySalesShippingBoth($store)) {
$totals = [['amount' => $this->getAmountPrefix() . $amount, 'label' => __('Shipping (Excl. Tax)') . ':', 'font_size' => $fontSize], ['amount' => $this->getAmountPrefix() . $amountInclTax, 'label' => __('Shipping (Incl. Tax)') . ':', 'font_size' => $fontSize]];
} elseif ($this->_taxConfig->displaySalesShippingInclTax($store)) {
$totals = [['amount' => $this->getAmountPrefix() . $amountInclTax, 'label' => __($this->getTitle()) . ':', 'font_size' => $fontSize]];
} else {
$totals = [['amount' => $this->getAmountPrefix() . $amount, 'label' => __($this->getTitle()) . ':', 'font_size' => $fontSize]];
}
return $totals;
}
示例3: getShippingLabel
/**
* Get label for shipping total based on configuration settings
*
* @return string
*/
public function getShippingLabel()
{
$source = $this->getSource();
if ($this->_taxConfig->displaySalesShippingInclTax($source->getOrder()->getStoreId())) {
$label = __('Refund Shipping (Incl. Tax)');
} elseif ($this->_taxConfig->displaySalesShippingBoth($source->getOrder()->getStoreId())) {
$label = __('Refund Shipping (Excl. Tax)');
} else {
$label = __('Refund Shipping');
}
return $label;
}
示例4: _initShipping
/**
* @return $this
*/
protected function _initShipping()
{
$store = $this->getStore();
$parent = $this->getParentBlock();
$shipping = $parent->getTotal('shipping');
if (!$shipping) {
return $this;
}
if ($this->_config->displaySalesShippingBoth($store)) {
$shipping = (double) $this->_source->getShippingAmount();
$baseShipping = (double) $this->_source->getBaseShippingAmount();
$shippingIncl = (double) $this->_source->getShippingInclTax();
if (!$shippingIncl) {
$shippingIncl = $shipping + (double) $this->_source->getShippingTaxAmount();
}
$baseShippingIncl = (double) $this->_source->getBaseShippingInclTax();
if (!$baseShippingIncl) {
$baseShippingIncl = $baseShipping + (double) $this->_source->getBaseShippingTaxAmount();
}
$totalExcl = new \Magento\Framework\DataObject(['code' => 'shipping', 'value' => $shipping, 'base_value' => $baseShipping, 'label' => __('Shipping & Handling (Excl.Tax)')]);
$totalIncl = new \Magento\Framework\DataObject(['code' => 'shipping_incl', 'value' => $shippingIncl, 'base_value' => $baseShippingIncl, 'label' => __('Shipping & Handling (Incl.Tax)')]);
$parent->addTotal($totalExcl, 'shipping');
$parent->addTotal($totalIncl, 'shipping');
} elseif ($this->_config->displaySalesShippingInclTax($store)) {
$shippingIncl = $this->_source->getShippingInclTax();
if (!$shippingIncl) {
$shippingIncl = $this->_source->getShippingAmount() + $this->_source->getShippingTaxAmount();
}
$baseShippingIncl = $this->_source->getBaseShippingInclTax();
if (!$baseShippingIncl) {
$baseShippingIncl = $this->_source->getBaseShippingAmount() + $this->_source->getBaseShippingTaxAmount();
}
$total = $parent->getTotal('shipping');
if ($total) {
$total->setValue($shippingIncl);
$total->setBaseValue($baseShippingIncl);
}
}
return $this;
}