简体   繁体   中英

Magento 1.7.2 - How to include CMS pages in topmenu?

I have created 2 CMS pages in magento 1.7.2

Lets say the cms page "About Us" which is the 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

In my HEADER.PHTML the line getChildHtml('topMenu') ?> shows the topmenu.

the problem is that the 'topMenu' contains only the categories created by Catalog->Manage Categories

What is the appropriate way to include the 2 cms pages ("About Us" and "Customer Service") in the 'topMenu' ?

Thank you for your help !

Create a static block for cms pages from admin and write the below format code

<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

<?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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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