0

Call to a member function isLoaded() on array in /var/www/html/codility-magento-market-place/vendor/magento/module-backend/Block/Widget/Grid/Extended.php:473 Stack trace

$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->_logger->info(print_r($bestSale->getData(),true));  $this->setCollection($filter_product);
        return parent::_prepareCollection();

actually i filter best seller products on dashboard . each admin can see own best seller product .

My if condition and other code work correct because i debug filtered array it correct filter But when i setCollection as filter array then it give onLoad() error

kindly help me here

  • What is $_collectionFactory – Dominic Xigen May 17 at 12:09
  • \Magento\Sales\Model\ResourceModel\Report\Bestsellers\CollectionFactory $collectionFactory – HaFiz Umer May 20 at 6:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.