4

in file /vendor/magento/theme-frontend-blank/Magento_Theme/layout/default.xml, there is a block name store.links nested inside navigation.sections, which is used for the mobile view to show those account links. Can any one tell me how does those links are generated?

I have this question because I wrapped the header.links (account links) into my new block and move it from its original place of header.panel into header-wrapper (the one container the logo and search box originally). After changes, i noticed those links which should show under the navigation.sections ( tab name = Account), are not more showing. Any idea or direction i have to look in? thanks in advance.

5

here is my answer and hope can be a little help for those who are new to magento2.

//vendor/magento/theme-frontend-blank/web/js/theme.js

there is a line

$('.panel.header > .header.links').clone().appendTo('#store\.links');

if .header.links is moved to block other than .panel.header or even is wrapped in a new div, the above line is required to be updated to. for my case, it should be like

$('.header.content >.star-customer-login-links > .header.links').clone().appendTo('#store\.links');

This is the solution for this issue. but there may be another place have to be updated too. it's

/vendor/magento/theme-frontend-blank/web/js/navigation-menu.js

  • thx very much, you SAVE ME! in my magento 2.0.2 the line is $('.panel.header > .header.links').clone().appendTo('#store\\.links');. Do you know why they use \\? I understood that it was a javascript trick, but i searched always for "store.links"! :( – LucScu May 9 '16 at 8:41
  • sorry, i don't know the purpose of double backward slash neither. Btw, there are double slash in my 2.0.4 installation. it's the copy and paste mistake in my answer. – Nero May 9 '16 at 10:23
  • This works when user is not logged in. But breaks after logging in. Anything I am missing? I did change in the navigation-menu.js but no luck. Can you please tell me the exact place to change the class? – Sejal Shah Nov 1 '17 at 6:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.