Shopware: Shopware TaxId can be defined in config (e.g. if multiple countries with different tax rates and a different default values are used)

This commit is contained in:
Andreas Palm 2023-10-06 22:25:04 +02:00
parent 362d035140
commit 6feaa03b8e

View File

@ -38,6 +38,9 @@ class Shopimporter_Shopware6 extends ShopimporterBase
public $propertyOption; public $propertyOption;
public $shopwareDefaultSalesChannel; public $shopwareDefaultSalesChannel;
public $shopwareMediaFolder; public $shopwareMediaFolder;
private $normalTaxId;
private $reducedTaxId;
public $protocol; public $protocol;
/** @var bool */ /** @var bool */
@ -586,6 +589,8 @@ class Shopimporter_Shopware6 extends ShopimporterBase
$this->propertyOption = $einstellungen['felder']['shopwarePropertyOption']; $this->propertyOption = $einstellungen['felder']['shopwarePropertyOption'];
$this->shopwareDefaultSalesChannel = $einstellungen['felder']['shopwareDefaultSalesChannel']; $this->shopwareDefaultSalesChannel = $einstellungen['felder']['shopwareDefaultSalesChannel'];
$this->shopwareMediaFolder = $einstellungen['felder']['shopwareMediaFolder']; $this->shopwareMediaFolder = $einstellungen['felder']['shopwareMediaFolder'];
$this->normalTaxId = $einstellungen['felder']['normalTaxId'];
$this->reducedTaxId = $einstellungen['felder']['reducedTaxId'];
$query = sprintf('SELECT `steuerfreilieferlandexport` FROM `shopexport` WHERE `id` = %d', $this->shopid); $query = sprintf('SELECT `steuerfreilieferlandexport` FROM `shopexport` WHERE `id` = %d', $this->shopid);
$this->taxationByDestinationCountry = !empty($this->app->DB->Select($query)); $this->taxationByDestinationCountry = !empty($this->app->DB->Select($query));
@ -669,6 +674,16 @@ class Shopimporter_Shopware6 extends ShopimporterBase
'size' => 40, 'size' => 40,
'default' => 'Product Media' 'default' => 'Product Media'
], ],
'normalTaxId' => [
'typ' => 'text',
'bezeichnung' => '{|TaxId für Steuersatz "normal"|}',
'size' => 40,
],
'reducedTaxId' => [
'typ' => 'text',
'bezeichnung' => '{|TaxId für Steuersatz "ermäßigt"|}',
'size' => 40,
],
'statesToFetch' => [ 'statesToFetch' => [
'typ' => 'text', 'typ' => 'text',
'bezeichnung' => '{|Abzuholender Bestellstatus|}:', 'bezeichnung' => '{|Abzuholender Bestellstatus|}:',
@ -927,7 +942,12 @@ class Shopimporter_Shopware6 extends ShopimporterBase
$quantity = $this->getCorrectedStockFromAvailable($active, (int)$quantity, $articleInfo); $quantity = $this->getCorrectedStockFromAvailable($active, (int)$quantity, $articleInfo);
$taxRate = (float)$article['steuersatz']; $taxRate = (float)$article['steuersatz'];
$taxId = $this->getTaxIdByRate($taxRate); if (!empty($this->normalTaxId) && $article['umsatzsteuer'] == 'normal')
$taxId = $this->normalTaxId;
else if (!empty($this->reducedTaxId) && $article['umsatzsteuer'] == 'ermäßigt')
$taxId = $this->reducedTaxId;
else
$taxId = $this->getTaxIdByRate($taxRate);
$mediaToAdd = $this->mediaToExport($article, $articleIdShopware); $mediaToAdd = $this->mediaToExport($article, $articleIdShopware);