Question

I want to show the customer profile pic and the name after he/she logged in on the account navigation sidebar. I have successfully got those details. Please see below.

enter image description here

However, I want to show them above the My Account link. I have tried moving but not success.

Can anyone please guide me on this?

<referenceContainer name="sidebar.main">
<block class="Vendor\Module\Block\Testing" name="customer.session.data" template="Vendor_Module::Test.phtml" before="customer-account-navigation-account-edit-link" cacheable="false" />

Was it helpful?

Solution

Update your XML with below content and check

<block class="Vendor\Module\Block\Testing" name="customer.session.data" template="Vendor_Module::Test.phtml" before="-" cacheable="false" />

Or

Add this line after referenceContainer tag

<move element="customer.session.data" destination="sidebar.main" before="-" />

Or

<referenceContainer name="sidebar.main.account_nav">
    <block class="Vendor\Module\Block\Testing" name="customer.session.data" template="Vendor_Module::Test.phtml" before="-" cacheable="false" />
</referenceContainer>

Hope this will help you!

OTHER TIPS

Try adding your block before sidebar.main.account_nav block, i.e your code in xml file-

 <block class="Vendor\Module\Block\Testing" name="customer.session.data" template="Vendor_Module::Test.phtml" cacheable="false" before="sidebar.main.account_nav" /> 
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top