Magento 2 product collection category filter category position sort
-
15-04-2021 - |
Question
Hi i am trying to get product collection with category filter and category position sorting but it not working i tried below way
$collection = $this->_productCollectionFactory->create();
$collection->addAttributeToSelect('*');
$collection->addCategoriesFilter(array('eq' => $category->getId()));//
$collection->addAttributeToSort('position');
//->setOrder('cat_index_position','ASC')
please any one tell me how to sort category positon
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange