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 . '] ' . 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.
Bookmarks