문제

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

도움이 되었습니까?

해결책

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!

다른 팁

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" /> 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top