如何添加CMS页面链接到主菜单在Magento 2
2018年10月4日
将所有需要的产品类别添加到主菜单中非常容易. 但经常有必要补充 CMS pages 菜单也是如此,这个过程有时会令人困惑.
但是,现在不要担心,该操作不需要在文件中编写任何额外的代码.
它可以很容易地通过管理面板完成,今天我们将得到的步骤直接在这里.
复制页面内容
首先,您需要登录到Magento管理面板和导航到 Content -> Pages tab.
![](/help/wp-content/uploads/2018/10/How_to_add_the_CMS_page_link_to_main_menu_in_Magento_2_1.jpg)
在那里,找到要添加到菜单中的页面,然后选择 edit 选项中的 dropdown 在它的右边. 在我们的例子中,它是 Guarantee page.
![](/help/wp-content/uploads/2018/10/How_to_add_the_CMS_page_link_to_main_menu_in_Magento_2_2.jpg)
向下滚动到 Content tab,展开它,并从那里复制所有代码. 在进一步的过程中,您将需要它.
![](/help/wp-content/uploads/2018/10/How_to_add_the_CMS_page_link_to_main_menu_in_Magento_2_3.jpg)
将页面的代码添加到CMS块中
现在,我们需要创造 新建内容块,我们将页面中的代码放在这里.
要做到这一点,请导航到 Content -> Blocks tab.
![](/help/wp-content/uploads/2018/10/How_to_add_the_CMS_page_link_to_main_menu_in_Magento_2_4.jpg)
Click on 添加新块 option.
![](/help/wp-content/uploads/2018/10/How_to_add_the_CMS_page_link_to_main_menu_in_Magento_2_11.png.jpg)
Fill in the title, identifier, assign store view 粘贴到 页面内容代码 你之前复制过的.
确保 使块 选项设置为 Yes.
别忘了 save 控件进行更改 Save block 按钮在右上角.
![](/help/wp-content/uploads/2018/10/How_to_add_the_CMS_page_link_to_main_menu_in_Magento_2_5.jpg)
将block分配给类别
最后,导航到 Catalog -> Categories tab.
![](/help/wp-content/uploads/2018/10/How_to_add_the_CMS_page_link_to_main_menu_in_Magento_2_6.jpg)
Click on 添加子类别 按钮,并输入要访问的页面名称 类别名称 field.
Note, that 启用类别 and 包含在菜单中 选项需要设置为 Yes.
![](/help/wp-content/uploads/2018/10/How_to_add_the_CMS_page_link_to_main_menu_in_Magento_2_7.jpg)
Under Content tab,将我们之前创建的新块分配给类别.
![](/help/wp-content/uploads/2018/10/How_to_add_the_CMS_page_link_to_main_menu_in_Magento_2_8.jpg)
向下滚动 显示设置 选项,选择 显示模式 字段并选择 静态块 only option.
![](/help/wp-content/uploads/2018/10/How_to_add_the_CMS_page_link_to_main_menu_in_Magento_2_9.jpg)
不要忘记保存更改并清除 browser cache.
Well done! 现在您的客户和您可以享受新的菜单项目在您的 website.
![](/help/wp-content/uploads/2018/10/How_to_add_the_CMS_page_link_to_main_menu_in_Magento_2_10.jpg)
我们也会建议你看不同的 线上购物的主题 如果你需要更多的选择 website 构建解决方案.