Small bugfix in presta importer, improve steuersaetze.php

This commit is contained in:
Andreas Palm 2023-01-29 00:56:37 +01:00
parent 5539c9849c
commit d705d1a3eb
2 changed files with 15 additions and 7 deletions

View File

@ -203,10 +203,10 @@ class Shopimporter_Presta extends ShopimporterBase
$cart['bestelldatum'] = strval($order->date_add);
$carrier = $this->prestaRequest('GET', "carriers/$order->id_carrier");
$cart['lieferung'] = strval($carrier->name);
$cart['lieferung'] = strval($carrier->carrier->name);
$customer = $this->prestaRequest('GET', "customers/$order->id_customer");
$cart['email'] = strval($customer->email);
$cart['email'] = strval($customer->customer->email);
$invoiceAddress = $this->prestaRequest('GET', "addresses/$order->id_address_invoice");
$invoiceAddress = $invoiceAddress->address;
@ -263,6 +263,14 @@ class Shopimporter_Presta extends ShopimporterBase
}
}
$taxes = [];
$this->app->erp->RunHook('getTaxRatesFromShopOrder', 2, $taxedCountry, $taxes);
if (isset($taxes['normal']) && $taxes['normal'] > 0)
$cart['steuersatz_normal'] = $taxes['normal'];
if (isset($taxes['ermaessigt']) && $taxes['ermaessigt'] > 0)
$cart['steuersatz_ermaessigt'] = $taxes['ermaessigt'];
$cart['articlelist'] = [];
foreach ($order->associations->order_rows->order_row as $order_row) {

View File

@ -154,7 +154,7 @@ class Steuersaetze {
$ret = [];
$taxes = $this->app->DB->SelectArr(
sprintf(
"SELECT DISTINCT `satz`
"SELECT DISTINCT `type`, `satz`
FROM `steuersaetze`
WHERE `aktiv` = 1
AND (`country_code` = '%s' OR (`bezeichnung` = '%s' AND `country_code` = ''))",
@ -163,7 +163,7 @@ class Steuersaetze {
);
if(!empty($taxes)) {
foreach($taxes as $rates) {
$ret[] = $rates['satz'];
$ret[$rates['type']] = $rates['satz'];
}
}