Jump to content

Using Function of Controller from hook


toanloau

Recommended Posts

I have hook the same below

public function hookActionProductAdd($params){
// how to call function from Admincontroller
}

i want to get parameter from $params, and i have controller, i want call Processproduct function in hookActionProductAdd when product added.

class GetProductController extends ModuleAdminController{
public function Processproduct(){
    self::$slimit = ( int ) Configuration::get ( 'PS_COMMIT_ITEM' );
    //do something
    }

} 

but i don't know how to do it.

Link to comment
Share on other sites

class GetProductController extends ModuleAdminController{
public static function Processproduct($params){
    self::$slimit = ( int ) Configuration::get ( 'PS_COMMIT_ITEM' );
    //do something
    }

} 

and in hook use:

public function hookActionProductAdd($params){
GetProduct::Processproduct($params);
}
Link to comment
Share on other sites

  • 11 months later...
class GetProductController extends ModuleAdminController{
public static function Processproduct($params){
    self::$slimit = ( int ) Configuration::get ( 'PS_COMMIT_ITEM' );
    //do something
    }

} 

and in hook use:

public function hookActionProductAdd($params){
GetProduct::Processproduct($params);
}

 

Hello.

 

I'm trying to do the same to use a function from my module AdminController, and it can't found the class. This happens with all my modules AdminControllers. How could I solved it?.

 

This is because I want to generate some files in every productupdate.

 

Thanks.

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