vins Posted November 14, 2008 Share Posted November 14, 2008 Bonjour,JE dois personnaliser mon Back Office...Dans un nouvel onglet du Back Office je souhaiterais afficher la liste suivante:Soit des produits définis dans mon catalogue avec un nom de fournisseur, par exemple le fournisseur A.Je souhaiterais afficher la liste suivante: Tous les 'order_id' des commandes qui contiennent des produits du fournisseur A.La requête suivante marche très bien : SELECT o.id_order FROM `ps_orders` o, `ps_order_detail` od, `ps_product` p, `ps_supplier` s WHERE o.id_order=od.id_order AND od.product_id=p.id_product AND p.id_supplier=s.id_supplier AND s.name='A' En revanche, je n'arrive pas à créer la requête SQL du même genre que la requête PRESTASHOP ci-dessous qui affiche toutes les commandes dans l'onglet "Commandes" du BackOffice (AdminOrders.php): $this->_select = 'a.id_order AS id_pdf, CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`, osl.`name` AS `osname`, os.`color`'; $this->_join = 'LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = a.`id_customer`) LEFT JOIN `'._DB_PREFIX_.'order_history` oh ON (oh.`id_order` = a.`id_order`) LEFT JOIN `'._DB_PREFIX_.'order_state` os ON (os.`id_order_state` = oh.`id_order_state`) LEFT JOIN `'._DB_PREFIX_.'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = a.`id_lang`)'; $this->_where = 'AND oh.`id_order_history` = (SELECT MAX(`id_order_history`) FROM `'._DB_PREFIX_.'order_history` moh WHERE moh.`id_order` = a.`id_order` GROUP BY moh.`id_order`)'; L'avantage de créer une telle requette est son affichage défini dans le code qui suit (tjs dans AdminOrders.php): $this->fieldsDisplay = array( 'id_order' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'customer' => array('title' => $this->l('Customer'), 'widthColumn' => 160, 'width' => 140, 'filter_key' => 'customer', 'tmpTableFilter' => true), 'total_paid' => array('title' => $this->l('Total'), 'width' => 50, 'align' => 'right', 'prefix' => '', 'suffix' => '', 'price' => true, 'currency' => true), 'payment' => array('title' => $this->l('Payment'), 'width' => 100), 'osname' => array('title' => $this->l('Status'), 'widthColumn' => 300, 'type' => 'select', 'select' => $statesArray, 'filter_key' => 'os!id_order_state', 'filter_type' => 'int', 'width' => 200), 'date_add' => array('title' => $this->l('Date'), 'width' => 90, 'align' => 'right', 'type' => 'date', 'filter_key' => 'a!date_add'), 'id_pdf' => array('title' => $this->l('PDF'), 'callback' => 'printPDFIcons', 'orderby' => false, 'search' => false)); Si un expert pouvait m'aider...En espérant que vous comprendrez ma demande.Merci. 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