Jump to content

Ajouter une colonne TVA / Taxe dans la liste admin 1.5 des commandes


Recommended Posts

Bonjour,

 

Je cherche à rajouter une colonne dans la liste des commandes de l’admin 1.5 pour afficher la valeur TVA de chaque commande. Je sais que je dois éditer le fichier AdminOrdersController.php, j’arrive à rajouter la colonne mais je coince à afficher les valeurs pour chaque commande.

 

Est-ce que quelqu’un aurait un tuyau ?

 

Merci

Link to comment
Share on other sites

Salut,

 

Je trouvais l'idée sympa donc j'me la suis ajoutée :D

 

Je suppose que tu parles bien du montant de TVA de chaque commande, et comme l'intérêt dans mon esprit c'est de mettre en évidence les commandes à l'export qui ont 0€ de TVA et qui méritent donc un peu plus notre attention, j'ai un peu amélioré l'idée de base ;)

 

Donc en effet, dans AdminOrdersController.php :

		$this->_select = '
		a.id_currency,
		a.id_order AS id_pdf,
		CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`,
		osl.`name` AS `osname`,
		os.`color`,
		IF((SELECT COUNT(so.id_order) FROM `'._DB_PREFIX_.'orders` so WHERE so.id_customer = a.id_customer) > 1, 0, 1) as new';
		//zebx <--
		$this->_select .= ', IF((total_paid_tax_incl - total_paid_tax_excl) > 0, "#FCFCFC", "red") as tax_color,
		(total_paid_tax_incl - total_paid_tax_excl) as tax_amount,
		total_paid_tax_incl as total_paid_tax_incl';
		//--> zebx
		$this->_join = '
		LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`)
		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.')';
		$this->_orderBy = 'id_order';
		$this->_orderWay = 'DESC';

		$statuses_array = array();
		$statuses = OrderState::getOrderStates((int)$this->context->language->id);

		foreach ($statuses as $status)
			$statuses_array[$status['id_order_state']] = $status['name'];

		$this->fields_list = array(
		'id_order' => array(
			'title' => $this->l('ID'),
			'align' => 'center',
			'width' => 25
		),
		'reference' => array(
			'title' => $this->l('Reference'),
			'align' => 'center',
			'width' => 65
		),
		'new' => array(
			'title' => $this->l('New'),
			'width' => 25,
			'align' => 'center',
			'type' => 'bool',
			'tmpTableFilter' => true,
			'icon' => array(
				0 => 'blank.gif',
				1 => array(
					'src' => 'note.png',
					'alt' => $this->l('First customer order'),
				)
			),
			'orderby' => false
		),
		'customer' => array(
			'title' => $this->l('Customer'),
			'havingFilter' => true,
		),
		//zebx <--
		'tax_amount' => array(
			'title' => $this->l('Total Tax'),
			'width' => 70,
			'align' => 'right',
			'color' => 'tax_color',
			'type' => 'price',
			'currency' => true,
			'havingFilter' => true
		),
		//--> zebx
		'total_paid_tax_incl' => array(
			'title' => $this->l('Total'),
			'width' => 70,
			'align' => 'right',
			'prefix' => '<b>',
			'suffix' => '</b>',
			'type' => 'price',
			'currency' => true
		),

Enjoy :)

Link to comment
Share on other sites

  • 2 years later...

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...