piotr.petrasz Posted September 3, 2015 Share Posted September 3, 2015 Hi Everyone, I have a simple question associated with creating modules.... Tutorial on PrestaShop website and other infos available on the Internet have a one method to create module and connect them with controller eg. XXX extends ModuleFrontController - by create a link from displayed template to another template which is called by setTemplate... my question is how to connect the first template, called from modules/mymodule.php clause: public function hookdisplayHome($params) { return $this->display(__FILE__, 'furniturefind_form.tpl'); } I would like to have furniturefind_formFrontModuleController extends ModuleFrontController connected with this template. Thanks in advance for your attention and help, Peter Link to comment Share on other sites More sharing options...
vekia Posted September 3, 2015 Share Posted September 3, 2015 let's explain something.you've got module controller filer located in /controllers/ directory, right?now you want to display a template from this controller? Link to comment Share on other sites More sharing options...
piotr.petrasz Posted September 3, 2015 Author Share Posted September 3, 2015 Hi, thank you for your answer. I have module controller located in modules directory. I`ve created a new module (FurnitureFind) with main file furniturefind.php which contains base classe furniturefind extends Module. And then in: public function hookdisplayHome($params) { return $this->display(__FILE__, 'furniturefind_form.tpl'); } i would like to present this tpl in home page. This tpl contains my form (3 buttons). To handle to action for this buttons I need to have FrontController conected with this template, and I don`t know how to do it. As an attachement you can find my module directory. Regards, Peter furniturefind.zip Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted September 8, 2015 Share Posted September 8, 2015 (edited) hi..if you have display front tpl then you can register the hook of your modules install method. public function install() { if (Shop::isFeatureActive()) Shop::setContext(Shop::CONTEXT_ALL); return parent::install() && $this->registerHook('home') && $this->registerHook('header') && Configuration::updateValue('FurnitureFind', ''); } and display the modules tpl file thios way public function hookdisplayHome($params) { return $this->display(__FILE__, 'furniturefind_form.tpl'); } above hook home and uts display your tpl filethanks. Edited September 8, 2015 by Nishith (see edit history) 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