I have 2 collection 1 is $bestsalecollection that show in dashboard . second is product collection. After filter collection when i return it generate error Call to a member function isLoaded() on array
Please any one help me to tell how filter array convert into magento collection ?
Thank you
$bestsalecollection = $this->_collectionFactory->create()->setModel(
\Magento\Catalog\Model\Product::class
)->addStoreFilter(
$storeId
);
$productCollection = $this->productcollectionFactory->create();
$sellercollection=$productCollection->addFieldToFilter('current_user_id',array('eq'=>1));
$filter_product=[];
foreach ($sellercollection as $allProduct){
foreach ($bestsalecollection as $bestSale){
if($allProduct->getEntityId()==$bestSale->getProductId()){
$filter_product[]=$bestSale;
}
}
}
$this->setCollection($filter_product);
return parent::_prepareCollection();