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
Proxy Design Pattern and Requisition List in Magento 2
Spread the love Requisition List in Magento 2 Requisition
Google Ads Conversion Tracking Through Magento Platform:
Spread the love Google Ads Conversion Tracking Through
Object Pool Pattern in Magento2
Spread the love What is Object Pool Pattern in Magento 2 An
JENKINS
Spread the love JENKINS Introduction and Installation
Virtual Type and Type
Spread the love Virtual type is one of the most common
Customize the length of Input field
Spread the love Sometimes we need to change the limit the
How to Add Custom Tab on Admin Dashboard and Count Website Total Visitor in Magento 2?
Spread the love In this blog we’ll see How to Add Custom
How to Add Sign Out Tab in Customer Account in Magento 2?
Spread the love In this blog we’ll see How to Add
How to create custom tab in product detail page in magento 2?
Spread the love In this blog we’ll see how to add
Understanding and Implementing CORS & CSRF
Spread the love What is security? The world has become more
bluethinkinc_blog
2023-09-19