![](/img/trans.png)
[英]How to add Magento CMS PAGES to topMenu (not in top.links) in Magento 1.7.2
[英]Magento 1.7.2 - How to include CMS pages in topmenu?
我在magento 1.7.2中創建了2個CMS頁面
假設cms頁面“關於我們”是URL
http://localhost/magento/index.php/about-company/?___store=default
和“客戶服務”頁面,即URL http://localhost/magento/index.php/customer-service/?___store=default
在我的HEADER.PHTML中,getChildHtml('topMenu')?>行顯示了頂層菜單。
問題是“ topMenu” 僅包含由“ 目錄”->“管理 類別”創建的類別
將2 cms頁面(“關於我們”和“客戶服務”)包括在“ topMenu”中的合適方法是什么?
謝謝您的幫助 !
從管理員為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>
在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.