Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2012
    Posts
    18
    Plugin Contributions
    0

    Default Addin Repeat Customers in Admin -> Customers -> Orders.php

    Couldn't find much info that was helpful in the forums regarding this issue.

    Essentially I would like to update the admin/orders.php page to display another row (e.g., between the "Status" row and "Customer Comments") that would display the total # of orders made by that customer (so a row called "Total Orders"). I would like this because it would allow me to quickly see immediately whether or not a customer is a repeat customer and how many orders they have made and whether I should prioritize shipping to them. Not that much different than the admin/stats_customers.php file.

    What steps are involved in this? I can accomplish counting total number of orders per customer in my MySQL database by doing a COUNT and GROUP function but I am lost in trying to implement this on the admin/orders.php page.

    If anyone has faced this issue before and has any solutions/plug-ins to help with this issue I would greatly appreciate it.

  2. #2
    Join Date
    Apr 2007
    Location
    Ontario, Canada
    Posts
    1,731
    Plugin Contributions
    27

    Default Re: Addin Repeat Customers in Admin -> Customers -> Orders.php

    You'll need:
    2oz of rye... wait... ;)

    If there isn't already an order total SQL query, you'll need to make one.

    It will tally up the orders by customer and output the total.

    The rest is remarkably easy... output the number beside a newly defined CUST_ORDERS_TOTAL in the right side split summary.
    Twitch.
    https://www.twitchtoo.com Do you work for free? Please donate.
    Twitch Base8 - Obsidian - This, is what's new.

  3. #3
    Join Date
    Dec 2007
    Location
    Payson, AZ
    Posts
    1,076
    Plugin Contributions
    15

    Default Re: Addin Repeat Customers in Admin -> Customers -> Orders.php

    Quote Originally Posted by fabburl View Post
    Couldn't find much info that was helpful in the forums regarding this issue.

    Essentially I would like to update the admin/orders.php page to display another row (e.g., between the "Status" row and "Customer Comments") that would display the total # of orders made by that customer (so a row called "Total Orders"). I would like this because it would allow me to quickly see immediately whether or not a customer is a repeat customer and how many orders they have made and whether I should prioritize shipping to them. Not that much different than the admin/stats_customers.php file.

    What steps are involved in this? I can accomplish counting total number of orders per customer in my MySQL database by doing a COUNT and GROUP function but I am lost in trying to implement this on the admin/orders.php page.

    If anyone has faced this issue before and has any solutions/plug-ins to help with this issue I would greatly appreciate it.
    simple to do by record counting...
    Add a define at the bottom of admin/lincludes/languages/english/orders.php
    Code:
    define('TABLE_HEADING_TOTAL_ORDERS', 'Total Orders');
    in admin/orders.php add two section of code (line numers may be differnt in your version then mine due to addons) around line 792.. add the bold red line of code.
    Code:
          <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_STATUS; ?></td>
                    <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_TOTAL_ORDERS; ?></td>
                    <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_CUSTOMER_COMMENTS; ?></td>
    Around line 916 add the bold line
    Code:
                    <td class="dataTableContent" align="right"><?php echo $orders->fields['orders_status_name']; ?></td>
                    <td class="dataTableContent" align="center"><?php
                    $customers_orders = $db->Execute("select orders_id, date_purchased, customers_id from " . TABLE_ORDERS . " where customers_id='" . $orders->fields['customers_id'] . "' order by date_purchased desc");
                    echo $customers_orders->RecordCount() ; ?></td>
                    <td class="dataTableContent" align="center"><?php echo (zen_get_orders_comments($orders->fields['orders_id']) == '' ? '' : zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', TEXT_COMMENTS_YES, 16, 16)); ?></td>
    if you don't use an editor that auto backs up your file, then make sure you create a backup before you begin editing!
    Dave
    Always forward thinking... Lost my mind!

  4. #4
    Join Date
    Sep 2012
    Posts
    18
    Plugin Contributions
    0

    Default Re: Addin Repeat Customers in Admin -> Customers -> Orders.php

    Awesome, thanks Dave! very easily implemented and works perfectly despite me being a newbie to php and mysql. Only thing that is confusing me is that the table the customer orders count is appearing is has the text "Customer Comments" - although that is a minor problem. Perhaps that is because I have the SuperOrders plugin already installed. I will test out on a fresh install.

    Now that I have the code I think I am going to put it on other files.

 

 

Similar Threads

  1. v155 Customers Comments Don't Show In Admin orders.php
    By bottyz in forum Upgrading to 1.5.x
    Replies: 12
    Last Post: 8 Oct 2017, 11:09 PM
  2. v151 Need repeat customers to not input details on subsequent orders
    By leptserkhan in forum Managing Customers and Orders
    Replies: 1
    Last Post: 24 May 2013, 02:18 AM
  3. edit for customers in admin/customers.php not saving my changes
    By shellbell in forum Managing Customers and Orders
    Replies: 4
    Last Post: 21 Jul 2010, 04:27 AM
  4. Repeat Customers Shown In Admin :)
    By tracstev in forum Basic Configuration
    Replies: 4
    Last Post: 3 May 2010, 01:15 AM

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