Dagostino Posted January 19, 2016 Share Posted January 19, 2016 (edited) Hello, i come to you because i want to add a column in customer list wich give the number of order than a customer made. Like the screen : I know the modification is in the AdminCustomersController but i cant figure out how make it work. I tried use the value total_orders but it's not working, it say "unknown column in field list"... Im using presta 1.5.4.1 If someone can help me please, it ll be appreciate... thank's to every one and sorry for my bad english Edited January 19, 2016 by Dagostino (see edit history) Link to comment Share on other sites More sharing options...
Dagostino Posted January 20, 2016 Author Share Posted January 20, 2016 Someone can help me please ? Link to comment Share on other sites More sharing options...
Toinou_74 Posted January 22, 2016 Share Posted January 22, 2016 (edited) I will try to help you, could you paste your AdminCustomersController code.. Edited January 22, 2016 by Toinou_74 (see edit history) Link to comment Share on other sites More sharing options...
Dagostino Posted January 22, 2016 Author Share Posted January 22, 2016 Thank you (ou merci ) I upload the file, it's more easy for you (because more than 900 lines.) it's ok ? Line 116, i just write 'order', it's here i need to modify the variable... i tried with total_orders but didnt work, i think i have something to legge more. thank's again ! AdminCustomersController.php Link to comment Share on other sites More sharing options...
Toinou_74 Posted January 22, 2016 Share Posted January 22, 2016 (edited) voila, ca devrais etre bon... (SELECT COUNT(*) FROM '._DB_PREFIX_.'orders o where o.valid =1 AND (o.id_customer = a.id_customer)) AS orders'; attention j'ai changé order par orders ligne 117, car order en sql c'est une commande... ca le fait moyen... J'aime pas trop mettre un "SELECT" comme J'ai fais mais ca marche... je pense que l'on pourait faire ca en LEFT JOIN J'espere que je réponds a ta question... ligne 70 : $this->_select = ' a.date_add, IF (YEAR(`birthday`) = 0, "-", (YEAR(CURRENT_DATE)-YEAR(`birthday`)) - (RIGHT(CURRENT_DATE, 5) < RIGHT(birthday, 5))) AS `age`, ( SELECT c.date_add FROM '._DB_PREFIX_.'guest g LEFT JOIN '._DB_PREFIX_.'connections c ON c.id_guest = g.id_guest WHERE g.id_customer = a.id_customer ORDER BY c.date_add DESC LIMIT 1 ) as connect, (SELECT COUNT(*) FROM '._DB_PREFIX_.'orders o where o.valid =1 AND (o.id_customer = a.id_customer)) AS orders'; $this->fields_list = array( 'id_customer' => array( 'title' => $this->l('ID'), 'align' => 'center', 'width' => 20 ), 'id_gender' => array( 'title' => $this->l('Title'), 'width' => 70, 'align' => 'center', 'icon' => $genders_icon, 'orderby' => false, 'type' => 'select', 'list' => $genders, 'filter_key' => 'a!id_gender', ), 'lastname' => array( 'title' => $this->l('Last name'), 'width' => 'auto' ), 'firstname' => array( 'title' => $this->l('First Name'), 'width' => 'auto' ), 'email' => array( 'title' => $this->l('Email address'), 'width' => 140, ), 'Company' => array( 'title' => $this->l('Company'), 'width' => 140, ), 'SIRET' => array( 'title' => $this->l('SIRET'), 'width' => 140, ), 'orders' => array( 'title' => $this->l('Coms'), 'width' => 60, ), Edited January 22, 2016 by Toinou_74 (see edit history) Link to comment Share on other sites More sharing options...
Dagostino Posted January 25, 2016 Author Share Posted January 25, 2016 Yes tu gères parfaitement...merci beaucoup !! Link to comment Share on other sites More sharing options...
Toinou_74 Posted January 25, 2016 Share Posted January 25, 2016 Prestashop Power... www.Atelier-abz.fr Mets ton post en RESOLU Link to comment Share on other sites More sharing options...
xavyeah Posted August 11, 2016 Share Posted August 11, 2016 Bonjour, c'est possible de faire cela avec un override dans /override/controllers/admin > AdminCustomersController.php ?? Merci de votre retour 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