Wednesday, March 2, 2016

Add Module Link in Customer Account Dashboard Magento2

           <!---------------------------- Create Simple module --------------------------------->

          1. App/Code/Custom/Module/registration.php

                  <?php
                             \Magento\Framework\Component\ComponentRegistrar::register(
                                          \Magento\Framework\Component\ComponentRegistrar::MODULE,
                                               'Custom_Module',
                                                     __DIR__
                                           );
                   ?>


         2. App/code/Custom/Module/etc/module.xml
                   <?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="Custom_Module" setup_version="1.0.0">
                    <sequence>
                          <module name="Magento_Customer"/>
                      </sequence>
                 </module>
        </config>


       3. app/code/Custom/Module/view/frontend/layout/customer_account.xml
             
            <?xml version="1.0"?>
            <body>
              <referenceContainer name="customer_account_navigation">
            
                <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-account-link-custom"> 
                    <arguments>
                        <argument name="label" xsi:type="string" translate="true">Custom Title</argument>
                        <argument name="path" xsi:type="string">module/controller/action</argument>
                    </arguments>
                </block>
          
           </referenceContainer>
         </body>

No comments:

Post a Comment