6

If I go to "Sales" under Magento 2, I have several menu options. And every single one of those options has an error relating to that section:

Orders: Not registered handle sales_order_grid_data_source Invoices: Not registered handle sales_order_invoice_grid_data_source Shipments: Not registered handle sales_order_shipment_grid_data_source Credit Memos: Not registered handle sales_order_creditmemo_grid_data_source

And so on. I was on Magento 2.0.x earlier and the issue wasn't there. I don't know when the issue appeared because this store is in development and not active. But I've since updated to 2.1.0 then 2.1.3 this week, and not sure when the problem occurred. Anything helpful would be great.

21

The problem here is that someone defined a handle in the etc/adminhtml/di.xml

search for something like this

<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">
    <arguments>
        <argument name="collections" xsi:type="array">
            <item name="NameOfHandle" xsi:type="string">Vendor\Module\Model\ResourceModel\Something\Collection</item>
        </argument>
    </arguments>
</type>
<virtualType name="Vendor\Module\Model\ResourceModel\Something\Collection" type="Magento\Framework\View\Element\UiComponent\DataProvider\SearchResult">
    <arguments>
        <argument name="mainTable" xsi:type="string">NameOfTable</argument>
        <argument name="resourceModel" xsi:type="string">Vendor\Module\Model\ResourceModel\Something</argument>
    </arguments>
</virtualType>

Do not search for the handle that he can not find. Just go over etc/adminhtml/di.xml in your modules and search for

<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">

Move that bit of code to etc/di.xml instead of etc/adminhtml/di.xml

|improve this answer|||||
  • 2
    This should be the accepted answer. – ol'bob dole May 3 '18 at 22:20
  • if I move the <type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory"> to etc/di.xml file it's not working, but the "Not registered handle" error gone – senthil Jun 21 '18 at 14:06
  • What is your di.xml noNamespaceSchemaLocation ? be sure it is set to urn:magento:framework:ObjectManager/etc/config.xsd – CompactCode Jun 22 '18 at 2:49
  • the Actual problem is with di.xml After checking that this problem will solved.. :) – Ask Bytes Oct 7 '18 at 10:55
  • @CompactCode i faced same issue but code also available in etc/di.xml not in etc/adminhtml/di.xml still same issue exists. – Hitesh Balpande Dec 30 '19 at 8:20
14

Okay so I found the problem. I found another stackexchange topic that didn't seem to be 100% related because it was a different module, however the exact same scenario was occurring. You can find the discussion here: https://stackoverflow.com/questions/39763550/magento-2-1-1-admin-content-pages-not-loading-handle-not-registered

The main thing was that I didn't create any custom modules, but I did install a few modules from third parties. I guess I just assumed these would have been updated, but they were manually installed not with composer, there were minor issues with the setup of the modules file structure. Being new to Magento I looked at the topic above and was just looking at the Magento file structure, but then it clicked I needed to look at the file structure of the modules.

Once, I investigated each of the modules I had installed, I looked in the etc/adminhtml directory for each and I found a few of them had a di.xml file in that directory, and also an etc/di.xml. So I opened both files, compared them, and combined them. I only added what was missing from the adminhtml path into the etc/di.xml path. Then I renamed the etc/adminhtml/di.xml to bak.di.xml just to back it up. I cleared and flushed the cache, and everything is working again.

It appears to me that this is a change from 2.0.x to 2.1.x. Most modules will be fine working from 2.0.x to 2.1.x but that file structure is what caused my issues.

|improve this answer|||||
  • Thank you Jason, I did as you mentioned here, though I did not copy all the code of di.xml of adminhtml folder to etc/di.xml but I commented all the code of di.xml of adminhtml folder & all the things are working fine now :) So yes you are right that there is something with di.xml in adminhtml folder. – KA9 Aug 30 '17 at 9:49
  • I made an answer what is causing this after i got this issue myself, Thanks for the lead to the solution – CompactCode Apr 2 '18 at 17:55
  • So, we cannot create di.xml under adminhtml? – AshwinP Jul 26 '18 at 10:38
9

The self-provided answer from @jason-diehl doesn't really explain this issue, and I believe includes some incorrect information.

I ran into this issue when developing a custom module and testing the admin grid. I could see the container with the "Add ____" button, but a single message: Not registered handle ________. After looking into things I realized that I had specified a <dataSource> name in my view/adminhtml/ui_component/my_module_controller_listing.xml file which was not included in my etc/di.xml file as a named <item> in the list of collections for the Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory type.

Once I adjusted the name of the data source in my listing to match the name of the collection in etc/di.xml, the error was gone.

So to summarize: When you specify a data source to use in your adminhtml grid listing UI component(s), you must make sure the name attribute of your data source is specified as the name of a collection under the <type> tag of Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory.

|improve this answer|||||
  • Truly helped me. It really explained the issue and should be better rated imho :) – Christophe Ferreboeuf Jul 1 '19 at 8:19
2

"Move that bit of code to etc/di.xml instead of etc/adminhtml/di.xml"

Everyone is suggesting for moving code from etc/adminhtml/di.xml to etc/di.xml. Don't understand. why to move ? When gone inside this then found that etc/adminhtml/di.xml has greater priority over etc/di.xml i.e. if any of the single module inside app/code/, if defined di.xml datasource inside etc/adminhtml/di.xml, then it will not look for etc/di.xml for same type in other modules, and modules stopped and show error Not registered handle.

so, if you are going to define type in code section be sure that it is in a right place, and as I can see people have made etc/di.xml as Right place to define type for Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory.

for example -

etc/di.xml

<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">

etc/adminhtml/di.xml

<type name="Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory">

When same type is defined in above two files, then priority will be given to etc/adminhtml/di.xml

I define it inside, etc/adminhtml/di.xml, have a look :)

https://github.com/gitamitgit/sample-admin-module

|improve this answer|||||
0

Moving the di.xml to /etc does not help in my case, i also added the following lines into my di.xml (i'm rewriting the sales_order_grid_data_source)

<item name="sales_order_invoice_grid_data_source" xsi:type="string">Magento\Sales\Model\ResourceModel\Order\Invoice\Grid\Collection</item>
<item name="sales_order_shipment_grid_data_source" xsi:type="string">Magento\Sales\Model\ResourceModel\Order\Shipment\Grid\Collection</item>
<item name="sales_order_creditmemo_grid_data_source" xsi:type="string">Magento\Sales\Model\ResourceModel\Order\Creditmemo\Grid\Collection</item>
<item name="sales_order_view_invoice_grid_data_source" xsi:type="string">Magento\Sales\Model\ResourceModel\Order\Invoice\Orders\Grid\Collection</item>
<item name="sales_order_view_shipment_grid_data_source" xsi:type="string">Magento\Sales\Model\ResourceModel\Order\Shipment\Order\Grid\Collection</item>
<item name="sales_order_view_creditmemo_grid_data_source" xsi:type="string">Magento\Sales\Model\ResourceModel\Order\Creditmemo\Order\Grid\Collection</item>
|improve this answer|||||

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.