Jump to content

MODIFIER UNE REQUETE


Recommended Posts

JE CHERCHE A MODIFIER UNE REQUETE DANS LE FICHIER ADMINORDERS.PHP A LA LIGNE 38.

MAIS LA RÉSULTAT INVALIDE REQUÊTE.

JE VEUX BIEN AJOUTER UNE AUTRE CONDITION POUR AFFICHER LES COMMANDES RELATIVES A UN FOURNISSEUR A.
ALORS J'AI AJOUTE UNE TABLE COMTENANT LES PRODUITS AJOUTER DE CHAQUE FOURNISSEURS.

COMMENT FAIRE UNE REQUETE DANS CETTE CONDTION. MERCI BIEN.

Link to comment
Share on other sites

Merci,
bien le but est de faire une restriction pour l'affichage des commandes; car j'ai ajouté reussis d'afficher les pdts pour chaque fournisseur est ce là par l'ajout d'une table nommé "ps_access_product"(id_employee,id_product );
Alors, les commandes sont toutes affichées je veux faire pour chaque employée qui a un compte est responsable a ces commandes; donc la requete est dans le fichiers adminorders.php en ligne 34 sous admin/tabs /


$this->table = 'order';
$this->className = 'Order';
$this->view = 'noActionColumn';
$this->colorOnBackground = true;
$this->_select = '
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 AND so.valid = 1) > 1, 0, 1) as new,
(SELECT COUNT(od.`id_order`) FROM `'._DB_PREFIX_.'order_detail` od WHERE od.`id_order` = a.`id_order` GROUP BY `id_order`) AS product_number';

$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` = '.intval($cookie->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`)';

j'aime bien ajouté une condition comme ce là:

LEFT JOIN `'._DB_PREFIX_.'access_product` ap ON (ap.`id_product` = od.`product_id`);


Merci

Link to comment
Share on other sites

Quand tu écrit un message tu as un bouton code au dessus tu clique dessus et ca fait :

$this->table = 'order';
$this->className = 'Order'; 
$this->view = 'noActionColumn'; 
$this->colorOnBackground = true;

$this->_select = ' a.id_order AS id_pdf, CONCAT, \'. \', c.`lastname`) AS `customer`, osl.`name` AS `osname`, os.`color`, 
IF((SELECT COUNT FROM `'.DB_PREFIX.'orders` so WHERE so.id_customer = a.id_customer AND so.valid = 1) > 1, 0, 1) as new, 
(SELECT COUNT FROM `'.DB_PREFIX.'order_detail` od WHERE od.`id_order` = a.`id_order` GROUP BY `id_order`) AS product_number'; 

$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` = '.intval($cookie->id_lang).')
LEFT JOIN `'.DB_PREFIX.'access_product` ap ON (ap.`id_product` = od.`product_id`)'; 


$this->where = 'AND oh.`id_order_history` = (SELECT MAX FROM `'._DB_PREFIX.'order_history` moh WHERE moh.`id_order` = a.`id_order` GROUP BY moh.`id_order`)'; 



C'est nettement plus propre

Et je t'ai rajouter ta commande mais je pense qu'il faut aussi la rajouter dans le where !!!
A tester
a+

Link to comment
Share on other sites

merci, encore invalide requête .Je cherche a affiché les commandes relatives en employés (chaque employe ajouter un ou +pdts). le but est d'afficher les commandes pour chaque employe.

Je vous remercie, si t'as une proposition ou une solution.Merci bien

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