function desactivate_custom_modules()
{
    $arrNonNative = Module::getNonNativeModuleList();
    $uninstallMe = array("undefined-modules");
    if (is_array($arrNonNative)) {
        foreach ($arrNonNative as $aModule) {
            $uninstallMe[] = $aModule['name'];
        }
    }
    return Module::disableByName($uninstallMe);
}
function upgrade_module_1_1_0($module)
{
    $old_module = 'zzcleanurls';
    if (Module::isInstalled($old_module)) {
        Module::disableByName($this->name);
        die(Tools::displayError('You must first un-install module "ZiZuu Clean URLs"'));
    }
    Db::getInstance()->delete('module', "`name` = '{$old_module}'", 1);
    Db::getInstance()->delete('module_preference', "`module` = '{$old_module}'");
    Db::getInstance()->delete('configuration', "`name` LIKE '{$old_module}%'");
    Db::getInstance()->delete('quick_access', "`link` LIKE '%module_name={$old_module}%'");
    return true;
}
Example #3
0
 /**
  * Don't forget to create update methods if needed:
  * http://doc.prestashop.com/display/PS16/Enabling+the+Auto-Update
  */
 public function install()
 {
     //instalacion del modulo
     if (Module::isInstalled('botondepago')) {
         Module::disableByName($this->name);
         //note during testing if this is not done, your module will show as installed in modules
         die(Tools::displayError('Primero debe desinstalar la version anterior del modulo.'));
     }
     $this->createConfigVariables();
     include dirname(__FILE__) . '/sql/install.php';
     //script sql con la creacion de la tabla transaction
     return parent::install() && $this->registerHook('displayPayment') && $this->registerHook('displayPaymentReturn') && $this->registerHook('displayBackOfficeHeader') && $this->registerHook('displayHeader') && $this->registerHook('displayAdminProductsExtra') && $this->registerHook('actionProductUpdate') && $this->registerHook('displayAdminOrderContentOrder') && $this->registerHook('displayAdminOrderTabOrder') && $this->unregisterHook('displayAdminProductsExtra');
     //muestra una tab en el detalle de la orden
 }
function desactivate_custom_modules()
{
    // Get all modules then select only payment ones
    $arrInstalledModules = Module::getModulesInstalled();
    // get native module list
    $module_list_xml = INSTALL_PATH . '/../config/modules_list.xml';
    $nativeModules = simplexml_load_file($module_list_xml);
    $nativeModules = $nativeModules->modules;
    if ($nativeModules['type'] == 'native') {
        foreach ($nativeModules->module as $module) {
            $arrNativeModules[] = $module['name'] . '';
        }
    }
    $uninstallMe = array("rien");
    foreach ($arrInstalledModules as $aModule) {
        if (!in_array($aModule['name'], $arrNativeModules)) {
            $uninstallMe[] = $aModule['name'];
        }
    }
    Module::disableByName($uninstallMe);
    foreach ($aModule as $module) {
        $file = _PS_MODULE_DIR_ . $module['name'] . '/' . $module['name'] . '.php';
        if (!file_exists($file)) {
            continue;
        }
        $fd = fopen($file, 'r');
        if (!$fd) {
            continue;
        }
        $content = fread($fd, filesize($file));
        if (preg_match_all('/extends PaymentModule/U', $content, $matches)) {
            Db::getInstance()->Execute('
			INSERT INTO `' . _DB_PREFIX_ . 'module_country` (id_module, id_country)
			SELECT ' . (int) $module['id_module'] . ', id_country FROM `' . _DB_PREFIX_ . 'country` WHERE active = 1');
            Db::getInstance()->Execute('
			INSERT INTO `' . _DB_PREFIX_ . 'module_currency` (id_module, id_currency)
			SELECT ' . (int) $module['id_module'] . ', id_currency FROM `' . _DB_PREFIX_ . 'currency` WHERE deleted = 0');
        }
        fclose($fd);
    }
}
Example #5
0
 /**
  * Called when module is set to deactive
  */
 public function disable()
 {
     return Module::disableByName($this->name);
 }
Example #6
0
 /**
  * Remove the default newsletter block so that we can accomodate the
  * newsletter block of SendinBlue
  */
 public function removeBlocknewsletterBlock()
 {
     if (_PS_VERSION_ <= '1.4.1.0') {
         Db::getInstance()->Execute('UPDATE `' . _DB_PREFIX_ . 'module` SET active = 0 WHERE name = "blocknewsletter"');
     } else {
         Module::disableByName('blocknewsletter');
     }
 }
 protected function setPosition()
 {
     $position = 0;
     $blocksearch = Module::getInstanceByName('blocksearch');
     /**
      * If 'blocksearch' is not installed the module requires
      * A manual position update
      */
     if ($blocksearch !== false) {
         $hook_top = Hook::getIdByName('displayTop');
         $position = $blocksearch->getPosition($hook_top);
         if (is_null($position) == false) {
             /* Disable the default 'blocksearch' module */
             Module::disableByName('blocksearch');
             $this->updatePosition($hook_top, 0, $position);
         }
     }
     /* Register configuration key so we know the position has been updated */
     Configuration::updateValue('ALGOLIA_POSITION_FIXED', $position);
 }
 public function disableOtherSearch()
 {
     if (Module::isEnabled('blocksearch')) {
         Module::disableByName('blocksearch');
     }
     if (Module::isEnabled('searchsuggestions')) {
         Module::disableByName('searchsuggestions');
     }
     if (Module::isEnabled('powersearch')) {
         Module::disableByName('powersearch');
     }
     return true;
 }