Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

count the # of customer's orders


Guest

Recommended Posts

in this query:

  $siu_query_raw = "select ci.customers_info_date_of_last_logon, c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, c.customers_newsletter, c.customers_telephone from " . TABLE_CUSTOMERS_INFO . " ci, " . TABLE_CUSTOMERS . " c left join " . TABLE_ORDERS . " o on c.customers_id = o.customers_id where o.customers_id is NULL and c.customers_id = ci.customers_info_id order by c.customers_lastname";
 $siu_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $siu_query_raw, $siu_query_numrows );
 $siu_query = tep_db_query($siu_query_raw);

how can i output the number of orders?

Link to comment
Share on other sites

  • 2 weeks later...

This does not seem to be a correct query. customers_id in orders table are not "null"

 

$siu_query_raw = "select ci.customers_info_date_of_last_logon, c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, c.customers_newsletter, c.customers_telephone from " . TABLE_CUSTOMERS_INFO . " ci, " . TABLE_CUSTOMERS . " c left join " . TABLE_ORDERS . " o on c.customers_id = o.customers_id where o.customers_id is NULL and c.customers_id = ci.customers_info_id order by c.customers_lastname";
Link to comment
Share on other sites

odd, i never noticed that. i pulled this code from a contribution i'm using..

 

and i deleted:

where o.customers_id is NULL

 

which seemed to have worked, cause the database stopped responding for a bit (the database is HUGE)

 

is there a way to lessen the load while still grabbing the order counts?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...