如何将页面添加到多站点中的导航菜单?

发布于 2024-12-12 18:45:05 字数 1097 浏览 6 评论 0原文

我在我的 magento 网站中配置了多站点。我点击以下链接 http://www.magentocommerce.com/magento-on-the-飞行/多个站点/ 现在,当我访问新的辅助站点时,我注意到导航菜单包含与主站点中相同的页面。 我希望当我向辅助站点添加 cms/页面时,它应该显示在辅助站点的导航菜单中,而不是显示在主站点中。当我将 cms/页面添加到主站点时,它应该显示在主站点的导航菜单中,而不是显示在辅助站点中。 那么我将如何做到这一点。 这是我在 navigation/top.phtml 中的代码

<?php $_menu_cms = Mage::getModel('cms/page')->getCollection(); ?>
<div id="menu_nav">

    <ul>
        <?php foreach($_menu_cms as $cmspage): ?>
<?php $page = $cmspage->getData(); ?>
<?php if($page['identifier'] == "no-route" || $page['is_active'] == "0" || $page['identifier'] == "enable-cookies"){ } else { ?>
<?php if($page['title'] == "About" || $page['title'] == "asd" || $page['title'] == "Products" || $page['title'] == "Home") {?>
<?php echo "<li><a href=\"".$page['identifier']."\" title=\"".$page['title']."\">".$page['title']."</a></li>"; ?>
<?php }} ?>
<?php endforeach; ?>
    </ul>
</div>

I have configured multi site in my magento website. I follow the following link
http://www.magentocommerce.com/magento-on-the-fly/multiple-sites/
Now When I visited the my new secondry site I noted that the navigation menu contains the same pages as in the main site.
And I want that when I added a cms/page to the secondary site it should display in the navigation menu of the secondary site and not in the main site. And when I add the cms/page to the main site it should display in the navigation menu of the main site and not in the secondary site.
So How will I do this.
Here is my code in the navigation/top.phtml

<?php $_menu_cms = Mage::getModel('cms/page')->getCollection(); ?>
<div id="menu_nav">

    <ul>
        <?php foreach($_menu_cms as $cmspage): ?>
<?php $page = $cmspage->getData(); ?>
<?php if($page['identifier'] == "no-route" || $page['is_active'] == "0" || $page['identifier'] == "enable-cookies"){ } else { ?>
<?php if($page['title'] == "About" || $page['title'] == "asd" || $page['title'] == "Products" || $page['title'] == "Home") {?>
<?php echo "<li><a href=\"".$page['identifier']."\" title=\"".$page['title']."\">".$page['title']."</a></li>"; ?>
<?php }} ?>
<?php endforeach; ?>
    </ul>
</div>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

薄荷港 2024-12-19 18:45:05

将第一行更改为:

<?php
    $_menu_cms = Mage::getModel('cms/page')->getCollection()
               ->addStoreFilter(Mage::app()->getStore());
?>

Change the first line to:

<?php
    $_menu_cms = Mage::getModel('cms/page')->getCollection()
               ->addStoreFilter(Mage::app()->getStore());
?>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文