Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

How to add count of orders to customer.php

count of orders

  • You cannot reply to this topic
2 replies to this topic

#1 sedemik

  • Community Member
  • 30 posts
  • Real Name:Mikko
  • Gender:Male

Posted 09 February 2012, 08:33

I tried to add count of orders to customer.php page to list where is the date of creating account, when it is modified, date of last logon, number od logons, country of customers and number of reviews. Can anyone help me?

There is now:

$contents[] = array('text' => '<br />' . TEXT_DATE_ACCOUNT_CREATED . ' ' . tep_date_short($cInfo->date_account_created));
		$contents[] = array('text' => '<br />' . TEXT_DATE_ACCOUNT_LAST_MODIFIED . ' ' . tep_date_short($cInfo->date_account_last_modified));
		$contents[] = array('text' => '<br />' . TEXT_INFO_DATE_LAST_LOGON . ' '  . tep_date_short($cInfo->date_last_logon));
		$contents[] = array('text' => '<br />' . TEXT_INFO_NUMBER_OF_LOGONS . ' ' . $cInfo->number_of_logons);
		$contents[] = array('text' => '<br />' . TEXT_INFO_COUNTRY . ' ' . $cInfo->countries_name);
		$contents[] = array('text' => '<br />' . TEXT_INFO_NUMBER_OF_REVIEWS . ' ' . $cInfo->number_of_reviews);


#2 sedemik

  • Community Member
  • 30 posts
  • Real Name:Mikko
  • Gender:Male

Posted 09 February 2012, 09:43

I solved this, code below:

$contents[] = array('text' => '<br />' . TEXT_DATE_ACCOUNT_CREATED . ' ' . tep_date_short($cInfo->date_account_created));
		$contents[] = array('text' => '<br />' . TEXT_DATE_ACCOUNT_LAST_MODIFIED . ' ' . tep_date_short($cInfo->date_account_last_modified));
		$contents[] = array('text' => '<br />' . TEXT_INFO_DATE_LAST_LOGON . ' '  . tep_date_short($cInfo->date_last_logon));
		$contents[] = array('text' => '<br />' . TEXT_INFO_NUMBER_OF_LOGONS . ' ' . $cInfo->number_of_logons);
		$contents[] = array('text' => '<br />' . TEXT_INFO_COUNTRY . ' ' . $cInfo->countries_name);
	    $contents[] = array('text' => '<br />' . TEXT_INFO_CUSTOMERS_GROUP . ' ' . $cInfo->customers_group_id);
		$contents[] = array('text' => '<br />' . TEXT_INFO_NUMBER_OF_REVIEWS . ' ' . $cInfo->number_of_reviews);

	    // bof number of orders for each customer
	    $check_numberof_orders= tep_db_query("select count(orders_id) as total_ord from " . TABLE_ORDERS . " where customers_id = '" . $cInfo->customers_id . "'");
	    $getit = tep_db_fetch_array($check_numberof_orders);
	    $all_orders = $getit['total_ord'];
        $contents[] = array('text' => '<br />' . TEXT_INFO_NUMBER_OF_ORDERS . ' ' . $all_orders);
        // eof number of orders for each customer

Add following code to admin/includes/languages/english/customers.php
define('TEXT_INFO_NUMBER_OF_ORDERS', 'Orders:');

Edited by sedemik, 09 February 2012, 09:43.


#3 burt

  • Community Sponsor
  • 6,975 posts
  • Real Name:G Burton
  • Gender:Male
  • Location:UK/DEV/on

Posted 09 February 2012, 11:42

tep_count_customer_orders(x)
exists in the shop side, not sure about the admin side.
The Dirty Little Secrets that no osCommerce template sellers want you to know...revealed...

Support is commercially available. The question is whether you value your business
highly enough to spend money on it.

For commercial support from known developers who support osCommerce
ethos, please post at http://forums.oscommerce.com/forum/79-commercial-support/