Originally Posted by
fabburl
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!
Bookmarks