Jump to content

[PS 1.6] Extend capabilities through module


perarg

Recommended Posts

Hello,

i am creating a module which already add a column in an existing db table. More specific, in `stock_available` table i add a column let's call it quantity2. So far so good.

My need, among others, is to edit controllers/admin/AdminProductsController.php at about line 185-187 and make some little changes at $this->_select variable. So just for testing purposes i changed that and everything works as i expected.

My problem is that i don't want to edit that file directly neither make some kind of override. I want a more safe solution only through the module. That is to say, when the module is installed the changes are applied. When the module is uninstalled everything goes back to normal.

How is the more appropriate way to achieve that ?

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

Hi...


i say the override is your custom module folder not in prestashop directory override folder.

when you install the module the override use in your module folder and when you uninstall module then everything working is normal.

 

if (Module::isInstalled(modulenamelowercase))
{
//your code here
}


Thanks

Link to comment
Share on other sites

Please read the warning at this page http://doc.prestashop.com/display/PS16/Overriding+default+behaviors

It is clearly says "Overrides in PrestaShop are exclusive. This means that if your module overrides one of PrestaShop's behaviors, another module will not be able to use that behavior properly, or override it in an predictable way." 

That is why i asked here about a way that doesn't include overriding. I would like to create a more permanent solution and i don't want to worry for malfunction of future modules...

Link to comment
Share on other sites

19 hours ago, perarg said:

Please read the warning at this page http://doc.prestashop.com/display/PS16/Overriding+default+behaviors

It is clearly says "Overrides in PrestaShop are exclusive. This means that if your module overrides one of PrestaShop's behaviors, another module will not be able to use that behavior properly, or override it in an predictable way." 

That is why i asked here about a way that doesn't include overriding. I would like to create a more permanent solution and i don't want to worry for malfunction of future modules...

 

Yes but this is only solution with prestashop core file override.other wise you can create your module admin controller with your custom module

Thanks 

Link to comment
Share on other sites

2 hours ago, Nishith said:

other wise you can create your module admin controller with your custom module

Sorry but i don't understand what are you trying to say. Do you have an example on this ? Or is there a module that you know it work with the same functionality so to be inspired ?

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