Check the below files to create a customer account navigation link.
app/code/Bluethinkin/Customermenu/registration.php
1 2 3 4 5 |
<?php use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Bluethinkinc_Customermenu', __DIR__); ?> |
app/code/Bluethinkinc/Customermenu/etc/module.xml
1 2 3 4 5 6 7 8 9 10 11 |
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Bluethinkinc_Customermenu" setup_version="1.0.0"> </module> </config> |
app/code/Bluethinkinc/Customermenu/etc/frontend/routes.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<?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 frontName="customermenu" id="customermenu"> <module name="Bluethinkinc_Customermenu"/> </route> </router> </config> |
app/code/Bluethinkinc/Customermenu/view/frontend/layout/customer_account.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
<?xml version="1.0"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="customer_account_navigation"> <block class="Magento\Framework\View\Element\Html\Link\Current" name="bluethinkinc_customermenu_custom_my_account"> <arguments> <argument name="path" xsi:type="string">customermenu/account/custompage</argument> <argument name="label" xsi:type="string">My custom</argument> <argument name="sortOrder" xsi:type="number">150</argument> <argument name="navigation" xsi:type="boolean">true</argument> </arguments> </block> </referenceBlock> </body> </page> |
app/code/Bluethinkinc/Customermenu/Controller/Account/Custompage.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
<?php namespace Bluethinkinc\Customermenu\Controller\Account; use Magento\Framework\View\Result\PageFactory; use Magento\Framework\App\Action\Context; class Custompage extends \Magento\Customer\Controller\AbstractAccount { /** * @var PageFactory */ protected $resultPageFactory; /** * @param Context $context * @param PageFactory $resultPageFactory * @param \Magento\Framework\Controller\Result\ForwardFactory $resultForwardFactory */ public function __construct( Context $context, PageFactory $resultPageFactory ) { $this->resultPageFactory = $resultPageFactory; parent::__construct($context); } /** * @return \Magento\Framework\View\Result\Page */ public function execute() { /** @var \Magento\Framework\View\Result\Page $resultPage */ $resultPage = $this->resultPageFactory->create(); $resultPage->getConfig()->getTitle()->set(__('My Custom')); return $resultPage; } } |
app/code/Bluethnkinc/Customermenu/view/frontend/layout/customermenu_account_custompage.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
<?xml version="1.0"?> <!-- /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <update handle="customer_account"/> <body> <referenceContainer name="content"> <block class="Magento\Framework\View\Element\Template" name="bluethinkinc_customermenu_custom_my_account_content" template="Bluethinkinc_Customermenu::customtemplate.phtml"/> </referenceContainer> </body> </page> |
app/code/Bluethinkinc/Customermenu/view/frontend/templates/customtemplate.phtml
1 2 3 4 5 |
<div> <h2>Hello BluethinkInc</h2> </div> |
Frontend View
Find More Blogs
How to Add a Custom Tab to the Customer Order Detail Page in Magento 2
Spread the love Adding a custom tab to the Order Detail
Exception Handling in Java
Spread the love Introduction – Exception:An unwanted
How to add custom less file in Magento2
Spread the love Source files *.css included into layout
Spring Boot Microservices
Spread the love Microservices architecture has become
Implementation of WireMock for better testing
Spread the love WireMock is a flexible and powerful tool
Magento 2: How to selected default option in configurable options?
Spread the love Configurable products in Magento 2 allow
How To Implement Simple JWT Authentication in Django Rest Framework
Spread the love We’ll learn how to use simple JWT
Optimizing Search: Integrating Elasticsearch in Django Applications
Spread the love What is Elasticsearch? Elasticsearch is a
How to create Customer Segments
Spread the love In Magento 2, “customer
Proxy Design Pattern and Requisition List in Magento 2
Spread the love Requisition List in Magento 2 Requisition
bluethinkinc_blog
2023-09-19