Jump to content

[TIP] 1.5 Module writing for Non-Hook Logic in MultiShop (by shop enable)


El Patron

Recommended Posts

In 1.5 we can write (and should write) our modules to work in the 1.5 multishiop, environment.

 

That is to say enabled on one or more shops but possibly disabled on others and is congifured by the shop owner via moudle-->configuration

 

Your 1.5 module should be configurable, even if you have no module configuration as this allows the shop owner to enable your module by shop if they so choose.

and requires an additional function in your module:

 

public function getContent()
{
return;
}

 

 

1.5 module hooks are taken care of us by PrestaShop, i.e. the hook is not executed unless the module is enabled for that shop.

 

Some logic however must be coded, for class overrides as they are executed for every shop.

 

A solution: (there may be others)

 

if (Module::isEnabled('yourModuleClassName'))
{
your custom code goes here.
}

 

happy developing...

Edited by elpatron (see edit history)
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...