首页 文章

Magento Multistore,两个模板,两个菜单

提问于
浏览
2

我有一个 multistore Magento设置(Magento 1.7.0.2),我希望有两个不同的模板用于不同的商店 . 安装第二个模板后,第一个模板中的菜单消失 . 我认为这是因为模板实现了自定义 Menu Module .

如何编辑模块以两种不同的方式覆盖Magento导航(对于两个不同的模板)?

干杯!

2 回答

  • 0

    根据您的描述,我猜这个问题是由默认的块,控制器或模型被菜单模块覆盖引起的 . 在当前版本的Magento中处理这个并不容易 . 我可以针对您遇到的情况提出解决方案 .

    Check which class is override

    您可以检查菜单模块下的config.xml,路径应该是

    /MAGENT_ROOT/app/code/{local,community}/Custom/Menu/etc/config.xml
    

    检查标签

    /config/global/models/xxxx/rewrite        # for model rewrite
    /config/global/rewrite/xxxx/{from, to}    # for controller rewrite
    /config/global/blocks/xxxx/rewrite        # for block rewrite
    

    然后,您可以查看模块覆盖的内容 .

    Create a Store view based options

    /MAGENT_ROOT/app/code/{local,community}/Custom/Menu/etc/system.xml
    

    添加一个名为启用扩展的选项 . (一些片段如下)

    # the xml should insert into /config/sections/xxxx/groups/general/fields/
    <enabled>
        <label>Enable the extension</label>
        <frontend_type>select</frontend_type>
        <source_model>adminhtml/system_config_source_yesno</source_model>
        <sort_order>10</sort_order>
        <show_in_default>1</show_in_default>
        <show_in_website>1</show_in_website>
        <show_in_store>1</show_in_store>
    </enabled>
    

    Check the classes

    编程良好应该覆盖默认类 . 所以我们可以使用以下逻辑:

    if (Mage::getStoreConfig('xxxx/general/enabled') === '1') {
        # the original module logic
    } else {
        parent::some_method($_args);
    }
    

    这是我可以根据我的假设提出的解决方案 . 希望它能帮到你 .

  • 0

    在创建第二个商店时,只需选择相同的类别根或该商店的自定义类别列表,您将在第二个,第三个商店中使用该菜单 .

    System > Manage Stores:
    

    选择现在不显示菜单的 Store Name ,然后选择默认 Root Category *

    希望这对你有所帮助 .

相关问题