[英]Magento 1.9 Enable Disable Module From Admin Panel
I have a task to create a Magento module that's override some phtml files, however, as the task requirement I need to control the module from system->configuration,
by creating a tab for the module, then an option for enable disable the module
. 我有一个任务来创建一个覆盖某些phtml文件的Magento模块,但是,作为任务要求,我需要通过
system->configuration,
来控制该模块system->configuration,
是为该模块创建一个选项卡,然后选择enable disable the module
。
How could I accomplish this, taken into consideration the module contains the phtml file to override. 考虑到模块包含要覆盖的phtml文件,我如何才能做到这一点。
Thank you, 谢谢,
Usually, I prefer to create block which will render those templates, then, you can use override _toHtml
method and implement the logic there. 通常,我更喜欢创建将呈现那些模板的块,然后,您可以使用override
_toHtml
方法并在那里实现逻辑。 Similar to what the Mage_Core_Block_Template
does. 与
Mage_Core_Block_Template
相似。
class Namespace_Module_Block_Template extends Mage_Core_Block_Template
{
...
protected function _toHtml()
{
if (!this->_isEnabled()) {
return '';
}
return parent::_toHtml();
}
...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.