bugfix: check for divisionByZero

This commit is contained in:
Andreas Palm 2023-03-01 12:39:42 +01:00
parent 76c770aba3
commit c6dd3fdeff

View File

@ -284,17 +284,20 @@ class Shopimporter_Presta extends ShopimporterBase
$cart['articlelist'] = []; $cart['articlelist'] = [];
foreach ($order->associations->order_rows->order_row as $order_row) { foreach ($order->associations->order_rows->order_row as $order_row) {
$article = [
$steuersatz = (strval($order_row->unit_price_tax_incl) / strval($order_row->unit_price_tax_excl)) - 1;
$steuersatz = round($steuersatz, 1);
$cart['articlelist'][] = [
'articleid' => strval($order_row->product_reference), 'articleid' => strval($order_row->product_reference),
'name' => strval($order_row->product_name), 'name' => strval($order_row->product_name),
'quantity' => strval($order_row->product_quantity), 'quantity' => strval($order_row->product_quantity),
'price_netto' => strval($order_row->unit_price_tax_excl), 'price_netto' => strval($order_row->unit_price_tax_excl),
'steuersatz' => $steuersatz
]; ];
if ($order_row->unit_price_tax_excl > 0) {
$steuersatz = (strval($order_row->unit_price_tax_incl) / strval($order_row->unit_price_tax_excl)) - 1;
$steuersatz = round($steuersatz, 1);
$article['steuersatz'] = $steuersatz;
}
$cart['articlelist'][] = $article;
} }
$fetchedOrders[] = [ $fetchedOrders[] = [