2

below the account navigation is there an easy way for a newbie to add an image pointing to a page in the magento2? This account navigation appears on the side of my account dashboard. thanks!

enter image description here

Raj
8329 silver badges26 bronze badges
asked Jun 28, 2019 at 4:31
2
  • Here, you have to do so many things to show a profile image. I suggest you to check this extension: marketplace.magento.com/sy-avatar.html Commented Jun 28, 2019 at 5:32
  • add code of inserting image in account information Commented Jun 28, 2019 at 6:37

1 Answer 1

1

For the add image and there link in the below myaccount navigation dashboard.

Follow below steps.

File path: magento/app/design/frontend/Namespace/theme/Magento_Customer/layout/customer_account.xml

<?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" label="Customer My Account (All Pages)" design_abstraction="custom">
 <body>
 <block class="Magento\Framework\View\Element\Template" name="new-sidebar-image-block" template="Magento_Customer::imageblock.phtml"/>
 </body>
</page>

File path: magento/app/design/frontend/Namespace/theme/Magento_Customer/templates/imageblock.phtml

<a href="<?php echo $block->getUrl()?>customer/account/" target="_self"><img src="<?php echo $block->getUrl("pub/media/myaccount/")?>image.png"/></a>

Put your image to below path:

pub/media/myaccount/image.png

Now run the command php bin/magento cache:flush

Check in myaccount image will appear.

Hope it help.

answered Jun 28, 2019 at 13:48
5
  • thanks. I'm curios about the path, magento/app/design/frontend/Namespace/theme/Magento_Customer/layout/customer_account.xml. I'm currently using template monster from a vendor so would this still work or should I find my templates customer_account.xml instead? Commented Jun 28, 2019 at 15:14
  • It's works. Check and let me know if any issue. Commented Jun 28, 2019 at 16:20
  • so I tried this but its not working. Currently I have two subfolders below /app/design/frontend they are Magento and templatemonster. I tried two ways, first I made a seperate folder called test and put ./test/Magento_Customer/layout/customer_account.xml but that did not work so I tried putting it under the subfolder magento but did not work as well. Any other place I should try? Commented Jul 5, 2019 at 0:02
  • You have to need place the customer_account.xml in your theme below path. app/design/frontend/templatemonster/yourtheme/Magento_Customer/layout/customer_account.xml Commented Jul 5, 2019 at 4:37
  • Ok hmm I tried this. I also went ahead and do a flush as well as magento setup:upgrade; but its still not showing up. Do I need to register/initiate the custom template somewhere perhaps. Commented Jul 6, 2019 at 3:01

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.