Jump to content

Number Of Orders In Customer List


Dagostino

Recommended Posts

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 :

ip0r.jpg

 

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 by Dagostino (see edit history)
Link to comment
Share on other sites


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 by Toinou_74 (see edit history)
Link to comment
Share on other sites

  • 6 months later...

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