Here is the screenshot of error.... enter image description here

And here is my Block class...

 * Categories slider get categories class file

namespace MGS\Fewclicks_startsite_category\Block;

use Magento\Catalog\Api\CategoryRepositoryInterface;
use MGS\Fewclicks_cron_activation_reminder\Controller\Index;

class CategoriesCollection extends \Magento\Framework\View\Element\Template {

protected $_categoryHelper;
protected $categoryFlatConfig;
protected $categoryFactory;
protected $categoryRepository;
protected $sendMail;

public function __construct(
\Magento\Framework\View\Element\Template\Context $context, \Magento\Catalog\Helper\Category $categoryHelper = null, \Magento\Catalog\Model\CategoryFactory $categoryFactory = null, \Magento\Catalog\Model\Indexer\Category\Flat\State $categoryFlatState = null , CategoryRepositoryInterface $categoryRepository = null , \MGS\Fewclicks_cron_activation_reminder\Controller\Index\Sendmail $sendMail = null 
) {
    $this->_categoryHelper = $categoryHelper;
    $this->categoryFactory = $categoryFactory;
    $this->categoryFlatConfig = $categoryFlatState;
    $this->categoryRepository = $categoryRepository;
    $this->sendMail = $sendMail;

public function getCategoryHelper() {
    return $this->_categoryHelper;

public function getStoreCategories($sorted = false, $asCollection = false, $toLoad = true) {
    $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); // Instance of object manager
    $resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
    $connection = $resource->getConnection();
    $sql = "SELECT ccev.entity_id as id,ccev.value as name,
            ccev2.value as img
            FROM catalog_category_entity as main_table
            LEFT JOIN catalog_category_entity_varchar as ccev
            ON ccev.entity_id=main_table.entity_id AND ccev.attribute_id =45

            LEFT JOIN catalog_category_entity_varchar as ccev2
            ON ccev2.entity_id=main_table.entity_id AND ccev2.attribute_id =48

            INNER JOIN catalog_category_entity_int as ccei
            ON ccei.entity_id=main_table.entity_id AND ccei.attribute_id =46  AND ccei.value = 1

            GROUP BY ccev.entity_id
            ORDER BY main_table.level asc,main_table.parent_id asc,ccev.value asc";

    $results = $connection->fetchAll($sql);
    return $results;

public function getChildCategories($category) {
    if ($this->categoryFlatConfig->isFlatEnabled() && $category->getUseFlatResource()) {
        $subcategories = (array) $category->getChildrenNodes();
    } else {
        $subcategories = $category->getChildren();
    return $subcategories;

public function getImageUrl($categoryId) {
    $category = $this->categoryFactory->create()->load($categoryId);
    return $category->getImageUrl();

public function getCategoryURL($categoryId) {
    $category = $this->categoryRepository->get($categoryId, $this->_storeManager->getStore()->getId());
    return $category->getUrl();

And here is my di.xml...

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MGS\Fewclicks_startsite_category\Block\CategoriesCollection">
            <argument name="deleteorderAction" xsi:type="array">
                <item name="context" xsi:type="string">\Magento\Framework\View\Element\Template\Context</item>
                <item name="helper" xsi:type="string">\Magento\Catalog\Helper\Category</item>
                <item name="flatstate" xsi:type="string">\Magento\Catalog\Model\Indexer\Category\Flat\State</item>
                <item name="menu" xsi:type="string">\Magento\Theme\Block\Html\Topmenu</item>

  <!-- <preference for="Magento\CatalogSearch\Model\Autocomplete\DataProvider" type="Fewclicks\SmartSearch\Model\Autocomplete\SearchDataProvider" /> -->

can anyone suggest where in constructor my sequence of parameter goes wrong...as i have seen that above error is due to required and optional parameter sequence issue...as per the Magento 2 - Object manager tries to instantiate Abstract class. ( Fatal error )

Please suggest me regarding this.Thanks in advance....

  • please post the complete class definition and di.xml if you are using it to overwrite any class. – Pankaj Bhope Mar 17 '17 at 6:07
  • I have updated di.xml and complete block class code in the question... – Bhavesh Tilvani Mar 17 '17 at 6:24

The following command will helps you. Please Run Upgrade Command:

php bin/magento setup:upgrade

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.