Jump to content

Utilisation du pattern MVC pour les modules 1.6 du back-office


Recommended Posts

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...