NatasaN Posted August 25, 2015 Share Posted August 25, 2015 Hi, I'm trying to create a module for admin panel -> Store Contacts. The idea is to add just one input csv file field. I created a hook ActionAdminStoresControllersCsvUpload , and connected it with Store Contacts page by overriding this controller: AdminStoresController adding only this function: public function initContent() { parent::initContent(); Hook::exec('actionAdminStoresControllersCsvUpload'); } The next step is creating a module: uploadStoresViaCsv. The Problem Starts Here. For the beginning I want to display only text at Store Contacts page. In the module php file i added this function: public function hookActionAdminStoresControllersCsvUpload() { $helpme="Test if we are connected"; $this->smarty->assign('helpme', $helpme); return $this->display(__FILE__, 'upload_stores.tpl'); } and create in root tpl file with this code <div class="col-lg-4"> {$helpme} </div> and NOTHING is happening. I don't know why. Wen i do var_dump of $helpme in php I see the content. But when I send the value regularly, i get nothing. I think that the problem is in new hook. What do you think? Link to comment Share on other sites More sharing options...
vekia Posted August 25, 2015 Share Posted August 25, 2015 if you put die(); to the public function hookActionAdminStoresControllersCsvUpload() function does this die() freeze the page? (white page) Link to comment Share on other sites More sharing options...
NatasaN Posted August 25, 2015 Author Share Posted August 25, 2015 Yes... If i put die() or exit() the page is blank. Link to comment Share on other sites More sharing options...
vekia Posted August 25, 2015 Share Posted August 25, 2015 so it properly executing the hook and code inside action hooks aren't visible, you can "run" some code there only, like die() funciton ;-) Link to comment Share on other sites More sharing options...
NatasaN Posted August 26, 2015 Author Share Posted August 26, 2015 (edited) I change that. I created the hook hookDisplayCsvUpload. If I add this in function hookDisplayCsvUpload public function hookDisplayCsvUpload($params) { $this->smarty->assign('helper', "test me"); var_dump($this->display(__FILE__, 'views/upload_csv_form_admin.tpl')); exit(); return $this->display(__FILE__, 'views/upload_csv_form_admin.tpl'); } The result will be the form from tpl. file : string '<div class="form-group"> <label class="control-label col-lg-3"> <span class="label-tooltip" data-toggle="tooltip" data-html="true" title="" data-original-title="You can upload a maximum of 3 images."> Thumbnails </span> </label> <div class="col-lg-4"> test me </div></div>' (length=287) BUT the MAIN problem is that I dont see that content om my admin page Store Contacts. Any idea? Edited August 26, 2015 by NatasaN (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