Jump to content

Best way to develop a module and to avoid conflicting with other modules/themes and for easy updates


Recommended Posts

I am trying to make changes to a PrestaShop site for someone. I believe the best way to make the changes is by making a module they can install.


This module will be extending ProductCore with Product and it requires changes to templates.


I want to make the module so that it doesn't conflict with existing and future modules for the site!! (as well, the module should be easy to change)


Is this an impossible goal? What are the best practices with this thought in mind?


I want the client to be able to add different styling themes to the PrestaShop without conflicts with the module, too.


Thank you!

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

I forgot to mention that Magento seems to have some similarities to PrestaShop.


I think the points made in them are applicable to PrestaShop, like how with modules overriding the same class but only one taking precedence over the other one, leaving the other's functionality gone.


It's solution of combining the class of each module may be obvious but is still a good one and its nice to see someone voicing this because hard to find things like it online...

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...

So. There is a specific way to avoid conflicts?.


I don't know if there is a way, but i have been searching for this case on google and can't find nothing. Really how a module developer could imagin a future use os his module core classes and methods overrides by other modules. I think this is a question to aks to Prestashop Core Developers. What we have to do? I think may we need a mechanism to detect other modules overrides. Prestashop have to inform us, in installation time, that a module has overrides on same class methods that you. You will have to declare your method (or an alternative method) in a way given by Prestashop, to tell Prestashop that you can provide a override for this module override that causes the conflict, also taking count of modules versión, so that Prestachop will be able to install a coorect override.


This will not resolve the problem the first time, but give developers a way to resolve this problem for his clients. A client only have to inform to developers module of their connflict with other module versión. Developers will have a way to solve this problem rewriting a combination of two methods.


If Prestashop could get us this mechanism, we can develop our modules wuth a standar override methods and methods for override in case that certains modules versions are present.


I have to Note that also this solution have a drawback, how to override module over override module over override module ... (But this could be adressed in the same maner, if we know that the last installed module have to provide a methos for the previous non standar method solution provided by the previous developer to could override). Althought this could be infinite, i think that rarely we will have trhee or four modules with conflicts in the same part of code.


PD: The only problem is define a legal clausule thtt permit modules developer use only in this case a certaint part of code from other author to recombine in a solution for module conflicts.

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...