[Fix It Series] Magento 2 Error: Custom Links in Admin Menu CE 2.1.8

magento 2 error Custom Links in Admin menu CE 2.1.8

PROBLEM:

The developer creates a new module. Although the module is successfully installed and enabled when clicking on the link on the admin menu it goes to the Dashboard.

Here is the structure of the files in app/code/dfprojects:

fix magento 2 errors custom links

In System --> User Roles the entries for the menu are activated:

how to fix magento 2 error with custom link

In the admin menu:

magento 2 fix error

The link from “Eigenanlieferung” is DOMAIN/ADMIN_PSEUDO/dfpea/eigenan/index/key/….

When clicking on “Eigenanlieferung”, the Dashboard will appear.

Here is the app/code/dfprojects/module-dfpea/etc/adminhtml/routes.xml:

magento 2.1.8 error

and the app/code/dfprojects/module-dfpea/Controller/Adminhtml/Eigenan/Index.php

magento 2 custom link error

 

 

CAUSES:

There are 2 causes that lead to the problem:

– The code of the route file is not correct

– It lacks the menu.xml file in the etc/adminhtml
 

SOLUTIONS:

There are 3 simple steps to handle this Magento 2 error:

  • Step 1: Editing the app/code/dfprojects/module-dfpea/etc/adminhtml/routes.xml file like the following:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="admin">
        <route id="dfpea" frontName="dfpea">
            <module name="DfProjects_DfpEa" before="Magento_Backend" />
        </route>
    </router>
</config>
  • Step 2: Creating the file app/code/dfprojects/module-dfpea/etc/adminhtml/menu.xml as the following:
<?xml version="1.0"?>
 <!--@copyright Copyright (c) 2016 www.tigren.com-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
        <add id="DfProjects_DfpEa:: eigenan" title="Eigenanlieferung" module=" DfProjects_DfpEa " sortOrder="20" resource="DfProjects_DfpEa:: eigenan" />
            </menu>
</config>
  • Step 3: Running the following command:
    Php bin/magento cache:flush 

    Then reloading the page.

We have shown you 3 steps to fix the error related to the custom link in the admin menu of Magento CE 2.1.8. If you have any problems when following the instructions, please leave a comment below. See you in the next Magento 2 tutorials.

See More:

[Fix It Series] Magento Error: Missing all sale tables but sale orders are recorded

[Fix It Series] Magento 2 Error: getLastRealOrderId Doesn’t Work After Checkout With Enabled Page Cache

[Fix It Series] Magento Error: Invalid Form Key. Please refresh the page

[Fix It Series] Total Price In Wishlist Page Is $0.00 In Magento 2

[Fix It Series] Magento Error: Custom Option Type Fields Are Not Displayed

[Fix It Series] Magento Error: Front Controller Reached 100 router Match Iterations

[ratings]

Leave a Reply

Your email address will not be published. Required fields are marked *