From e8007d2fd65441a96c109ecfa12186279bd734c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger-Thomas=20Ka=C3=9Fner?= Date: Wed, 7 Feb 2018 11:41:15 +0100 Subject: [PATCH 1/2] PT-8226 - Fix category export and import with complex trees --- .../SwagImportExport/DbAdapters/CategoriesDbAdapter.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Components/SwagImportExport/DbAdapters/CategoriesDbAdapter.php b/Components/SwagImportExport/DbAdapters/CategoriesDbAdapter.php index 4b422be7..1f3858af 100644 --- a/Components/SwagImportExport/DbAdapters/CategoriesDbAdapter.php +++ b/Components/SwagImportExport/DbAdapters/CategoriesDbAdapter.php @@ -143,7 +143,14 @@ public function read($ids, $columns) $categories = $builder->getQuery()->getArrayResult(); - $result['default'] = DbAdapterHelper::decodeHtmlEntities($categories); + $result = []; + foreach ($categories as $category) { + $key = (int) $category['categoryId'] . $category['parentId']; + $result[$key] = $category; + } + ksort($result); + + $result['default'] = DbAdapterHelper::decodeHtmlEntities(array_values($result)); $result['customerGroups'] = $this->getBuilder($this->getCustomerGroupsColumns(), $ids)->getQuery()->getResult(); return $result; From 7340ba3e8d369143d364c8ec5dfcb4ebfcf1c7b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger-Thomas=20Ka=C3=9Fner?= Date: Wed, 7 Feb 2018 11:56:12 +0100 Subject: [PATCH 2/2] NTR - Add further fields to order dataset --- Components/SwagImportExport/DbAdapters/OrdersDbAdapter.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Components/SwagImportExport/DbAdapters/OrdersDbAdapter.php b/Components/SwagImportExport/DbAdapters/OrdersDbAdapter.php index 6dde427b..2ddff9e3 100644 --- a/Components/SwagImportExport/DbAdapters/OrdersDbAdapter.php +++ b/Components/SwagImportExport/DbAdapters/OrdersDbAdapter.php @@ -425,6 +425,9 @@ public function getDefaultColumns() 'details.esdArticle as esd', 'details.config as config', 'details.mode as mode', + 'details.ean as ean', + 'details.packUnit as packUnit', + 'details.unit as unit', ]; $billingColumns = [ @@ -523,7 +526,7 @@ private function getBuilder($columns, $ids) $builder = $this->modelManager->createQueryBuilder(); $builder->select($columns) - ->from('Shopware\Models\Order\Detail', 'details') + ->from(Detail::class , 'details') ->leftJoin('details.order', 'orders') ->leftJoin('details.tax', 'taxes') ->leftJoin('orders.billing', 'billing')