Magento:禁用任何特定商店的模块 [英] Magento: Disable module for any particular store

查看:193
本文介绍了Magento:禁用任何特定商店的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有3个商店。



我想禁用商店2中的模块。我只希望在商店1和商店3中启用。 / p>

我知道我可以这么做: -




  • 系统 - >配置 - >高级


  • 当前配置范围下拉列表中选择所需的存储。




但这不能完全起作用。



,我也不想检查存储在模块代码本身或创建系统配置字段为模块检查/取消选中存储启用/禁用。



我希望通过在 app / etc / modules / MyNamespace_MyModule.xml 中添加一些代码。

解决方案

这个配置只是禁用前端布局模块输出,但模块控制器,事件观察器,管理页面等仍在工作。



也不要忘记在布局文件定义中指定模块名称,否则将为特定商店加载所有布局文件内容:

 < config> 
< layout>
< module_alias module =Module_Name>
< file> yourlayoutfile.xml< / file>
< / module_alias>
< / layout>
< / config>

如果您正在开发一个模块并想要禁用其特定商店的前端功能,那么您应该创建一个Yes / No类型的配置字段,并通过模块代码中的Mage :: getStoreConfigFlag('config / field / path')检查其值。


Suppose, I have 3 stores.

I want to disable a module in Store 2. I only want it to be enabled in Store 1 and Store 3.

I see that I can do it by:-

  • Going to System -> Configuration -> Advanced

  • Selecting desired store from Current Configuration Scope dropdown list.

But this does not work fully.

And, I also don't want to check store in the module code itself or create system configuration field for the module to check/uncheck store to enable/disable.

What I am expecting is by adding some code in app/etc/modules/MyNamespace_MyModule.xml. Can we do it this way?

解决方案

This configuration just disables module output in layout for frontend, but module controllers, event observers, admin pages, etc still working.

Also don't forget to specify your module name in layout files definition, otherwise all the layout file content will be loaded for a particular store:

<config>
   <layout>
       <module_alias module="Module_Name">
           <file>yourlayoutfile.xml</file>
       </module_alias>
   </layout>
</config>

If you are developing a module and want to disable full its functionality on the frontent for a particular store, then you should create a configuration field of "Yes/No" type and check its value via Mage::getStoreConfigFlag('config/field/path') in your module code.

这篇关于Magento:禁用任何特定商店的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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