Skip to content

Commit

Permalink
Merge pull request #319 in PLUG_OPEN/backend_swagimportexport from pt…
Browse files Browse the repository at this point in the history
…-8226/fix-category-import to master

* commit '7340ba3e8d369143d364c8ec5dfcb4ebfcf1c7b0':
  NTR - Add further fields to order dataset
  PT-8226 - Fix category export and import with complex trees
  • Loading branch information
mitelg committed Feb 7, 2018
2 parents 08cee20 + 7340ba3 commit 2065084
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion Components/SwagImportExport/DbAdapters/OrdersDbAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 2065084

Please sign in to comment.