vignesvaran Posted May 6, 2017 Share Posted May 6, 2017 I creates a new custom module with the following code, It displays a list view in back office. class AdminTestController extends ModuleAdminController { public $bootstrap = true; public function __construct() { $this->table = 'test'; $this->className = 'TestData'; $this->lang = false; $this->deleted = false; $this->addRowAction('edit'); $this->addRowAction('view'); $this->fields_list = array( 'id_test' => array( 'title' => $this->l('ID'), 'align' => 'center', 'width' => 25 ), 'name' => array( 'title' => $this->l('Name'), 'width' => 'auto', ) ); $this->bulk_actions = array( 'delete' => array( 'text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?') ) ); $this->context = Context::getContext(); parent::__construct(); } public function renderForm() { /** @var Test $obj */ if (!($obj = $this->loadObject(true))) { return; } $this->fields_form = array( 'legend' => array( 'title' => $this->l('TEST') ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'size' => 33, 'required' => true ), ), 'submit' => array( 'title' => $this->l(' Save '), 'class' => 'button pull-right' ) ); return parent::renderForm(); } public function renderView() { /** @var Test $test */ if (!($test = $this->loadObject())) { return; } $data = Config::getDataForm(Tools::getValue('id_test')); // var_dump($data); $this->tpl_view_vars = array( 'id_test' => $data['id_test'], 'name' => $data['name'], ); return parent::renderView(); } } In which I have a renderView() function to show the particular list values in new page. But I get following error on the view page, Fatal error: Class 'Config' not found in /var/www/html/prestashop/modules/test/controllers/admin/AdminTestController.php on line 145 I am new to prestashop. I am using prestashop 1.6 Please help me someone to solve this issue. Thanks in advance. Link to comment Share on other sites More sharing options...
Solver Posted October 30, 2019 Share Posted October 30, 2019 The controller must be in Module/moduleName/controllers/admin folder 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