jafakash cp Posted June 9, 2017 Share Posted June 9, 2017 hi , is it possible to call front controller method from a tpl anchor tag? from href call i need to call front controller method . Solution needed for prestashop 1.7 version Link to comment Share on other sites More sharing options...
Knowband Plugins Posted June 9, 2017 Share Posted June 9, 2017 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. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now