[英]PrestaShop turn off module when installing new
我想在安裝新模塊時關閉 ps_customersignin 模塊,因為它實際上替換了這個模塊,在安裝功能中我做了:
$query = 'UPDATE `ps_module` SET `active` = "0" WHERE `name` = "ps_customersignin"';
return parent::install()
&& $this->registerHook('displayNav2')
&& $this->registerHook('header')
&& $this->registerHook('actionFrontControllerSetMedia')
&& Db::getInstance()->ExecuteS($query)
&& $this->_clearCache('*');
它改變了數據庫中的值,但似乎沒有關閉模塊當我安裝另一個模塊時有什么方法可以關閉模塊? 我有最新的 Presta 版本,清除安裝。
檢查 Module 類中的函數disable() ,
您需要刪除ps_module_shop表中的模塊條目,但您可以使用內置靜態方法Module::disableByName('ps_customersignin')以“核心”方式進行操作。
感謝@user3256843 的回答,我找到了解決方案 - disableByName 已棄用,但正在使用
Module::getInstanceByName('ps_customersignin')->disable();
工作正常,卸載后
Module::getInstanceByName('ps_customersignin')->enable();
一切似乎都很好:)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.