2

I want to create a new custom Block and Block phtml file same as the Customer Index Block for use to the customer, when customer login the customer just click on the left navigation link and access the phtml file.

I have added the custom link already in the below XML file:

app\design\frontend\Vendor\Theme\Magento_Customer\layout/customer_account.xml

<block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-account-myinformation-link">
    <arguments>
        <argument name="label" xsi:type="string" translate="true">my information</argument>
        <argument name="path" xsi:type="string">customer/account/myinformation</argument>
    </arguments>
</block>

After clicking on this link, I want to call Block to get customer data like email, name mobile, address etc.

Please help me if anyone has created the Custom Block and Custom phtml file in the Magento_Customer module.

0

I think you need to extend Magento_Customer by create new controller customer/account/myinformation in your module with adding configuration.

<?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="customer" frontName="customer">
            <module name="Magento_Customer" />
        </route>
    </router>
</config>

Next you can create a layout and blocks.

Add new link in My Account: https://webkul.com/blog/account-navigation-link-magento2/

  • thanks for your answer. Could you please share the complete answer here. I am still stuck at this module. I will accept and upvote you answer. – mageDev0688 May 8 '17 at 6:01
  • @mageDev0688 I found answer early that wrote additional information :) Try this magento.stackexchange.com/a/121359/40609 – Mykhailo Shatilov May 8 '17 at 13:02
  • thanks I have created the module, but right now it's giving 404 error. – mageDev0688 May 15 '17 at 11:16

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.