[英]Magento 1.7.2 - How to include CMS pages in topmenu?
I have created 2 CMS pages in magento 1.7.2 我在magento 1.7.2中创建了2个CMS页面
Lets say the cms page "About Us" which is the URL 假设cms页面“关于我们”是URL
http://localhost/magento/index.php/about-company/?___store=default
and the page "Customer Service" which is the URL http://localhost/magento/index.php/customer-service/?___store=default
和“客户服务”页面,即URL
http://localhost/magento/index.php/customer-service/?___store=default
In my HEADER.PHTML the line getChildHtml('topMenu') ?> shows the topmenu. 在我的HEADER.PHTML中,getChildHtml('topMenu')?>行显示了顶层菜单。
the problem is that the 'topMenu' contains only the categories created by Catalog->Manage Categories 问题是“ topMenu” 仅包含由“ 目录”->“管理 类别”创建的类别
What is the appropriate way to include the 2 cms pages ("About Us" and "Customer Service") in the 'topMenu' ? 将2 cms页面(“关于我们”和“客户服务”)包括在“ topMenu”中的合适方法是什么?
Thank you for your help ! 谢谢您的帮助 !
Create a static block for cms pages from admin and write the below format code 从管理员为cms页面创建一个静态块,并编写以下格式代码
<ul>
<li><a href="{{store direct_url="about-company"}}">About Company</a></li>
<li><a href="{{store direct_url="customer-service"}}">Customer Service</a></li>
</ul>
Call this block in topmenu.phtml (/template/page/html/topmenu.phtml) page 在topmenu.phtml(/template/page/html/topmenu.phtml)页面中调用此块
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('cms_pages')->toHtml();?>
在/template/page/html/topmenu.phtml下添加以下代码
<li title="<?php echo $this->__('About Company') ?>"><a href="<?php echo $this->getUrl('')?>about-company"><?php echo $this->__('About Company') ?></a></li>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.