Jump to content

Check if another module is installed


Tomas Jancik
 Share

Recommended Posts

  • 1 year later...

Not so hard to find, just search in Module class and you will find this :

 

if (Module::isInstalled('XXX'))

 

Here is example code I use during module installation:

 

if (Module::isInstalled(modulenamelowercase))
{
 Module::disableByName($this->name);   //note during testing if this is not done, your module will show as installed in modules
 die(Tools::displayError('You must first un-install Module xxxx'));
}

Share this post


Link to post
Share on other sites

  • 1 year later...
  • 4 months later...

I came across this thread trying to find the way to check if a module is enabled, not installed, so I leave here the info just in case someone else need it:

Module::isEnabled('modulename')

This function is available from Ps 1.5.0.13 onwards. For prior versions you can only check if module is installed with

Module::isInstalled('modulename')
Edited by joseantgv (see edit history)
  • Like 4

Share this post


Link to post
Share on other sites

  • 1 month later...

 

I came across this thread trying to find the way to check if a module is enabled, not installed, so I leave here the info just in case someone else need it:

Module::isEnabled('modulename')

 

Thank you very much joseantgv, it works great for me ;)

Share this post


Link to post
Share on other sites

  • 5 months later...
  • 10 months later...

 

I'm making responsive product tabs. I'd like to display this tab if crossselling is enabled. What would be the code?

{if Module::isEnabled('crossselling')}...{/if}

 

Is it Smarty code or just a typo? If it is, why don't you check if module is enabled at hook function?

Share this post


Link to post
Share on other sites

It's smarty for product.tpl using bootstrap nav tabs. I'm still learning. I tried to find documentation before posting to the forum.

 

I would check if module is installed in PHP code and send it as a variable to smarty.

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More