zouhairHajji Posted June 24, 2015 Share Posted June 24, 2015 Bonjour,On est un petit groupe de développeur qui souhaitent créer un module prestashop, sauf que on a pas bien maitriser comment afficher une view à l'utilisateur du Back-office Actuellement on a su comment utiliser le modèle avec le controller "extends adminController".Est ce que quelqun sait comment faire pour afficher une view.merci Link to comment Share on other sites More sharing options...
LuzoWeb Posted June 24, 2015 Share Posted June 24, 2015 Bonsoir, Peut être public function hookMy() { require_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'models'.DIRECTORY_SEPARATOR.'MyModel.php'); $model = new MyModel(); $all = $model->getAll(); $this->context->smarty->assign(array( 'datas' => $all, )); return $this->display(__FILE__, 'views/templates/admin/products/attributes.tpl'); } Link to comment Share on other sites More sharing options...
J. Danse Posted June 25, 2015 Share Posted June 25, 2015 Bonjour, Ce code exemple vous sera éventuellement utile: https://github.com/PrestaEdit/Canvas-Module-Prestashop-15/blob/master/controllers/admin/AdminExampleController.php Attention, il s'agit d'un ModuleAdminController mais c'est quasi semblable, sur le coup. Link to comment Share on other sites More sharing options...
zouhairHajji Posted June 26, 2015 Author Share Posted June 26, 2015 Merci J. Danse J'ai déjà vu ce projet sur Git, sauf que ce fichier php que vous m'avez donnez n'accede pas a la vue, il l'a genere à l'aide du modèle.Je me demande si on peut afficher une vue comme cette méthode : public function displayForm() { $this->context->smarty->assign('request_uri', Tools::safeOutput($_SERVER['REQUEST_URI'])); $this->context->smarty->assign('path', $this->_path); $this->context->smarty->assign('EXAMPLE_CONF', pSQL(Tools::getValue('EXAMPLE_CONF', Configuration::get('EXAMPLE_CONF')))); $this->context->smarty->assign('submitName', 'submit'.Tools::ucfirst($this->name)); $this->context->smarty->assign('errors', $this->errors); // You can return html, but I prefer this new version: use smarty in admin, return $this->display(__FILE__, 'views/templates/admin/configure.tpl'); } merci beaucoup Link to comment Share on other sites More sharing options...
zouhairHajji Posted June 26, 2015 Author Share Posted June 26, 2015 LuzoWeb Merci beaucoup, j'ai deja essayé ce que vous m'avez montré, mais ca ne marche pas :/ 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