I have this category structure below:
When I access Men page all products of child categories are there, but they are showing in a random mode, i believe. I want to show the products in the main category (Men) sorted by child categories order.
Product Collection function:
public function getProductCollection()
{
$current_category = $this->_registry->registry('current_category');//get current category
$collection = $this->_productCollectionFactory->create();
$collection->addAttributeToFilter('visibility', \Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH);
$collection->addAttributeToFilter('status',\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED);
$collection->addCategoryFilter($current_category);
$collection->setPageSize(999);
$collection->addAttributeToSelect('*');
return $collection;
}