Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2005
    Location
    Vic, Oz
    Posts
    1,905
    Plugin Contributions
    5

    Default 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

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default 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:
    PHP Code:
          $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 ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: new customer or repeat customer

    This is actually a little faster to obtain the count:
    PHP Code:
          $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 ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 

Similar Threads

  1. Repeat Customer Notification
    By Tool Pusher in forum Managing Customers and Orders
    Replies: 0
    Last Post: 15 Feb 2010, 08:19 PM
  2. Strange repeat customer issue?!
    By jill8026 in forum General Questions
    Replies: 1
    Last Post: 22 May 2008, 09:15 PM
  3. ****Repeat customer notification ( My end )
    By boston in forum General Questions
    Replies: 0
    Last Post: 15 Mar 2008, 09:42 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR