简体   繁体   English

如何在侧边栏导航中包含服务菜单?

[英]How to include Service-Menu in Sidebar Navigation?

I've tried to include the service-menu-block into the twig file of the sidebar, which is loaded in category-pages, but for some reason the this doesn't work.我试图将服务菜单块包含到边栏的 twig 文件中,该文件加载到类别页面中,但由于某种原因,这不起作用。 its the same code, thats works in the footer section.它的代码相同,这在页脚部分有效。 If I write some static html in there it shows, but but the pages from the menu aren't listed.如果我在那里写一些 static html 它会显示,但是菜单中的页面没有列出。 could somebody help out?有人可以帮忙吗?

This is the code from the service menu:这是服务菜单中的代码:

{% sw_include '@Storefront/storefront/layout/navigation/my-service-menu.html.twig'%}

The footer navigation content, i assume thats the content you want to display inside your category page sidebar, is only loaded during the FooterPageletLoader and added during the GenericPageLoader to the page.footer variable for twig.页脚导航内容,我假设这是您想要在类别页面侧边栏中显示的内容,仅在FooterPageletLoader期间加载并在GenericPageLoader期间添加到page.footer变量 twig。

You can test that by adding {{ dump(page.footer) }} to the template where you wanted to include the service menu.您可以通过将{{ dump(page.footer) }}添加到要包含服务菜单的模板来进行测试。 If the dump is empty, your current page is not using the GenericPageLoader or does not have access to the data.如果转储为空,则您的当前页面未使用GenericPageLoader或无权访问数据。 If the dump is not empty, the required data for the template might need to be passed differently.如果转储不为空,则可能需要以不同方式传递模板所需的数据。 For example:例如:

{% sw_include '@Storefront/storefront/layout/navigation/my-service-menu.html.twig'' with { 
   data: page.test
} %}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM