Jump to content

How to override Prestashop 1.6 Referral Program module?


Recommended Posts

How to override the native Prestashop 1.6 Referral Program module?

 

I have a problem because into the referralprogram.php file there are includes like this:

include_once(dirname(__FILE__).'/ReferralProgramModule.php');

So, how to override the ReferralProgramModule.php file?

 

The only way I've found is to clone referralprogram.php file into /override and make changes into /override/ReferralProgramModule.php file, but I have to put all the functions into this file again, because it's the only way that they are loaded.

 

Another problem is that I could try to chage the "include" sentence by something like:

$handler= Module::getInstanceByName('ReferralProgramModule');

But I don't know how to pass a parameter to it. I don't know how to manage the "new" with a parameter (rererralprogram.php #257):

include_once(dirname(__FILE__).'/ReferralProgramModule.php');
.
.
.
$referralprogram = new ReferralProgramModule($id_referralprogram);

Any help? Thanks!

 

 

Share this post


Link to post
Share on other sites

Sorry, but the documentation doesn't help in this case.

 

The official Referral Program module use:

include_once(dirname(__FILE__).'/ReferralProgramModule.php');

instead of:

$handler= Module::getInstanceByName('ReferralProgramModule');

 

so it's impossible to do an override of the module! (Well, I don't know how to do it.)

Share this post


Link to post
Share on other sites

You have to read the documentation to understand the principles of overriding .

Or if you explain in detail what you want to override we will  try to give some directions.

Share this post


Link to post
Share on other sites

I think that I understand the Prestashop overriding priciples, and so, I don't know how to do the following:

 

I want to override the Referral Program Module. This module has 2 files:

 

/modules/referralprogram/referralprogram.php

/modules/referralprogram/ReferralProgramModule.php

 

I want to override a function that is into ReferralProgramModule.php

 

I can´t do the overriding of ReferralProgramModule class (using extends ReferralProgramModuleCore) because the override method of Prestashop only look for files into /override/modules which class name has {class_name}Core and the filename is identical to the module (in this case referralprogram.php)

 

And also, in the referralprogram.php there are includes to the file ReferralProgramModule.php, so the module always is going to load /modules/referralprogram/ReferralProgramModule.php instead override/module/referralprogram/ReferralProgramModule.php

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
×
×
  • Create New...

Important Information

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