12 class Tax extends \Magento\Catalog\Model\Product\Attribute\Backend\Price
42 \
Magento\Directory\Model\CurrencyFactory $currencyFactory,
44 \
Magento\Catalog\Helper\Data $catalogData,
47 \
Magento\Directory\Helper\Data $directoryHelper,
51 $this->_directoryHelper = $directoryHelper;
53 $this->_attributeTax = $attributeTax;
69 return \Magento\Weee\Model\Attribute\Backend\Weee\Tax::class;
81 $taxes = $object->getData($this->
getAttribute()->getName());
86 foreach ($taxes as
$tax) {
87 if (!empty(
$tax[
'delete'])) {
90 $state = isset(
$tax[
'state']) ? (
$tax[
'state'] > 0 ?
$tax[
'state'] : 0) :
'0';
91 $key1 = implode(
'-', [
$tax[
'website_id'],
$tax[
'country'], $state]);
92 if (!empty($dup[$key1])) {
94 __(
'Set unique country-state combinations within the same fixed product tax. ' 95 .
'Verify the combinations and try again.')
115 if (
$data[
$i][
'website_id'] == 0) {
116 $rate = $this->_storeManager->getStore()->getBaseCurrency()->getRate(
117 $this->_directoryHelper->getBaseCurrencyCode()
139 $orig = $object->getOrigData($this->
getAttribute()->getName());
140 $current = $object->getData($this->
getAttribute()->getName());
141 if ($orig == $current) {
145 $this->_attributeTax->deleteProductData($object, $this->
getAttribute());
146 $taxes = $object->getData($this->
getAttribute()->getName());
148 if (!is_array($taxes)) {
152 foreach ($taxes as
$tax) {
153 if ((empty(
$tax[
'price']) && empty(
$tax[
'value'])) || empty(
$tax[
'country']) || !empty(
$tax[
'delete'])) {
157 $state = isset(
$tax[
'state']) ?
$tax[
'state'] :
'0';
160 $data[
'website_id'] =
$tax[
'website_id'];
162 $data[
'state'] = $state;
166 $this->_attributeTax->insertProductData($object,
$data);
177 $this->_attributeTax->deleteProductData($object, $this->
getAttribute());
186 return $this->_attributeTax->getTable(
'weee_tax');
194 return $this->_attributeTax->getIdFieldName();
static getBackendModelName()
__construct(\Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, \Magento\Framework\App\Config\ScopeConfigInterface $config, \Magento\Framework\Locale\FormatInterface $localeFormat, \Magento\Directory\Helper\Data $directoryHelper, \Magento\Weee\Model\ResourceModel\Attribute\Backend\Weee\Tax $attributeTax, ScopeOverriddenValue $scopeOverriddenValue=null)