ubik Posted May 17, 2011 Share Posted May 17, 2011 BonjourJe cherche a ordonner le listing de mes accessoires pour la page produit en fonction de leur ordre(les accessoires sont enregistrés en tant que produits dans une categorie masquée)c'est dans le fichier files/AdminProduct ligne 1896 que ca se passe ?De base c'est ordonée en fonction de leur id '; $accessories = Product::getAccessoriesLight(intval($cookie->id_lang), $obj->id); if ($postAccessories = Tools::getValue('inputAccessories')) { $postAccessoriesTab = explode('-', Tools::getValue('inputAccessories')); foreach ($postAccessoriesTab AS $accessoryId) if (!$this->haveThisAccessory($accessoryId, $accessories) AND $accessory = Product::getAccessoryById($accessoryId)) $accessories[] = $accessory; } Merci de votre aide Link to comment Share on other sites More sharing options...
ubik Posted May 18, 2011 Author Share Posted May 18, 2011 $result = Db::getInstance()->ExecuteS(' SELECT p.*, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, p.`ean13`, i.`id_image`, il.`legend`, t.`rate`, m.`name` as manufacturer_name, cl.`name` AS category_default, DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new FROM `'._DB_PREFIX_.'accessory` LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = `id_product_2` LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.intval($id_lang).') LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.intval($id_lang).') LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1) LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.intval($id_lang).') LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (p.`id_manufacturer`= m.`id_manufacturer`) LEFT JOIN `'._DB_PREFIX_.'tax` t ON t.`id_tax` = p.`id_tax` WHERE `id_product_1` = '.intval($this->id).' '.($active ? 'AND p.`active` = 1' : '')); C'et la que ce doit se trouver, dans le fichier product.phpEn somme il faudrait que je fasse un ORDER BY position of id_product dans ps_category_product DESC Link to comment Share on other sites More sharing options...
mathieu.e Posted May 22, 2011 Share Posted May 22, 2011 Bonjour, Oui en effet je pense que tu peux rajouter ORDER BY p.`id_product` Cela donnerai : [...]LEFT JOIN `'._DB_PREFIX_.'tax` t ON t.`id_tax` = p.`id_tax` WHERE `id_product_1` = '.intval($this->id).' '.($active ? 'AND p.`active` = 1' : '') ORDER BY p.`id_product`); Je n'ai pas testé, tiens nous au courant si cela marche 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