Skip to content

Proxies-free.com: 100% Free Daily Proxy Lists Every Day!

Get Free Proxies Every Day

magento2 – Account navigation new link

I add a new link to my account navigation and i want to open in the right side my content. Unfortunately, when i press on it it goes to a new window that say the page doesn’t exist
In app/code/PCE/NewPassowrd/web/frontend/layout/customer_account.xml

<?xml version="1.0"?>
<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="MagentoCustomerBlockAccountSortLinkInterface" name="customer-account-navigation-newpassword-change-link">
                <arguments>
                    <argument name="path" xsi:type="string">newpassword/change</argument>
                    <argument name="label" xsi:type="string">New Password</argument>
                    <argument name="sortOrder" xsi:type="number">250</argument>
                </arguments>
            </block>
         
        </referenceBlock>
    </body>
</page>

In app/code/PCE/NewPassowrd/web/frontend/layout/routes.xml

<?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="newpassword" id="newpassword">
         <module name="PCE_NewPassword"/>
     </route>
  </router>
</config>

In app/code/PCE/NewPassowrd/web/frontend/layout/newpassword_change_index.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="customer_account"/>
    <head>
        <title>
            Your First Link
        </title>
    </head>
    <body>
        <referenceContainer name="content">
            <block class="PCENewPasswordBlockResetPassword" name="newpassword.change.index" template="PCE_NewPassword::change/index.phtml" cacheable="false" />
        </referenceContainer>
    </body>
</page>

In app/code/PCE/NewPassowrd/Controller/Change/Index.php

<?php
namespace PCENewPasswordControllerChange;
 
class Index extends MagentoFrameworkAppActionAction
{
        /**
         * @var MagentoFrameworkViewResultPageFactory
         */
        protected $resultPageFactory;
 
        /**
         * @param MagentoFrameworkAppActionContext $context
         * @param MagentoFrameworkViewResultPageFactory resultPageFactory
         */
        public function __construct(
            MagentoFrameworkAppActionContext $context,
            MagentoFrameworkViewResultPageFactory $resultPageFactory
        )
        {
            $this->resultPageFactory = $resultPageFactory;
            parent::__construct($context);
        }
    /**
     * Default customer account page
     *
     * @return void
     */
    public function execute()
    {
        return $this->resultPageFactory->create();
    }
}
?>

In app/code/PCE/NewPassowrd/Block/ResetPassword.php

<?php
namespace PCENewPasswordBlock;
class ResetPassword extends MagentoFrameworkViewElementTemplate
{        
    public function __construct(
        MagentoBackendBlockTemplateContext $context,        
        array $data = ()
    )
    {        
        parent::__construct($context, $data);
    }
    
    public function getHelloWorld()
    {
        return 'Hello World';
    }
    
}
?>

In app/code/PCE/NewPassowrd/web/frontend/index.phtml

<h2>
    <?php echo $block->getHelloWorld(); ?>
</h2>
<?php 
echo 'My First Link Page';
?>

Where i make the mistake. Also i’m new to Magento and i work on 2.3.3

Author AdminPosted on January 25, 2021Categories ArticlesTags account, link, magento2, navigation

Post navigation

Previous Previous post: Efeito desenho a lapis com opencv e python
Next Next post: Should the client handle unsolicited protocol events from the backend?
Proxies-free.com: 100% Free Daily Proxy Lists Every Day! Proudly powered by WordPress

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive Proxies-free.com New Proxy Lists Every Day Proxies123