Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2010
    Posts
    56
    Plugin Contributions
    0

    Default Tracking customer transaction number

    I would like to track how many orders a customer has made. The reason is that we would like to send a new customer kit with the first order, special promotional material with subsequent orders or even a small gift when a customer reaches a milestone. I know we can review each customer's history manually but that is not easy. It would be beneficial if there was a way to print a customer's number of orders on their invoice some where. Any suggestions?

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,973
    Plugin Contributions
    96

    Default Re: Tracking customer transaction number

    Do you want the count of all orders that the customer has placed or the count of orders that the customer has paid for? What if the customer indicated that they were going to pay by check/moneyorder but the check never arrived? What if the customer placed an order that was subsequently refunded?

  3. #3
    Join Date
    Dec 2010
    Posts
    56
    Plugin Contributions
    0

    Default Re: Tracking customer transaction number

    We only accept instant transactions through CC or PayPal, so those numbers would be the same. Even if a customer has received a full or partial refund for a previous order the tally should be the same. A new customer should get a welcome packet and repeat customers would be entitled to coupons, even if they chose to return a product for some reason. Actually we get very few returns but rather an occasional exchange if an item is broken or of the wrong size. I'm happy to be "pretty" close in the calculation.

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,973
    Plugin Contributions
    96

    Default Re: Tracking customer transaction number

    From the admin's invoice.php, you can add the following code just above the ?> above the <doctype statement:
    Code:
      $c_info = $db->Execute("SELECT customers_id FROM " . TABLE_ORDERS . " WHERE orders_id = " . (int)$oID);
      $cID = ($c_info->EOF) ? 0 : $c_info->fields['customers_id'];
      $order_count = $db->Execute("SELECT count(*) as count FROM " . TABLE_ORDERS . " WHERE customers_id = $cID");
    and then modify this fragment further down
    Code:
      <tr>
        <td><table border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main"><strong><?php echo ENTRY_DATE_PURCHASED; ?></strong></td>
            <td class="main"><?php echo zen_date_long($order->info['date_purchased']); ?></td>
          </tr>
          <tr>
            <td class="main"><b><?php echo ENTRY_PAYMENT_METHOD; ?></b></td>
            <td class="main"><?php echo $order->info['payment_method']; ?></td>
          </tr>
        </table></td>
      </tr>
    to include
    Code:
      <tr>
        <td><table border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main"><strong>Number of orders:</strong></td>
            <td class="main"><?php echo $order_count->fields['count']; ?></td>
          </tr>
          <tr>
            <td class="main"><strong><?php echo ENTRY_DATE_PURCHASED; ?></strong></td>
            <td class="main"><?php echo zen_date_long($order->info['date_purchased']); ?></td>
          </tr>
          <tr>
            <td class="main"><b><?php echo ENTRY_PAYMENT_METHOD; ?></b></td>
            <td class="main"><?php echo $order->info['payment_method']; ?></td>
          </tr>
        </table></td>
      </tr>

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

    Default Re: Tracking customer transaction number

    Quote Originally Posted by lat9 View Post
    From the admin's invoice.php, you can add the following code just above the ?> above the <doctype statement:
    Code:
      $c_info = $db->Execute("SELECT customers_id FROM " . TABLE_ORDERS . " WHERE orders_id = " . (int)$oID);
      $cID = ($c_info->EOF) ? 0 : $c_info->fields['customers_id'];
      $order_count = $db->Execute("SELECT count(*) as count FROM " . TABLE_ORDERS . " WHERE customers_id = $cID");
    There is some downside with this as it depends on when the invoice is printed.
    If the customer places 3 orders at the same time when you come to print them they will all have "3" on them.
    I use a different method that generates a list of their orders and determines the position of that order in their total orders.
    If the customer has only placed one order it is labelled as a "New Customer"
    If the customer has placed 3 as above.
    The first will be labelled 1 of 3
    The second 2 of 3
    The third 3 of 3.
    Over time the numbering will change but you will always know when viewing the order the current status of the customer. (I also display this on the orders page)

  6. #6
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Tracking customer transaction number

    I don't see a downside for the OP's purposes. All that is important is the current total number of orders, and if when they are printed out there are three invoices and the total reads "3", it should be obvious that the customer is new. It doesn't seem likely if the orders are attended to regularly that confusion would ever arise.

  7. #7
    Join Date
    Dec 2010
    Posts
    56
    Plugin Contributions
    0

    Default Re: Tracking customer transaction number

    I have implemented this code but unfortunately, when try to open the invoice I just get a blank page. Since coding is beyond my abilities, I have had to remove it.

 

 

Similar Threads

  1. Postal Tracking Number......
    By coffee23 in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 28 May 2010, 12:27 PM
  2. Replies: 1
    Last Post: 21 Mar 2007, 07:50 PM

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