Jump to content

Load different class depending on Prestashop version


Recommended Posts

Hello, I'm developing a module that needs to load on a certain hook on PS 1.6, while it will implement WidgetInterface on PS 1.7. Considering that there must be a class with the same name as the module's folder, I can create a mymodule.php that checks PS version and then includes mymodule_16.php or mymodule_17.php.
Is there any other way I can have my module load exactly the right class depending on PS version without having to add the additional mymodule.php file?

Link to comment
Share on other sites

2 hours ago, Uff182 said:

Hello, I'm developing a module that needs to load on a certain hook on PS 1.6, while it will implement WidgetInterface on PS 1.7. Considering that there must be a class with the same name as the module's folder, I can create a mymodule.php that checks PS version and then includes mymodule_16.php or mymodule_17.php.
Is there any other way I can have my module load exactly the right class depending on PS version without having to add the additional mymodule.php file?

I think this is the only way! I have the same problem with overrides, when they are different between versions.

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