Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Show the Total the Customer Has Spent with Store


fat_dog

Recommended Posts

Hi,

 

I'm looking for the code I need to display the total the customer has ever spent with the store. For instance, "You have spent with us in total, ?7.63".

 

Basically it is the amount as displayed in customer_stats.php in admin - but I want to be able to display it per customer in their account.

 

Can anyone help please?

Link to comment
Share on other sites

I think it's this code but needs to be modified to work, I'm pulling my hair out as it must be something simple I'm missing!

 

$customers_query_raw = "select c.customers_firstname, c.customers_lastname, sum(op.products_quantity * op.final_price) as ordersum from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS . " o where c.customers_id = o.customers_id and o.orders_id = op.orders_id group by c.customers_firstname, c.customers_lastname order by ordersum DESC";

<?php echo $currencies->format($customers['ordersum']); ?>

Link to comment
Share on other sites

Ah yes, that's the contrib I am wanting the code for :D

 

I have created a new page detailing the discount levels we offer (account_rewards.php) and want to be able to pull in the amount the customer has spent in total to show on this page.

 

I've looked through the contrib but can't work out why when I request the page to try and show the same info, it returns ?0.00.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...