Jump to content

[Sql] User Group Column To Customers List


Recommended Posts

Hello Everyone,

 

Can somebody help me to add a new column to Customers list?

The column contains the customers' group id. (It would be great if the group name would be shown instead of the id)
(SITEURL/ADMINFOLDER/index.php?controller=AdminCustomers&token=TOKEN)

 

Here is the default SQL:

SELECT
	a.`id_customer`, `firstname`, `lastname`, `email`, a.`active` AS `active`, `newsletter`, `optin`,  a.date_add, 
	gl.name as title, (
		SELECT SUM(total_paid_real / conversion_rate)
		FROM ps_orders o
		WHERE o.id_customer = a.id_customer
		AND o.id_shop IN (1) 
		AND o.valid = 1
	) as total_spent, (
		SELECT c.date_add FROM ps_guest g
		LEFT JOIN ps_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
	FROM `ps_customer` a 
	LEFT JOIN ps_gender_lang gl ON (a.id_gender = gl.id_gender AND gl.id_lang = 1) 
	WHERE 1  AND a.`deleted` = 0 
	ORDER BY `date_add` DESC

The field that i wanted to show is located in: ps_customer_group and its the id_group

 

Thanks in advance

 

 

 

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