Jump to content

Ajout de la colonne employés dans le tableau commandes


Recommended Posts

PS 1.6.1.2

Bonjour à Tous,

 

Pour ajouter la colonne "employé" dans le tableau des commandes admin, j'ai crée un override de AdminOrdersController et modifié ainsi la requête du constructeur :

        $this->_select = '
		a.id_currency,
		a.id_order AS id_pdf,
		a.id_cart,
		CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`,
		c.email,
		address.phone,
		address.phone_mobile,
		osl.`name` AS `osname`,
		os.`color`,
		oh.id_employee, //ligne ajoutée
		e.firstname AS prenom_employee, //ligne ajoutée
		IF((SELECT so.id_order FROM `'._DB_PREFIX_.'orders` so WHERE so.id_customer = a.id_customer AND so.id_order < a.id_order LIMIT 1) > 0, 0, 1) as new,
		country_lang.name as cname,
		IF(a.valid, 1, 0) badge_success';
		
		//$this_select .= ',';

        $this->_join = '
		LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`)
		INNER JOIN `'._DB_PREFIX_.'address` address ON address.id_address = a.id_address_delivery
		INNER JOIN `'._DB_PREFIX_.'country` country ON address.id_country = country.id_country
		INNER JOIN `'._DB_PREFIX_.'country_lang` country_lang ON (country.`id_country` = country_lang.`id_country` AND country_lang.`id_lang` = '.(int)$this->context->language->id.')
		LEFT JOIN `'._DB_PREFIX_.'order_history` oh ON (oh.`id_order_state` = a.`current_state`) // ligne ajoutée
		LEFT JOIN `'._DB_PREFIX_.'employee` e ON (oh.`id_employee` = e.`id_employee`) // ligne ajoutée
		LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = a.`current_state`)
		LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = '.(int)$this->context->language->id.')';

Mais j'ai planté gravement mon localhost...

Une idée ? D'avance merci.

Edited by renaud2263 (see edit history)
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...