1

I have a menu.xml like this:

<?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="Xtento_TrackingImport::menu" action="Xtento_TrackingImport/index/index" title="Some title" module="Xtento_TrackingImport" sortOrder="101" parent="Magento_Sales::sales" resource="Third_Party::menu"/>
    </menu>
</config>

I want to remove the 'action' in it. I've try some thing like this in my override menu.xml file :

<update id="Xtento_TrackingImport::menu"/>

And

<update id="Xtento_TrackingImport::menu" action=""/>

And also

<update id="Xtento_TrackingImport::menu" action="#"/>

But none of them work.



Please help, thanks.

  • would it be because you are trying it with the update element? – magefms Apr 3 at 3:29
  • thanks, but if i don't update, then how to make this work? – fudu Apr 3 at 3:30
  • what is your main goal on this? are you trying to override your third-party menu.xml and remove the action only for that specific menu or are you trying to implement your own menu without an action? – magefms Apr 3 at 3:34
  • i'm just trying to remove the action from a item from menu.xml, i don't wanna add a new item at all. Thanks. – fudu Apr 3 at 3:34
  • then try like <add id="Xtento_TrackingImport::menu" action=""/> – magefms Apr 3 at 3:36
2

Instead of using update tag in menu.xml, what you can do is create a plugin of menu file in your custom module.

So in your custom module, make following changes.

[Vendor]/[Module]/etc/di.xml

<type name="Magento\Backend\Model\Menu\Config">
    <plugin name="custom_override_meu_action" type="[Vendor]\[Module]\Plugin\Config" />
</type>

[Vendor][Module]\Plugin\Config.php

<?php

namespace [Vendor]\[Module]\Plugin;

class Config
{
    public function afterGetMenu($subject, $result)
    {
        $result->get('Xtento_TrackingImport::menu')->setAction(null);
        return $result;
    }
}

This should work.

  • worked. thanks mate. – fudu Apr 3 at 6:29
0
<?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>
       <update id="Xtento_TrackingImport::menu" action="#"/>
    </menu>
</config>

Should work.

But you have to check that your menumenu.xml code should run after <add id="Xtento_TrackingImport::menu"...

You have to create a new module. this should depend on Xtento_TrackingImport

using <depends><Xtento_TrackingImport/></depends>

and the new module's menu you have to rewrite the update menu code.

  • Wait, so its still have action? i want to make it without action, the reason i do that because the menu will become like this i.stack.imgur.com/F2BpO.jpg you see the "tracking import" down there? i want it to become look like "Sales Export" the only way to do that is remove the action. Right now it have action, so it become that <a href="trackingimport/index/index"> – fudu Apr 3 at 6:24

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.