Magento静态页面菜单 [英] Magento static pages menu

查看:50
本文介绍了Magento静态页面菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个菜单,该菜单将动态显示CMS中的活动静态页面;例如,如果在我的CMS中我有以下页面:

I want to make a menu that will dynamically show the active static pages from CMS; for example if in my CMS I have these pages:

  • 关于我们(已启用)
  • 发运退款(已停用)
  • 条款和条件(已启用)
  • 联系人(已启用)

然后菜单将如下所示:

关于我们|条款及细则|联系人

About US | Terms and Conditions | Contacts

我只需要一些有关入门的提示;也许以前有人已经这样做过?

I need just a few tips on how to get started; maybe somebody has already done this before?

推荐答案

Dougle 非常感谢,这真的很有帮助!

Dougle thanks a lot, that was really helpful!

Feed 在Magento CMS中,您可以制作只能使用其IDENTIFIER访问的静态页面;我想要的是制作一个菜单,该菜单将自动显示ACTIVE(已启用)静态页面;并且如果您将状态设置为禁用",则它不应出现在菜单中;

Fede in Magento CMS you can make static pages that you can only access using its IDENTIFIER; what I wanted is somehow make a menu that will automatically display the ACTIVE (enabled) static pages; and if you set status to Disable it should not be in the menu;

这是我使用的代码,请注意,如果404页面为$PageData['identifier']!='no-route'; no-rute,那么我在菜单中不需要它,但是必须启用它,以便Magento将404错误重定向到此页面;

here is the code i used, note there is IF $PageData['identifier']!='no-route'; no-rute is the 404 page, so i don't need it in the menu, but it must be enabled so Magento redirects 404 errors to this page;

<div>
    <?php $collection = Mage::getModel('cms/page')->getCollection()->addStoreFilter(Mage::app()->getStore()->getId());?>
    <?php  $collection->getSelect()
          ->where('is_active = 1'); ?>
    <ul>
    <?php foreach ($collection as $page): ?>
      <?php $PageData = $page->getData(); ?>
      <?php if($PageData['identifier']!='no-route') { ?>
      <li>
        <a href="/<?php echo $PageData['identifier']?>"><?php echo $PageData['title'] ?></a>
      </li>
      <?php } ?>
    <?php endforeach; ?>
</div>

这篇关于Magento静态页面菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆