123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- /**
- * Configuration paths storage
- *
- * @author Magento Core Team <core@magentocommerce.com>
- */
- namespace Magento\Tax\Model;
- use Magento\Store\Model\Store;
- /**
- * @SuppressWarnings(PHPMD.ExcessivePublicCount)
- */
- class Config
- {
- // tax notifications
- const XML_PATH_TAX_NOTIFICATION_IGNORE_DISCOUNT = 'tax/notification/ignore_discount';
- const XML_PATH_TAX_NOTIFICATION_IGNORE_PRICE_DISPLAY = 'tax/notification/ignore_price_display';
- const XML_PATH_TAX_NOTIFICATION_IGNORE_APPLY_DISCOUNT = 'tax/notification/ignore_apply_discount';
- const XML_PATH_TAX_NOTIFICATION_INFO_URL = 'tax/notification/info_url';
- // tax classes
- const CONFIG_XML_PATH_SHIPPING_TAX_CLASS = 'tax/classes/shipping_tax_class';
- // tax calculation
- const CONFIG_XML_PATH_PRICE_INCLUDES_TAX = 'tax/calculation/price_includes_tax';
- const CONFIG_XML_PATH_SHIPPING_INCLUDES_TAX = 'tax/calculation/shipping_includes_tax';
- const CONFIG_XML_PATH_BASED_ON = 'tax/calculation/based_on';
- const CONFIG_XML_PATH_APPLY_ON = 'tax/calculation/apply_tax_on';
- const CONFIG_XML_PATH_APPLY_AFTER_DISCOUNT = 'tax/calculation/apply_after_discount';
- const CONFIG_XML_PATH_DISCOUNT_TAX = 'tax/calculation/discount_tax';
- const XML_PATH_ALGORITHM = 'tax/calculation/algorithm';
- const CONFIG_XML_PATH_CROSS_BORDER_TRADE_ENABLED = 'tax/calculation/cross_border_trade_enabled';
- // tax defaults
- const CONFIG_XML_PATH_DEFAULT_COUNTRY = 'tax/defaults/country';
- const CONFIG_XML_PATH_DEFAULT_REGION = 'tax/defaults/region';
- const CONFIG_XML_PATH_DEFAULT_POSTCODE = 'tax/defaults/postcode';
- /**
- * Prices display settings
- */
- const CONFIG_XML_PATH_PRICE_DISPLAY_TYPE = 'tax/display/type';
- const CONFIG_XML_PATH_DISPLAY_SHIPPING = 'tax/display/shipping';
- /**
- * Shopping cart display settings
- */
- const XML_PATH_DISPLAY_CART_PRICE = 'tax/cart_display/price';
- const XML_PATH_DISPLAY_CART_SUBTOTAL = 'tax/cart_display/subtotal';
- const XML_PATH_DISPLAY_CART_SHIPPING = 'tax/cart_display/shipping';
- /** @deprecated */
- const XML_PATH_DISPLAY_CART_DISCOUNT = 'tax/cart_display/discount';
- const XML_PATH_DISPLAY_CART_GRANDTOTAL = 'tax/cart_display/grandtotal';
- const XML_PATH_DISPLAY_CART_FULL_SUMMARY = 'tax/cart_display/full_summary';
- const XML_PATH_DISPLAY_CART_ZERO_TAX = 'tax/cart_display/zero_tax';
- /**
- * Shopping cart display settings
- */
- const XML_PATH_DISPLAY_SALES_PRICE = 'tax/sales_display/price';
- const XML_PATH_DISPLAY_SALES_SUBTOTAL = 'tax/sales_display/subtotal';
- const XML_PATH_DISPLAY_SALES_SHIPPING = 'tax/sales_display/shipping';
- /** @deprecated */
- const XML_PATH_DISPLAY_SALES_DISCOUNT = 'tax/sales_display/discount';
- const XML_PATH_DISPLAY_SALES_GRANDTOTAL = 'tax/sales_display/grandtotal';
- const XML_PATH_DISPLAY_SALES_FULL_SUMMARY = 'tax/sales_display/full_summary';
- const XML_PATH_DISPLAY_SALES_ZERO_TAX = 'tax/sales_display/zero_tax';
- const CALCULATION_STRING_SEPARATOR = '|';
- const DISPLAY_TYPE_EXCLUDING_TAX = 1;
- const DISPLAY_TYPE_INCLUDING_TAX = 2;
- const DISPLAY_TYPE_BOTH = 3;
- /**
- * Price conversion constant for positive
- */
- const PRICE_CONVERSION_PLUS = 1;
- /**
- * Price conversion constant for negative
- */
- const PRICE_CONVERSION_MINUS = 2;
- /**
- * @var bool|null
- */
- protected $_priceIncludesTax = null;
- /**
- * Flag which notify what we need use shipping prices exclude tax for calculations
- *
- * @var bool
- */
- protected $_needUseShippingExcludeTax = false;
- /**
- * @var $_shippingPriceIncludeTax bool
- */
- protected $_shippingPriceIncludeTax = null;
- /**
- * Core store config
- *
- * @var \Magento\Framework\App\Config\ScopeConfigInterface
- */
- protected $_scopeConfig;
- /**
- * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
- */
- public function __construct(\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig)
- {
- $this->_scopeConfig = $scopeConfig;
- }
- /**
- * Check if prices of product in catalog include tax
- *
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function priceIncludesTax($store = null)
- {
- if (null !== $this->_priceIncludesTax) {
- return $this->_priceIncludesTax;
- }
- return (bool)$this->_scopeConfig->getValue(
- self::CONFIG_XML_PATH_PRICE_INCLUDES_TAX,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- );
- }
- /**
- * Override "price includes tax" variable regardless of system configuration of any store
- *
- * @param bool|null $value
- * @return $this
- */
- public function setPriceIncludesTax($value)
- {
- if (null === $value) {
- $this->_priceIncludesTax = null;
- } else {
- $this->_priceIncludesTax = (bool)$value;
- }
- return $this;
- }
- /**
- * Check what taxes should be applied after discount
- *
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function applyTaxAfterDiscount($store = null)
- {
- return (bool)$this->_scopeConfig->getValue(
- self::CONFIG_XML_PATH_APPLY_AFTER_DISCOUNT,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- );
- }
- /**
- * Get product price display type
- * 1 - Excluding tax
- * 2 - Including tax
- * 3 - Both
- *
- * @param null|string|bool|int|Store $store
- * @return int
- */
- public function getPriceDisplayType($store = null)
- {
- return (int)$this->_scopeConfig->getValue(
- self::CONFIG_XML_PATH_PRICE_DISPLAY_TYPE,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- );
- }
- /**
- * Get configuration setting "Apply Discount On Prices Including Tax" value
- *
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function discountTax($store = null)
- {
- return (int)$this->_scopeConfig->getValue(
- self::CONFIG_XML_PATH_DISCOUNT_TAX,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == 1;
- }
- /**
- * Get taxes/discounts calculation sequence.
- * This sequence depends on "Apply Customer Tax" and "Apply Discount On Prices" configuration options.
- *
- * @param null|int|string|Store $store
- * @return string
- */
- public function getCalculationSequence($store = null)
- {
- if ($this->applyTaxAfterDiscount($store)) {
- if ($this->discountTax($store)) {
- $seq = \Magento\Tax\Model\Calculation::CALC_TAX_AFTER_DISCOUNT_ON_INCL;
- } else {
- $seq = \Magento\Tax\Model\Calculation::CALC_TAX_AFTER_DISCOUNT_ON_EXCL;
- }
- } else {
- if ($this->discountTax($store)) {
- $seq = \Magento\Tax\Model\Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_INCL;
- } else {
- $seq = \Magento\Tax\Model\Calculation::CALC_TAX_BEFORE_DISCOUNT_ON_EXCL;
- }
- }
- return $seq;
- }
- /**
- * Specify flag what we need use shipping price exclude tax
- *
- * @param bool $flag
- * @return \Magento\Tax\Model\Config
- */
- public function setNeedUseShippingExcludeTax($flag)
- {
- $this->_needUseShippingExcludeTax = $flag;
- return $this;
- }
- /**
- * Get flag what we need use shipping price exclude tax
- *
- * @return bool $flag
- * @SuppressWarnings(PHPMD.BooleanGetMethodName)
- */
- public function getNeedUseShippingExcludeTax()
- {
- return $this->_needUseShippingExcludeTax;
- }
- /**
- * Get defined tax calculation algorithm
- *
- * @param null|string|bool|int|Store $store
- * @return string
- */
- public function getAlgorithm($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_ALGORITHM,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- );
- }
- /**
- * Get tax class id specified for shipping tax estimation
- *
- * @param null|string|bool|int|Store $store
- * @return int
- */
- public function getShippingTaxClass($store = null)
- {
- return (int)$this->_scopeConfig->getValue(
- self::CONFIG_XML_PATH_SHIPPING_TAX_CLASS,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- );
- }
- /**
- * Get shipping methods prices display type
- *
- * @param null|string|bool|int|Store $store
- * @return int
- */
- public function getShippingPriceDisplayType($store = null)
- {
- return (int)$this->_scopeConfig->getValue(
- self::CONFIG_XML_PATH_DISPLAY_SHIPPING,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- );
- }
- /**
- * Check if shipping prices include tax
- *
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function shippingPriceIncludesTax($store = null)
- {
- if ($this->_shippingPriceIncludeTax === null) {
- $this->_shippingPriceIncludeTax = (bool)$this->_scopeConfig->getValue(
- self::CONFIG_XML_PATH_SHIPPING_INCLUDES_TAX,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- );
- }
- return $this->_shippingPriceIncludeTax;
- }
- /**
- * Declare shipping prices type
- *
- * @param bool $flag
- * @return $this
- */
- public function setShippingPriceIncludeTax($flag)
- {
- $this->_shippingPriceIncludeTax = $flag;
- return $this;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displayCartPricesInclTax($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_CART_PRICE,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_INCLUDING_TAX;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displayCartPricesExclTax($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_CART_PRICE,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_EXCLUDING_TAX;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displayCartPricesBoth($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_CART_PRICE,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_BOTH;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displayCartSubtotalInclTax($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_CART_SUBTOTAL,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_INCLUDING_TAX;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displayCartSubtotalExclTax($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_CART_SUBTOTAL,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_EXCLUDING_TAX;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displayCartSubtotalBoth($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_CART_SUBTOTAL,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_BOTH;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displayCartShippingInclTax($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_CART_SHIPPING,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_INCLUDING_TAX;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displayCartShippingExclTax($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_CART_SHIPPING,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_EXCLUDING_TAX;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displayCartShippingBoth($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_CART_SHIPPING,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_BOTH;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- * @deprecated 100.1.3
- */
- public function displayCartDiscountInclTax($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_CART_DISCOUNT,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_INCLUDING_TAX;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- * @deprecated 100.1.3
- */
- public function displayCartDiscountExclTax($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_CART_DISCOUNT,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_EXCLUDING_TAX;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- * @deprecated 100.1.3
- */
- public function displayCartDiscountBoth($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_CART_DISCOUNT,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_BOTH;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displayCartTaxWithGrandTotal($store = null)
- {
- return (bool)$this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_CART_GRANDTOTAL,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- );
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displayCartFullSummary($store = null)
- {
- return (bool)$this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_CART_FULL_SUMMARY,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- );
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displayCartZeroTax($store = null)
- {
- return (bool)$this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_CART_ZERO_TAX,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- );
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displaySalesPricesInclTax($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_SALES_PRICE,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_INCLUDING_TAX;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displaySalesPricesExclTax($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_SALES_PRICE,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_EXCLUDING_TAX;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displaySalesPricesBoth($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_SALES_PRICE,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_BOTH;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displaySalesSubtotalInclTax($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_SALES_SUBTOTAL,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_INCLUDING_TAX;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displaySalesSubtotalExclTax($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_SALES_SUBTOTAL,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_EXCLUDING_TAX;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displaySalesSubtotalBoth($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_SALES_SUBTOTAL,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_BOTH;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displaySalesShippingInclTax($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_SALES_SHIPPING,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_INCLUDING_TAX;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displaySalesShippingExclTax($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_SALES_SHIPPING,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_EXCLUDING_TAX;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displaySalesShippingBoth($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_SALES_SHIPPING,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_BOTH;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- * @deprecated 100.1.3
- */
- public function displaySalesDiscountInclTax($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_SALES_DISCOUNT,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_INCLUDING_TAX;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- * @deprecated 100.1.3
- */
- public function displaySalesDiscountExclTax($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_SALES_DISCOUNT,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_EXCLUDING_TAX;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- * @deprecated 100.1.3
- */
- public function displaySalesDiscountBoth($store = null)
- {
- return $this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_SALES_DISCOUNT,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- ) == self::DISPLAY_TYPE_BOTH;
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displaySalesTaxWithGrandTotal($store = null)
- {
- return (bool)$this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_SALES_GRANDTOTAL,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- );
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displaySalesFullSummary($store = null)
- {
- return (bool)$this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_SALES_FULL_SUMMARY,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- );
- }
- /**
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function displaySalesZeroTax($store = null)
- {
- return (bool)$this->_scopeConfig->getValue(
- self::XML_PATH_DISPLAY_SALES_ZERO_TAX,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- );
- }
- /**
- * Return the config value for self::CONFIG_XML_PATH_CROSS_BORDER_TRADE_ENABLED
- *
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function crossBorderTradeEnabled($store = null)
- {
- return (bool)$this->_scopeConfig->getValue(
- self::CONFIG_XML_PATH_CROSS_BORDER_TRADE_ENABLED,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- );
- }
- /**
- * Check if admin notification related to misconfiguration of "Apply Discount On Prices" should be ignored.
- *
- * Warning is displayed in case when "Catalog Prices" = "Excluding Tax"
- * AND "Apply Discount On Prices" = "Including Tax"
- * AND "Apply Customer Tax" = "After Discount"
- *
- * @param null|string|Store $store
- * @return bool
- */
- public function isWrongApplyDiscountSettingIgnored($store = null)
- {
- return (bool)$this->_scopeConfig->getValue(
- self::XML_PATH_TAX_NOTIFICATION_IGNORE_APPLY_DISCOUNT,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- );
- }
- /**
- * Check if do not show notification about wrong display settings
- *
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function isWrongDisplaySettingsIgnored($store = null)
- {
- return (bool)$this->_scopeConfig->getValue(
- self::XML_PATH_TAX_NOTIFICATION_IGNORE_PRICE_DISPLAY,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- );
- }
- /**
- * Check if do not show notification about wrong discount settings
- *
- * @param null|string|bool|int|Store $store
- * @return bool
- */
- public function isWrongDiscountSettingsIgnored($store = null)
- {
- return (bool)$this->_scopeConfig->getValue(
- self::XML_PATH_TAX_NOTIFICATION_IGNORE_DISCOUNT,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- );
- }
- /**
- * Return the notification info url
- *
- * @param null|string|bool|int|Store $store
- * @return string
- */
- public function getInfoUrl($store = null)
- {
- return (string)$this->_scopeConfig->getValue(
- self::XML_PATH_TAX_NOTIFICATION_INFO_URL,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
- $store
- );
- }
- /**
- * Check if necessary do product price conversion
- * If it necessary will be returned conversion type (minus or plus)
- *
- * @param null|int|string|Store $store
- * @return bool|int
- * @SuppressWarnings(PHPMD.CyclomaticComplexity)
- */
- public function needPriceConversion($store = null)
- {
- $res = 0;
- $priceIncludesTax = $this->priceIncludesTax($store) || $this->getNeedUseShippingExcludeTax();
- if ($priceIncludesTax) {
- switch ($this->getPriceDisplayType($store)) {
- case self::DISPLAY_TYPE_EXCLUDING_TAX:
- case self::DISPLAY_TYPE_BOTH:
- return self::PRICE_CONVERSION_MINUS;
- case self::DISPLAY_TYPE_INCLUDING_TAX:
- $res = false;
- break;
- default:
- break;
- }
- } else {
- switch ($this->getPriceDisplayType($store)) {
- case self::DISPLAY_TYPE_INCLUDING_TAX:
- case self::DISPLAY_TYPE_BOTH:
- return self::PRICE_CONVERSION_PLUS;
- case self::DISPLAY_TYPE_EXCLUDING_TAX:
- $res = false;
- break;
- default:
- break;
- }
- }
- if ($res === false) {
- $res = $this->displayCartPricesBoth();
- }
- return $res;
- }
- }
|