From c6dd3fdeff5a5deee6dc317f5c609ec787c92f8d Mon Sep 17 00:00:00 2001 From: Andreas Palm Date: Wed, 1 Mar 2023 12:39:42 +0100 Subject: [PATCH] bugfix: check for divisionByZero --- www/pages/shopimporter_presta.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/www/pages/shopimporter_presta.php b/www/pages/shopimporter_presta.php index cce154a8..1ff7f207 100644 --- a/www/pages/shopimporter_presta.php +++ b/www/pages/shopimporter_presta.php @@ -284,17 +284,20 @@ class Shopimporter_Presta extends ShopimporterBase $cart['articlelist'] = []; foreach ($order->associations->order_rows->order_row as $order_row) { - - $steuersatz = (strval($order_row->unit_price_tax_incl) / strval($order_row->unit_price_tax_excl)) - 1; - $steuersatz = round($steuersatz, 1); - - $cart['articlelist'][] = [ + $article = [ 'articleid' => strval($order_row->product_reference), 'name' => strval($order_row->product_name), 'quantity' => strval($order_row->product_quantity), '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[] = [