0

In Magento 2, I try to add a new tab in My account page next to My Account, My Orders, My Wishlist, ...

I follow exactly this tutorial : https://www.mageplaza.com/devdocs/add-custom-tab-customer-account-magento-2.html

My new tab is created, but the route is not working, I have a 404 error when I click on this new tab.

Do you have any idea how to solve this problem ?

Thanks

4
  • did you created routes.xml ?
    – Pawan
    Apr 15 '20 at 14:56
  • @Pawan No I did not create because it is not specified in the tutorial. Is it necessary?
    – Fbr
    Apr 15 '20 at 14:59
  • Yes, you need to create it.
    – Pawan
    Apr 15 '20 at 15:01
  • After adding routes.xml, is it working ?
    – Pawan
    Apr 15 '20 at 16:05
1

Please Create:

app/code/[Vendor]/[Module]/etc/frontend/routes.xml

with following content

<?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="standard">
        <route id="{routid}" frontName="{routid}">
            <module name="[Vendor]_[Module]" />
        </route>
    </router>
</config>

Please replace {routid},[Vendor] and [Module] name.

4
  • Thanks it works !
    – Fbr
    Apr 16 '20 at 15:47
  • Glad to know...welcome ...:)
    – Pawan
    Apr 16 '20 at 17:32
  • @Pawan What is {routid} in this will you please help me !
    – Prits
    Jun 9 '20 at 12:20
  • routid is the name by which you can access url, it could be same as module name. You can use <route id="{moduleName}" frontName="{moduleName}">.
    – Pawan
    Jun 9 '20 at 12:25

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.