Zen Cart Logo
Forums / Managing Customers and Orders / new customer or repeat customer

new customer or repeat customer

Locked

Views: 1,955

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
4 Feb 2007, 2:56 AM
#1
gilby avatar

gilby

Totally Zenned

Join Date:
Aug 2005
Location:
Vic, Oz
Posts:
1,816
Plugin Contributions:
0

new customer or repeat customer

Hi
When in orders->edit order
I would like to display under the ip address the number of orders from this customer. When I print this page it will allow us to add promotional material to the order depending on whether this is the first or additional order from this customer.

I am trying to alter /admin/orders.php to achieve this.

I have found in /admin.customers.php a query to calculate the number of orders from a customer based on the customers id.

The steps I believe I need are

  1. In /admin/orders.php I need to identify the customers id in the "edit order" display from the order id
  2. Create a query similar to the query in customers.php
  3. Display the information.

Steps 2 & 3 I think I can work out once I have the customers id.

I am stuck on step 1. Can someone point me in the direction to calculate the customers id from the order id.

My php & mysql skills are basic, so be gentle.

gilby

4 Feb 2007, 3:58 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: new customer or repeat customer

You could do a quick search for existing orders by adding to the file:
/admin/orders.php

around line 348 just before the closing ?> the following:

      $zc_customers_query = $db->Execute("select customers_id from " . TABLE_ORDERS . " WHERE orders_id = '" . $oID . "'");
      $zc_count_orders_query = $db->Execute("select count(*) as count_orders from " . TABLE_ORDERS . " WHERE customers_id = '" . $zc_customers_query->fields['customers_id'] . "'");

Now you can echo the results for:
$zc_count_orders_query->fields['count_orders']

where you like on the orders page ...

4 Feb 2007, 5:44 PM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: new customer or repeat customer

This is actually a little faster to obtain the count:

      $zc_count_orders_query = $db->Execute("select count(*) as count_orders from " . TABLE_ORDERS . " WHERE customers_id = '" . $order->customer['id'] . "'");

So you do not need both lines ...