|
7 | 7 |
|
8 | 8 | namespace Magento\Catalog\Ui\DataProvider\Product\Form\Modifier; |
9 | 9 |
|
| 10 | +use Magento\Backend\Model\Auth\Session; |
| 11 | +use Magento\Catalog\Api\Data\CategoryInterface; |
| 12 | +use Magento\Catalog\Model\Category as CategoryModel; |
10 | 13 | use Magento\Catalog\Model\Locator\LocatorInterface; |
11 | 14 | use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory; |
12 | | -use Magento\Framework\App\ObjectManager; |
13 | 15 | use Magento\Framework\App\CacheInterface; |
| 16 | +use Magento\Framework\App\ObjectManager; |
| 17 | +use Magento\Framework\AuthorizationInterface; |
| 18 | +use Magento\Framework\Data\Collection; |
14 | 19 | use Magento\Framework\DB\Helper as DbHelper; |
15 | | -use Magento\Catalog\Model\Category as CategoryModel; |
16 | 20 | use Magento\Framework\Exception\LocalizedException; |
17 | 21 | use Magento\Framework\Serialize\SerializerInterface; |
18 | | -use Magento\Framework\UrlInterface; |
19 | 22 | use Magento\Framework\Stdlib\ArrayManager; |
20 | | -use Magento\Framework\AuthorizationInterface; |
21 | | -use Magento\Backend\Model\Auth\Session; |
| 23 | +use Magento\Framework\UrlInterface; |
22 | 24 |
|
23 | 25 | /** |
24 | 26 | * Data provider for categories field of product page |
@@ -51,6 +53,7 @@ class Categories extends AbstractModifier |
51 | 53 | /** |
52 | 54 | * @var array |
53 | 55 | * @deprecated 101.0.0 |
| 56 | + * @see Nothing |
54 | 57 | * @since 101.0.0 |
55 | 58 | */ |
56 | 59 | protected $categoriesTrees = []; |
@@ -128,6 +131,7 @@ public function __construct( |
128 | 131 | * |
129 | 132 | * @return CacheInterface |
130 | 133 | * @deprecated 101.0.3 |
| 134 | + * @see getCategoriesTree |
131 | 135 | */ |
132 | 136 | private function getCacheManager(): CacheInterface |
133 | 137 | { |
@@ -442,6 +446,8 @@ private function retrieveCategoriesTree(int $storeId, array $shownCategoriesIds) |
442 | 446 |
|
443 | 447 | $collection->addAttributeToFilter('entity_id', ['in' => array_keys($shownCategoriesIds)]) |
444 | 448 | ->addAttributeToSelect(['name', 'is_active', 'parent_id']) |
| 449 | + ->addAttributeToSort(CategoryInterface::KEY_LEVEL, Collection::SORT_ORDER_ASC) |
| 450 | + ->addAttributeToSort(CategoryInterface::KEY_POSITION, Collection::SORT_ORDER_ASC) |
445 | 451 | ->setStoreId($storeId); |
446 | 452 |
|
447 | 453 | $categoryById = [ |
|
0 commit comments