From c6dd3fdeff5a5deee6dc317f5c609ec787c92f8d Mon Sep 17 00:00:00 2001 From: Andreas Palm Date: Wed, 1 Mar 2023 12:39:42 +0100 Subject: [PATCH 1/3] 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[] = [ From 5d1201637facad46d2463b37e0848d47c1a0a4a6 Mon Sep 17 00:00:00 2001 From: Andreas Palm Date: Sun, 30 Jul 2023 22:08:32 +0200 Subject: [PATCH 2/3] Prestashop: Import metakeywords --- www/pages/shopimporter_presta.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/www/pages/shopimporter_presta.php b/www/pages/shopimporter_presta.php index 1ff7f207..793deab0 100644 --- a/www/pages/shopimporter_presta.php +++ b/www/pages/shopimporter_presta.php @@ -384,13 +384,26 @@ class Shopimporter_Presta extends ShopimporterBase $res['kurztext_de'] = strip_tags($shortdescriptions['de']); $res['kurztext_en'] = strip_tags($shortdescriptions['en']); $res['hersteller'] = strval($product->product->manufacturer_name); - $res['metakeywords_de'] = $metakeywords['de']; - $res['metakeywords_en'] = $metakeywords['en']; $res['metatitle_de'] = $metatitles['de']; $res['metatitle_en'] = $metatitles['en']; $res['metadescription_de'] = $metadescriptions['de']; $res['metadescription_en'] = $metadescriptions['en']; + $tags = $product->product->associations->tags->tag; + $keywords = []; + foreach ($tags as $tag) { + $tagid = intval($tag->id); + $endpoint = "tags/{$tagid}"; + $tagdata = $this->prestaRequest('GET', $endpoint); + $tagiso = $this->langidToIso[intval($tagdata->tag->id_lang)]; + $tagvalue = strval($tagdata->tag->name); + if (!array_key_exists($tagiso, $keywords)) + $keywords[$tagiso] = []; + $keywords[$tagiso][] = $tagvalue; + } + $res['metakeywords_de'] = join(',', $keywords['de'] ?? []); + $res['metakeywords_en'] = join(',', $keywords['en'] ?? []); + $images = []; foreach ($product->product->associations->images->image as $img) { $endpoint = "images/products/$productId/$img->id"; From b759e2accdb1e3debd99577e70e7638c55d9558b Mon Sep 17 00:00:00 2001 From: Andreas Palm Date: Tue, 19 Sep 2023 14:37:54 +0200 Subject: [PATCH 3/3] Prestashop: small fix to reduce errors in log --- www/pages/shopimporter_presta.php | 1 + 1 file changed, 1 insertion(+) diff --git a/www/pages/shopimporter_presta.php b/www/pages/shopimporter_presta.php index 793deab0..c669f07c 100644 --- a/www/pages/shopimporter_presta.php +++ b/www/pages/shopimporter_presta.php @@ -23,6 +23,7 @@ class Shopimporter_Presta extends ShopimporterBase // TODO private $langidToIso = [3 => 'de', 1 => 'en']; private $taxationByDestinationCountry; + private $orderSearchLimit; public function __construct($app, $intern = false)