Customer Account page title is at the bottom, and margin-bottom is being set to 0 but i cant find where

magento.stackexchange https://magento.stackexchange.com/questions/326848

سؤال

I'm so close to having this site finished and then this happens. I logged into the customer account section to check all was good and then i was greeted with this...

enter image description here

It should look like this...

enter image description here

I achieved this by doing the following. Getting rid of margin-bottom: 0; on .page-main .block but i cant find anywhere in the .less files where this is coming from.

enter image description here

I then moved page-title to just under column main

enter image description here

That achieves the required result but other than in inspect element i cant get it to work. I have added !important to the .page-main .block in the magento_customer/web/css/source/module.less which did nothing after recompiling, clearing static-content and cache.

I also believe that my customer_account.xml file is correct

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page layout="2columns-left" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="sidebar.main">
            <block class="Magento\Framework\View\Element\Template" name="customer_account_navigation_block" template="Magento_Theme::html/collapsible.phtml" before="-">
                <arguments>
                    <argument name="block_title" translate="true" xsi:type="string">Account Dashboard</argument>
                    <argument name="block_css" xsi:type="string">block-collapsible-nav</argument>
                </arguments>
                <block class="Magento\Framework\View\Element\Html\Links" name="customer_account_navigation" before="-">
                    <arguments>
                        <argument name="css_class" xsi:type="string">nav items</argument>
                    </arguments>
                    <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-account-link">
                        <arguments>
                            <argument name="label" xsi:type="string" translate="true">Account Dashboard</argument>
                            <argument name="path" xsi:type="string">customer/account</argument>
                        </arguments>
                    </block>
                    <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-account-edit-link">
                        <arguments>
                            <argument name="label" xsi:type="string" translate="true">Account Information</argument>
                            <argument name="path" xsi:type="string">customer/account/edit</argument>
                        </arguments>
                    </block>
                    <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-address-link">
                        <arguments>
                            <argument name="label" xsi:type="string" translate="true">Address Book</argument>
                            <argument name="path" xsi:type="string">customer/address</argument>
                        </arguments>
                    </block>
                </block>
            </block>
        </referenceContainer>
        <move element="page.main.title" destination="content.top" before="-"/>
    </body>
</page>

the <move element="page.main.title" destination="content.top" before="-"/> line being the one that should put the title to the top from what I've read. I understand that this is a duplicate question but not one thing I tried has worked.

The only thing I found that might help is someone said about if there is a module installed that uses sequence or something but I'm no expert and really don't know.

If no one can help me is there a quick and safe way to disable and re-enable modules so i can diagnose the problem child.

هل كانت مفيدة؟

المحلول

it is might be a core bug see : https://github.com/magento/magento2/issues/16786

How to fix :

Goto : vendor/magento/module-theme/view/frontend/layout/default.xml

Search for This

<container name="content.top" label="Main Content Top"/>

Replace it with the following one:

<container name="content.top" label="Main Content Top" before="-"/>

Please do not forgot to clear cache etc..

For more detail see : https://mage2.pro/t/topic/1990

Thanks

نصائح أخرى

There is a better solution explained here that does not require overwriting any core files: https://magento.stackexchange.com/a/190855/3830

Simply create a new customer_account.xml in app/design/frontend/<Package>/<theme>/Magento_Customer/layout/ and add the following content:

<?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" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Customer My Account (All Pages)" design_abstraction="custom">
    <body>
        <move element="page.main.title" destination="content" before="-" />
    </body>
</page>

Clear the cache, and the issue will be fixed.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top