From 5b33e09021feb00acf2f9487a908c8ab511bb0ae Mon Sep 17 00:00:00 2001 From: Andreas Palm Date: Fri, 8 Mar 2024 22:45:18 +0100 Subject: [PATCH 1/3] Add Support for BogxProductConfigurator (Shopware6) --- www/pages/shopimporter_shopware6.php | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/www/pages/shopimporter_shopware6.php b/www/pages/shopimporter_shopware6.php index 87f8ed0c..c42ad46d 100644 --- a/www/pages/shopimporter_shopware6.php +++ b/www/pages/shopimporter_shopware6.php @@ -3349,6 +3349,7 @@ class Shopimporter_Shopware6 extends ShopimporterBase $productPriceType => $lineItem['attributes']['price']['unitPrice'], 'steuersatz' => $lineItem['attributes']['price']['calculatedTaxes'][0]['taxRate'], ]; + $this->parseBogxData($lineItem, $product); $cart['articlelist'][] = $product; } @@ -3817,4 +3818,42 @@ class Shopimporter_Shopware6 extends ShopimporterBase $this->updateArticleCacheToSync($articleIds); } + + protected function parseBogxData(array $lineItem, array &$product) : void + { + if (!isset($lineItem['attributes']['payload']['bogxProductConfigurator'])) + return; + + $bogxdata = $lineItem['attributes']['payload']['bogxProductConfigurator']; + file_put_contents("/var/www/bogx", print_r($bogxdata, true)); + $textlines = []; + + if (isset($bogxdata['ordercode'])) + $textlines[] = "Order-Code: ${bogxdata['ordercode']}"; + else + $textlines[] = "Produkt-Nr: ${bogxdata['articleordernumber']}"; + + foreach ($bogxdata['optionsGroups'] as $bogxposition) { + $dt = $bogxposition['datatype']; + if (is_array($bogxposition['valueID']) && is_array($bogxposition['title'])) + { + foreach ($bogxposition['valueID'] as $valueID) { + $bogxTitle = $bogxposition['title'][$valueID]; + if ($dt == 'checkbox_quantity') + $bogxTitle = $bogxposition['label'][$valueID]." ".$bogxTitle; + $textlines[] = sprintf("%s: %s", $bogxposition['groupname'], $bogxTitle); + } + } + else + { + if (is_array($bogxposition['title'])) + $bogxTitle = join(' ', $bogxposition['title']); + else + $bogxTitle = $bogxposition['title']; + $textlines[] = sprintf("%s: %s", $bogxposition['groupname'], $bogxTitle); + } + } + + $product['options'] .= join("\n", $textlines); + } } From 36c751d317ae804f3bf81a5384aea6eb8860381a Mon Sep 17 00:00:00 2001 From: Andreas Palm Date: Fri, 15 Mar 2024 21:41:05 +0100 Subject: [PATCH 2/3] Improvements for BogxProductConfigurator (Shopware6) --- www/pages/shopimporter_shopware6.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/www/pages/shopimporter_shopware6.php b/www/pages/shopimporter_shopware6.php index c42ad46d..b84eccf8 100644 --- a/www/pages/shopimporter_shopware6.php +++ b/www/pages/shopimporter_shopware6.php @@ -3825,16 +3825,16 @@ class Shopimporter_Shopware6 extends ShopimporterBase return; $bogxdata = $lineItem['attributes']['payload']['bogxProductConfigurator']; - file_put_contents("/var/www/bogx", print_r($bogxdata, true)); + file_put_contents("/var/www/bogx", print_r($lineItem['attributes'], true)); $textlines = []; if (isset($bogxdata['ordercode'])) $textlines[] = "Order-Code: ${bogxdata['ordercode']}"; - else - $textlines[] = "Produkt-Nr: ${bogxdata['articleordernumber']}"; foreach ($bogxdata['optionsGroups'] as $bogxposition) { $dt = $bogxposition['datatype']; + if ($dt == 'quantity_total') + continue; if (is_array($bogxposition['valueID']) && is_array($bogxposition['title'])) { foreach ($bogxposition['valueID'] as $valueID) { @@ -3854,6 +3854,13 @@ class Shopimporter_Shopware6 extends ShopimporterBase } } + if (!empty($bogxdata['shippingtime'])) { + $textlines[] = $bogxdata['shippingtime']; + } + $product['options'] .= join("\n", $textlines); + $product['price'] = $bogxdata['unitySurcharge']; + $product['price_netto'] = $bogxdata['unitySurchargeNetto']; + $product['quantity'] = $bogxdata['totalQuantity']; } } From 17c694a23c597a4dd993efd1d99fd71aa6bc2d50 Mon Sep 17 00:00:00 2001 From: Andreas Palm Date: Fri, 29 Mar 2024 21:29:58 +0100 Subject: [PATCH 3/3] Remove Bogx debug output --- www/pages/shopimporter_shopware6.php | 1 - 1 file changed, 1 deletion(-) diff --git a/www/pages/shopimporter_shopware6.php b/www/pages/shopimporter_shopware6.php index b84eccf8..868a456b 100644 --- a/www/pages/shopimporter_shopware6.php +++ b/www/pages/shopimporter_shopware6.php @@ -3825,7 +3825,6 @@ class Shopimporter_Shopware6 extends ShopimporterBase return; $bogxdata = $lineItem['attributes']['payload']['bogxProductConfigurator']; - file_put_contents("/var/www/bogx", print_r($lineItem['attributes'], true)); $textlines = []; if (isset($bogxdata['ordercode']))