sandra nanou Posted August 8, 2019 Share Posted August 8, 2019 (edited) Bonjour, Je cherche à modifier l'ordre des sujets dans la liste déroulante du formulaire de contact, une idée de comment procéder ? J'ai tenté un sortby dans le foreach de contactform.tpl mais j'ai une message d'erreur : {foreach from=$contact.contacts|@sortby:id item=contact_elt} Merci pour votre aide Edited August 8, 2019 by sandra nanou (see edit history) Link to comment Share on other sites More sharing options...
sandra nanou Posted August 12, 2019 Author Share Posted August 12, 2019 Personne pour m'aider ? 🤗 Link to comment Share on other sites More sharing options...
Farris27 Posted August 12, 2019 Share Posted August 12, 2019 Version de prestashop, php ? Le message d'erreur ? Bien à toi Link to comment Share on other sites More sharing options...
sandra nanou Posted August 12, 2019 Author Share Posted August 12, 2019 Merci pour votre message ! Je suis sur un prestashop 1.7.5.2 et le message d'erreur est le suivant : "Syntax error in template "file:/var/www/prestashop/themes/montheme/modules/contactform/views/templates/widget/contactform.tpl" on line 70 " {foreach from=$contact.contacts|@sortby:id item=contact_elt}" unknown modifier 'sortby'" Link to comment Share on other sites More sharing options...
sandra nanou Posted August 13, 2019 Author Share Posted August 13, 2019 Peut être qu'il faut le faire dans contactform.php ?? Link to comment Share on other sites More sharing options...
Alexandre Carette Posted August 20, 2019 Share Posted August 20, 2019 Bonjour, pourquoi ne pas overrider les fonctions de Contact.php avec un ORDER BY /** * Return available contacts. * * @param int $idLang Language ID * * @return array Contacts */ public static function getContacts($idLang) { $shopIds = Shop::getContextListShopID(); $sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'contact` c ' . Shop::addSqlAssociation('contact', 'c', false) . ' LEFT JOIN `' . _DB_PREFIX_ . 'contact_lang` cl ON (c.`id_contact` = cl.`id_contact`) WHERE cl.`id_lang` = ' . (int) $idLang . ' AND contact_shop.`id_shop` IN (' . implode(', ', array_map('intval', $shopIds)) . ') GROUP BY c.`id_contact` ORDER BY `name` ASC'; return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); } /** * Return available categories contacts. * * @return array Contacts */ public static function getCategoriesContacts() { $shopIds = Shop::getContextListShopID(); return Db::getInstance()->executeS(' SELECT cl.* FROM ' . _DB_PREFIX_ . 'contact ct ' . Shop::addSqlAssociation('contact', 'ct', false) . ' LEFT JOIN ' . _DB_PREFIX_ . 'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = ' . (int) Context::getContext()->language->id . ') WHERE ct.customer_service = 1 AND contact_shop.`id_shop` IN (' . implode(', ', array_map('intval', $shopIds)) . ') GROUP BY ct.`id_contact` '); cordialement 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