I want to get collection in specific order (apart from ASC or DESC order).
Here is my collection:
$productCollection = $block->getProductCollection() ->create() ->addAttributeToSelect('entity_id') ->addFieldToFilter('entity_id',array('in' => array_keys($products_in_orders))) ->addCategoriesFilter(['in' => $category_ids]) ->load();
And I want to get collection in exactly
array_keys($products_in_orders) this order which is an array of entity_id (e.g. 18,15,16,20)
Here is the reference