Jump to content

calling controller method from href tag in tpl prestashop 1.7


jafakash cp

Recommended Posts

Hi,

 

Just include the front controller class file into the file which is rendering TPL file as follows:

 

 

include_once(_PS_MODULE_DIR.'yourmodule/controllers/front/yourcontroller.php);

 

class YourSecondFrontControllerClass extends YourControllerClass

 



{


---- CODE HERE ------


}


And then you can call the function of parent controller using the following syntax. 

 

{YourParentController::testFunction()}

 

---------------------------------------------------------------------------------------------------------

 

 

Other option is that you can make a duplicate function in the controller rendering the TPL tile and then can directly call the function as follows:

 

{YourMainFrontController::testFunction()}

 

Note: The function that you want to call should be a public static function.

 

 

I hope this helps. Please feel free to ask in case of any query or issue.

  • Like 1
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...