kaamyi Posted July 28, 2014 Share Posted July 28, 2014 (edited) Hello,I am trying to add a view to my back office module page but i cannot display anything with the renderview() function. I can already display my list with renderList() and it's working well. I also tried renderForm() and it works well too but it seem i can't get renderView() to display something. public function renderView(){ if(!($config = $this->loadObject())){ return; } $data = Config::getDataForm(Tools::getValue('id_config')); // var_dump($data); $this->tpl_view_vars = array( 'id_config' => $data['id_config'], 'prix' => $data['prix'], 'hauteur' => $data['hauteur_passage'] ); return parent::renderView(); } This is a pretty basic code. My getDataForm($id_config) is basically getting fields from database in an array so that i can display it. I can see the var_dump displaying for a short time before displaying the blank page with prestashop header and footer. I tried to see if i was doing something wrong by checking other AdminControllers such as AdminCartsController or AdminCustomersController but it seems that their renderView() function is more or less written the same way.Thanks in advance for your help ! Edited August 1, 2014 by kaamyi (see edit history) Link to comment Share on other sites More sharing options...
kaamyi Posted July 31, 2014 Author Share Posted July 31, 2014 (edited) Nobody tried renderView()? Ok i figured out i have to create the template.. It was really not easy to find out, i wish it had been explained in the documentation so that i hadn't loose all this time trying to find the proper way to do it. Edited August 1, 2014 by kaamyi (see edit history) Link to comment Share on other sites More sharing options...
aliabc Posted August 5, 2014 Share Posted August 5, 2014 (edited) Maybe it need a file! when I try to add the follow file,it can display something.... example: $this->addRowAction('view'); on AdminAddressesController admin\themes\default\template\controllers\addresses\helpers\view\view.tpl more information you can learn from: http://doc.prestashop.com/display/PS15/Using+helpers+to+overload+a+back-office+template Edited August 5, 2014 by aliabc (see edit history) Link to comment Share on other sites More sharing options...
karthiiiiiiiiiik Posted August 13, 2014 Share Posted August 13, 2014 Hi kaamyi, With your reference from http://stackoverflow.com/questions/24995602/using-renderview-in-a-custom-moduleadmincontroller-ps1-6 i have created my own module which is having a backoffice controller file which is similar to order detail page in order page, when i click on the view link , i am getting a blank page. I followed your reference from stackoverflow and i created helpers/view/view.tpl , but i am getting nothing. Link to comment Share on other sites More sharing options...
kaamyi Posted August 13, 2014 Author Share Posted August 13, 2014 Hi karthik, I can help you but you'd have to show your code, i don't what could be wrong without it. Link to comment Share on other sites More sharing options...
karthiiiiiiiiiik Posted August 13, 2014 Share Posted August 13, 2014 hi kaamyi, i got it i have put the view.tpl file in admin/themes/default/templates/controller/mycontrollername/helpers/view/view.tpl thank you for your response, but how can we do with in the module directory. could you put your directory path of module to put the view.tpl file for a module directory. Link to comment Share on other sites More sharing options...
kaamyi Posted August 13, 2014 Author Share Posted August 13, 2014 You can put it in /modules/'nameofyourmodule'/views/templates/admin/'nameofyourmodule'/helpers/view/It should work but i use PS 1.6 so i don't know if it works with older versions 1 Link to comment Share on other sites More sharing options...
zsigmondszilveszter Posted November 18, 2015 Share Posted November 18, 2015 (edited) Hi, I am a presta newbie and I have a similar problem, I created a custom module with custom controller, then under Administration->Menus I created a new admin menu with the new module and controller. After that I created a test template file under "modules/szilveszterfirst/views/templates/admin/szilveszter_first/helpers/view/test.tpl". Everything works fine, except the renderView function, the template file is loaded(I printed out the result), but in the admin page doesn't show anything. Is there any prerequisite, that I didn't do? e.g. the template should contain something special(actually contains a few html tags for test sake)? Is this the proper way to display content in back office under a menu with module? class AdminSzilveszterFirstController extends ModuleAdminController { public function __construct() { $this->lang = false; parent::__construct(); } public function initContent(){ $this-> renderView(); return parent::initContent(); } public function renderView() { $this->base_tpl_view = 'test.tpl'; //printf("<pre>%s</pre>",print_r(parent::renderView(),true)); return parent::renderView(); } } Edited November 18, 2015 by zsigmondszilveszter (see edit history) Link to comment Share on other sites More sharing options...
rozko Posted August 17, 2018 Share Posted August 17, 2018 Hi, I have exactly the same problem as zsigmondszilveszter. Created .tpl file in a proper way. File is loaded, but it is not rendered. Have anyone resolve it? Maybe "ambassadors" will kindly help? 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