Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2006
    Location
    Austin, TX
    Posts
    25
    Plugin Contributions
    0

    Default adding "Number of Orders" field

    Searched but couldn't find an answer for this one...

    In the admin section when you're going through your customers there's a box on the right with the field, Number of Orders.

    When you're going through the orders, though, there is a different box with different fields. (Date Created, email, IP address, etc.)

    I would like to insert the "Number of Orders" field into that right side box. How do I do this?

    Thanks!

  2. #2
    Join Date
    Jan 2004
    Posts
    58,446
    Blog Entries
    3
    Plugin Contributions
    111

    Default Re: adding "Number of Orders" field

    While a given order doesn't technically relate to how many orders a given customer has placed, if you want to place that statistic on the sidebar of a given order, you can probably do it by adding the following code, as shown, to /admin/orders.php.

    Around line 850 you'll see this section. Make the additions shown:
    Code:
        default:
          if (isset($oInfo) && is_object($oInfo)) {
            $heading[] = array('text' => '<strong>[' . $oInfo->orders_id . ']&nbsp;&nbsp;' . zen_datetime_short($oInfo->date_purchased) . '</strong>');
    
            $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=edit', 'NONSSL') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_ORDERS, zen_get_all_get_params(array('oID', 'action')) . 'oID=' . $oInfo->orders_id . '&action=delete', 'NONSSL') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
            $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_ORDERS_INVOICE, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . zen_image_button('button_invoice.gif', IMAGE_ORDERS_INVOICE) . '</a> <a href="' . zen_href_link(FILENAME_ORDERS_PACKINGSLIP, 'oID=' . $oInfo->orders_id) . '" TARGET="_blank">' . zen_image_button('button_packingslip.gif', IMAGE_ORDERS_PACKINGSLIP) . '</a>');
            $contents[] = array('text' => '<br />' . TEXT_DATE_ORDER_CREATED . ' ' . zen_date_short($oInfo->date_purchased));
            $contents[] = array('text' => '<br />' . $oInfo->customers_email_address);
            $customers_orders = $db->Execute("select count(orders_id) as num_orders
                                              from " . TABLE_ORDERS . " o
                                              where customers_id='" . $oInfo->customers_id . "'");
            $contents[] = array('text' => '<br />' . TEXT_INFO_NUMBER_OF_ORDERS . ' ' . $customers_orders->fields['num_orders']);
            $contents[] = array('text' => TEXT_INFO_IP_ADDRESS . ' ' . $oInfo->ip_address);
            if (zen_not_null($oInfo->last_modified)) $contents[] = array('text' => TEXT_DATE_ORDER_LAST_MODIFIED . ' ' . zen_date_short($oInfo->last_modified));
            $contents[] = array('text' => '<br />' . TEXT_INFO_PAYMENT_METHOD . ' '  . $oInfo->payment_method);
            $contents[] = array('text' => '<br />' . ENTRY_SHIPPING . ' '  . $oInfo->shipping_method);
    You'll need to add a define for TEXT_INFO_NUMBER_OF_ORDERS to the language file as well.




    I basically just copied the sidebar code from the customers.php file and adapted with a couple minor modifications for the orders.php file.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jun 2006
    Location
    Austin, TX
    Posts
    25
    Plugin Contributions
    0

    Default Re: adding "Number of Orders" field

    Thanks for the reply. What do you mean "order numbers" doesn't technically relate to the # of orders placed?

  4. #4
    Join Date
    Jan 2004
    Posts
    58,446
    Blog Entries
    3
    Plugin Contributions
    111

    Default Re: adding "Number of Orders" field

    Quote Originally Posted by davidhwalker View Post
    What do you mean "order numbers" doesn't technically relate to the # of orders placed?
    Strictly speaking, an order is an order. The existence of other orders in the database is irrelevant to that particular order.
    The sidebar normally displays information pertinent to the highlighted order.
    The number of other orders placed by that customer has no relevance to the details of the highlighted order.

    That's all.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. Adding Fax Number Field to Packing/Invoice
    By esugrue in forum Managing Customers and Orders
    Replies: 11
    Last Post: 6 Mar 2009, 05:38 PM
  2. Adding a text field to the checkout??
    By wosket in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 27 Oct 2007, 03:14 AM
  3. Adding an additional hidden field in the attributes table
    By quantum in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 13 Aug 2007, 09:22 AM
  4. Adding a new field to a product
    By David Bo in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 19 Feb 2007, 06:23 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
  •