You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
Pages: 1
Where would I find the sql code which pulls this information from the database? I need to alter it to return the top 30, 40 and 50 customers. As it stands now it returns the top 20.
I also want to write a sql statement that can go into our database and assign a number of loyalty points to everyone in our database. The quantity of loyalty points would be a percentage of their total purchases. We have 15,000 + customers and I don't really want to do this by hand. :-)
Thanks in advance Nick. I appreciate your help as always.
:-)
Offline
To bump the top customers report from 20 to 50, adjust the count for the SQL statement in the file {private}/apps/ecom/ECOM/includes/reportsadv_customersordtotalstop20.php:
'count' => 20
As far as updating customers with loyalty points totals matching their order totals, you'll need to update a bunch of fields. Something like this (would issue 10% of order totals as loyalty points on completed orders):
UPDATE core_users, (SELECT email, SUM(ordertotal) AS grandtotal FROM ecom_orders WHERE status='C' GROUP BY email) AS orders SET core_users.loyaltypoints=(orders.grandtotal*.10) WHERE core_users.id=orders.email
Offline
Thank you Sir!
Offline
Pages: 1