I am creating a product loop on the homepage of our site. The site has smile elastic search running. I have set up the manual sort for products in the category admin and can loop thru the products, but I am not able to sort by position.
<?php foreach ($category as $categoryId): ?>
<?php
$category = $categoryFactory->create()->load($categoryId);
$categoryProducts = $category->getProductCollection()
->addAttributeToSort('position','ASC')
->addAttributeToSelect('*');
?>
<?php foreach ($categoryProducts as $product): ?>
// do something with the products
<?php endforeach ?>