cancel
Showing results for 
Search instead for 
Did you mean: 

Custom link not displaying in admin

SOLVED

Custom link not displaying in admin

Hello,

 

I'm new to Magento and in the process of setting up a shop. I have a clean install of CE 2.2.2 and everything seems to be working. I created a simple module to add a link in the Catalog menu in the admin.

 

File structure:

composer.json
registration.php
\ etc
  acl.xml
  module.xml
 \ adminhtml
    menu.xml
    routes.xml

menu.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
        <add id="MyVendor_Catalog::catalog_manufacturers" title="Manufacturers" translate="title" module="MyVendor_Catalog" sortOrder="50" parent="Magento_Catalog::inventory" action="catalog/manufacturer/" resource="MyVendor_Catalog::manufacturers"/>
    </menu>
</config>

routes.xml

<?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="catalog" frontName="catalog">
            <module name="MyVendor_Catalog" before="Magento_Backend" />
        </route>
    </router>
</config>

acl.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
    <acl>
        <resources>
            <resource id="Magento_Backend::admin">
                <resource id="Magento_Catalog::catalog">
                    <resource id="Magento_Catalog::catalog_inventory">
                        <resource id="MyVendor_Catalog::manufacturers" title="Manufacturers" sortOrder="30" />
                    </resource>
                </resource>
            </resource>
        </resources>
    </acl>
</config>

I can enable the module without any problems but the link is not shown. I ran setup:upgrade and cache:clean.

 

The tried installing a 3rd party module as a test and this module presented the same exact problem. Everything installs fine but admin fields added within the module are not displayed in the backend.


I'm pretty sure it isn't a problem with the code but what else could it be? Magento is running in developer mode.

 

Thanks for any help,

Daniel

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Custom link not displaying in admin

Hello and thanks for the reply,

 

Magento_Catalog::inventory is a valid parent category.

 

After a lot of searching and testing back and forth I found my problem. I used the standard installation from the Magento DevDocs for a Nginx server using nginx.conf.sample. Using this configuration does not seem to work at all to make changes to modules. I tried disabling Magento modules and they would just keep running. New modules obviously weren't working either.

 

Long story short, I switched the document root of the Magento server from pub/ to the Magento root folder and everything is working now. I suppose I should have realized this from the start or installed Magento using the developer guide but none of the guides make this clear. I'm not even sure this is the intended functionality.

View solution in original post

2 REPLIES 2

Re: Custom link not displaying in admin

Hi @ddpfl,

 

Into the menu.xml you put:

 

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
        <add id="MyVendor_Catalog::catalog_manufacturers" title="Manufacturers" translate="title" module="MyVendor_Catalog" sortOrder="50" parent="Magento_Catalog::inventory" action="catalog/manufacturer/" resource="MyVendor_Catalog::manufacturers"/>
    </menu>
</config>

Are you sure that Magento_Catalog::inventory is a valid parent reference?

Re: Custom link not displaying in admin

Hello and thanks for the reply,

 

Magento_Catalog::inventory is a valid parent category.

 

After a lot of searching and testing back and forth I found my problem. I used the standard installation from the Magento DevDocs for a Nginx server using nginx.conf.sample. Using this configuration does not seem to work at all to make changes to modules. I tried disabling Magento modules and they would just keep running. New modules obviously weren't working either.

 

Long story short, I switched the document root of the Magento server from pub/ to the Magento root folder and everything is working now. I suppose I should have realized this from the start or installed Magento using the developer guide but none of the guides make this clear. I'm not even sure this is the intended functionality.