Question

I want to override the layout of magento-customer in my theme.

The vendor path is

/vendor/magento/module-customer/view/frontend/layout/customer_account_index.xml

And its code is

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<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"/>
    <body>
        <referenceBlock name="page.main.title">
            <action method="setPageTitle">
                <argument translate="true" name="title" xsi:type="string">My Dashboard</argument>
            </action>
        </referenceBlock>
        <referenceContainer name="content">
            <block class="Magento\Framework\View\Element\Template" name="customer_account_dashboard_top" as="top"/>
            <block class="Magento\Customer\Block\Account\Dashboard\Info" name="customer_account_dashboard_info" as="info" template="account/dashboard/info.phtml" cacheable="false"/>
            <block class="Magento\Customer\Block\Account\Dashboard\Address" name="customer_account_dashboard_address" as="address" template="account/dashboard/address.phtml" cacheable="false"/>
        </referenceContainer>
    </body>
</page>

Now I am trying to override in my theme,

app/design/frontend/Oneclout/jblashes/Magento_Customer/layout/customer_account_index.xml

and the code is

    <?xml version="1.0"?>
    <!--
    /**
     * Copyright © 2013-2017 Magento, Inc. All rights reserved.
     * See COPYING.txt for license details.
     */
    -->
    <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"/>
        <body>
            <referenceBlock name="page.main.title">
                <action method="setPageTitle">
                    <argument translate="true" name="title" xsi:type="string">My Dashboard</argument>
                </action>
            </referenceBlock>
            <referenceContainer name="content">

                <block class="Magento\Customer\Block\Account\Dashboard\Info" name="customer_account_dashboard_info" as="info" template="account/dashboard/info.phtml" cacheable="false"/>
                <block class="Magento\Customer\Block\Account\Dashboard\Address" name="customer_account_dashboard_address" as="address" template="account/dashboard/address.phtml" cacheable="false"/>
            </referenceContainer>
<block class="Magento\Framework\View\Element\Template" name="customer_account_dashboard_top" as="top"/>
        </body>
    </page>

I just want to override this.

Was it helpful?

Solution

<?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"/>
    <body>

        <move element="customer_account_dashboard_top" destination="content" after="customer_account_dashboard_address" />
    </body>
</page>

OTHER TIPS

Add this:

<move element="customer_account_dashboard_top" destination="content" after="customer_account_dashboard_address">

inside the <body> tag of:

app/design/frontend/Oneclout/jblashes/Oneclout_jblashes/layout/default.xml

it should work also in:

app/design/frontend/Oneclout/jblashes/Magento_Customer/layout/customer_account_index.xml

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top