Jump to content

Module two times installed


Recommended Posts

Hello,

 

i developed a module, but when installing i have it two times in hook and i also have to uninstall the same module two times ?

 

I used the standard install and uninstall function from guide:

public function install()
{
if (!parent::install() ||
!$this->installDB() ||
!$this->registerHook('header') ||
!$this->registerHook('displayProductButtons') ||
!Configuration::updateValue('PLM_NAME', 'tal2pl') ||
!Configuration::get('PS_LANG_DEFAULT')
)

return false;

return parent::install() 
&& $this->registerHook('displayProductButtons') 
&& $this->registerHook('header') 
&& Configuration::updateValue('PLM_NAME', 'tal2pl')
&& Configuration::get('PS_LANG_DEFAULT');

}
public function uninstall()
{
if (!parent::uninstall() ||
!Configuration::deleteByName('PLM_NAME')
)

return false;

Configuration::deleteByName('PLM_NAME');
return parent::uninstall();

}
Edited by Tahsin_85 (see edit history)
Link to comment
Share on other sites

 

Hello,

 

i developed a module, but when installing i have it two times in hook and i also have to uninstall the same module two times ?

 

I used the standard install and uninstall function from guide:

public function install()
{
if (!parent::install() ||
!$this->installDB() ||
!$this->registerHook('header') ||
!$this->registerHook('displayProductButtons') ||
!Configuration::updateValue('PLM_NAME', 'tal2pl') ||
!Configuration::get('PS_LANG_DEFAULT')
)

return false;

return parent::install() 
&& $this->registerHook('displayProductButtons') 
&& $this->registerHook('header') 
&& Configuration::updateValue('PLM_NAME', 'tal2pl')
&& Configuration::get('PS_LANG_DEFAULT');

}
public function uninstall()
{
if (!parent::uninstall() ||
!Configuration::deleteByName('PLM_NAME')
)

return false;

Configuration::deleteByName('PLM_NAME');
return parent::uninstall();

}

 

 

Do, you don't need to call it twice.

Link to comment
Share on other sites

Where i am calling it twice ?

 

You should do it this way:

public function install()
{
    if (!parent::install() ||
        !$this->installDB() ||
        !$this->registerHook('header') ||
        !$this->registerHook('displayProductButtons') ||
        !Configuration::updateValue('PLM_NAME', 'tal2pl') ||
        !Configuration::get('PS_LANG_DEFAULT')) {
        return false;
    }

    return true
}

public function uninstall()
{
    if (!parent::uninstall() ||
        !Configuration::deleteByName('PLM_NAME')) {
        return false;
    }

    return true;
}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...