4

I have created a menu in admin page and its showing properly and its having a link http://localhost/magento2/admin/asw_advanced/sales/index/key/17910c3f00de5194db7f0a418e9f9d38a487af1c29bdfb16fc1dd406eac24101/

when i clicked on this its redirecting to admin dashboard itself. The error showin on the magento system log is..

[2016-04-04 06:57:59] main.CRITICAL: Broken reference: the 'header' tries to reorder itself towards 'global.notices', but their parents are different: 'page.wrapper' and 'notices.wrapper' respectively. [] []
[2016-04-04 06:57:59] main.CRITICAL: Broken reference: the 'page.breadcrumbs' tries to reorder itself towards 'notifications', but their parents are different: 'page.wrapper' and 'notices.wrapper' respectively. [] []
[2016-04-04 06:57:59] main.CRITICAL: Broken reference: the 'global.search' tries to reorder itself towards 'notification.messages', but their parents are different: 'header.inner.right' and 'header' respectively. [] []

when i disable the security key to url in store > advanced > admin the page works fine. How to make it work with security key enabled.?

Asw/Sample/etc/adminhtml/menu.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Magento/Backend/etc/menu.xsd">
    <menu>
        <add id="Asw_Sample::advanced" title="Advanced Reports" module="Asw_Sample" sortOrder="30" resource="Asw_Sample::advanced"/>
        <add id="Asw_Sample::advanced_sales" title="Sales order" module="Asw_Sample" parent="Asw_Sample::advanced" sortOrder="1" action="asw_advanved/sales" resource="Asw_Sample::advanced_sales"/>
    </menu>
</config>

Asw/Sample/etc/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="Asw_Sample::admin">
                <resource id="Asw_Sample::advanced" title="Advanced Reports" sortOrder="10" >
                    <resource id="Asw_Sample::advanced_sales" title="Sales Order" sortOrder="40"/>
                </resource>
            </resource>
        </resources>
    </acl>
</config>

Asw/Sample/etc/adminhtml/routes.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd">
    <router id="admin">
        <route id="Asw_Sample_advanced" frontName="asw_advanved">
            <module name="Asw_Sample" before="Magento_Backend"/>
        </route>
    </router>
</config>

Asw/Sample/Controller/Sales/Index.php

<?php
namespace Asw\Sample\Controller\Adminhtml\Sales;

use Magento\Backend\App\Action\Context;
use Magento\Framework\View\Result\PageFactory;

class Index extends \Magento\Backend\App\Action
{ 
    /**
     * @var PageFactory
     */
    protected $resultPageFactory;

    /**
     * @param Context $context
     * @param PageFactory $resultPageFactory
     */
    public function __construct(
        Context $context,
        PageFactory $resultPageFactory
    ) {
        parent::__construct($context);
        $this->resultPageFactory = $resultPageFactory;
    }


    /**
     * say admin text
     */
    public function execute()
    {
        print("ssss");
    }
}
7

I had the same problem. For me the solution was to have the route id and frontName have the same value. In your case this would be:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/internal/Magento/Framework/App/etc/routes.xsd">
    <router id="admin">
        <route id="asw_advanved" frontName="asw_advanved">
            <module name="Asw_Sample" before="Magento_Backend"/>
        </route>
    </router>
</config>
  • 2
    +1 This fixed my issue. I can't believe that this bug exists, as its technically should be allowed to be different. – Nathan Merrill Feb 7 '17 at 18:53
0

Every things seems fine, I have the same problem. If you are using ubuntu then give read and execute permission to the file.

  • i have given full permission to all files, still the same issue – Aswanth Apr 4 '16 at 11:20

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.