Flag Orders in Super Orders - 1.0 by Chris Stackhouse
Licensing
License is GNU GPL. Freedom baby, yeah.
Requires
-Requires Zen Cart v1.5.1 (may work with previous or future versions, not tested).
-Requires Super Orders 4.0.9 (may work with previous or future versions, not tested).
Files Involved
-Modifies Core Files:
admin/includes/languages/english/orders.php
admin/includes/orders.php
-Modifies Super Orders file:
admin/includes/init-includes/init_so_config.php
-Requires re-uploading Super Orders file (file deletes itself after first admin load)
admin/includes/auto_loaders/config.so
What is Flag Orders in Super Orders (FOISO)?
FOISO is a modification to super orders that flags orders in the order listing if the order contains certain items (product ids) defined by the admin in much the same way the order listing already flags orders with a red dot when the billing and shipping info mismatch. A yellow dot wll appear next to the order ID if an order contains items from Category 1 (defined by default as Quick-Ship) and a green dot if it contains items from Category 2 (defined by default as Wholesale). You can re-define the language files to reflect in the legend any reason you want for flagging these specific categories of items. Easily define the product IDs you wish to flag for each category by entering a string of product ids separated by commas in the two new fields at the bottom of the Admin-->Config-->Super Orders.
Installation Instructions
- Merge the following changes into admin/includes/init-includes/init_so_config.php
around line 244:
//-- SUPER ORDERS VERSION
$sql = "INSERT IGNORE INTO ".DB_PREFIX."configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (NULL, 'Super Orders Version', 'SO_VERSION', '4.0.5', 'Super Orders version', '".$so_configuration_id."', 100, NULL, now(), NULL, NULL)";
$db->Execute($sql);
////////////// START FOISO EDIT ////////////////////////
//-- Flag Products for FOISO Category 1
$sql = "INSERT IGNORE INTO ".DB_PREFIX."configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (NULL, 'Product IDs to Flag for FOISO Category 1', 'FOISO_CAT_ONE_PRODUCT_ID_LIST', '', 'Enter the product id numbers separated by a comma that you wish to flag for FOISO Category 1 in the Order Listing', '".$so_configuration_id."', 105, now(), now(), NULL , NULL)";
$db->Execute($sql);
//-- Flag Products for FOISO Category 2
$sql = "INSERT IGNORE INTO ".DB_PREFIX."configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES (NULL, 'Product IDs to Flag for FOISO Category 2', 'FOISO_CAT_TWO_PRODUCT_ID_LIST', '', 'Enter the product id numbers separated by a comma that you wish to flag for FOISO Category 2 in the Order Listing', '".$so_configuration_id."', 110, now(), now(), NULL , NULL)";
$db->Execute($sql);
////////////// END FOISO EDIT ////////////////////////////
if(file_exists(DIR_FS_ADMIN . DIR_WS_INCLUDES . 'auto_loaders/config.so.php'))
-
Re-upload admin/includes/auto_loaders/config.so from Super Orders. No changes necessary.
-
Make desired changes to and merge the following into admin/includes/languages/english/orders.php:
around line 168
define('TEXT_ICON_LEGEND', 'Action Icon Legend:');
define('TEXT_BILLING_SHIPPING_MISMATCH', 'Billing and Shipping do not match');
///////// Begin FOISO edit
// FOISO - Define CAT1/CAT2 Legend
define ('SO_FLAG_ORDERS_CAT1_LEGEND', 'This Order Contains a Quick-Ship Product');
define ('SO_FLAG_ORDERS_CAT2_LEGEND', 'This Order Contains a Wholesale Product');
/////////// End FOISO - Define CAT1/CAT2 Legend
define('TEXT_INFO_EXPIRED_DATE', 'Expired Date:<br />');
define('TEXT_INFO_EXPIRED_COUNT', 'Expired Count:<br />');
- Merge the following code into admin/includes/orders.php
around 1519 ( in my heavily modified orders.php)
'text' => TEXT_ALL_ORDERS)), $orders_statuses), $_GET['status'], 'onChange="this.form.submit();"');
echo zen_hide_session_id();
?>
</td>
</form></tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
///////// BEGIN FOISO REPLACE LEGEND
<td class="smallText"><?php
$spacer = zen_image(DIR_WS_IMAGES . 'pixel_trans.gif', 7, 7);
echo TEXT_LEGEND . ' ' . zen_image(DIR_WS_IMAGES . 'icon_status_red.gif', TEXT_BILLING_SHIPPING_MISMATCH, 10, 10) . ' ' . TEXT_BILLING_SHIPPING_MISMATCH . $spacer; ?>
<?php echo zen_image(DIR_WS_IMAGES . 'icon_status_yellow.gif', SO_FLAG_ORDERS_CAT1_LEGEND, 10, 10) . ' ' . SO_FLAG_ORDERS_CAT1_LEGEND . $spacer ?>
<?php echo zen_image(DIR_WS_IMAGES . 'icon_status_green.gif', SO_FLAG_ORDERS_CAT2_LEGEND, 10, 10) . ' ' . SO_FLAG_ORDERS_CAT2_LEGEND . $spacer ?>
</td>
//////////////END FOISO REPLACE LEGEND
<tr>
<td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr class="dataTableHeadingRow">
<?php
// Sort Listing
switch ($_GET['list_order']) {
*****************************************************
5. Again, Merge the following code into admin/includes/orders.php
around 1692 (in my heavily modified orders.php)
*****************************************************
$show_payment_type = $orders->fields['payment_module_code'] . '<br />' . $orders->fields['shipping_module_code'];
$close_status = so_close_status($orders->fields['orders_id']);
if ($close_status) $class = "status-" . $close_status['type'];
else $class = "dataTableContent";
/////////////// BEGIN FOISO EDIT ///////////////////////
//creates a spacer
$spacer = zen_image(DIR_WS_IMAGES . 'pixel_trans.gif', 10, 10);
//begin check order contents - FOISO Cat 1
$show_FOISO_cat1_products = ' ';
$cat1_string_array = FOISO_CAT_ONE_PRODUCT_ID_LIST;
$cat1_int_array = array_map('intval', explode(',', $cat1_string_array));
$order = new order($orders->fields['orders_id']);
foreach ($cat1_int_array as $cat1_value)
for ($i=0; $i<sizeof($order->products); $i++) {
if ((int)$order->products[$i]['id'] == $cat1_value) {
$show_FOISO_cat1_products = zen_image(DIR_WS_IMAGES . 'icon_status_yellow.gif', SO_FLAG_ORDERS_CAT1_LEGEND, 10, 10);
break;
}
}
// end check order contents - FOISO Cat 1
// begin check order contents - FOISO Cat 2
$show_FOISO_cat2_products = ' ';
$cat2_string_array = FOISO_CAT_TWO_PRODUCT_ID_LIST;
$cat2_int_array = array_map('intval', explode(',', $cat2_string_array));
$order = new order($orders->fields['orders_id']);
foreach ($cat2_int_array as $cat2_value)
for ($i=0; $i<sizeof($order->products); $i++) {
if ((int)$order->products[$i]['id'] == $cat2_value) {
$show_FOISO_cat2_products = zen_image(DIR_WS_IMAGES . 'icon_status_green.gif', SO_FLAG_ORDERS_CAT2_LEGEND, 10, 10);
break;
}
}
// end check order contents - FOISO Cat 2
?>
<td class="dataTableContent" align="left"><?php echo $orders->fields['orders_id'] . $spacer . $show_difference . $show_FOISO_cat1_products . $show_FOISO_cat2_products; ?> </td>
<? php
///////////////// END FOISO EDIT /////////////////////////
?>
<td class="dataTableContent" align="left"><?php echo $show_payment_type; ?></td>
<!--
<td class="dataTableContent"><?php echo '<a href="' . zen_href_link(FILENAME_CUSTOMERS, 'cID=' . $orders->fields['customers_id'], 'NONSSL') . '">' . zen_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW . ' ' . TABLE_HEADING_CUSTOMERS) . '</a> ' . $orders->fields['customers_name'] . ($orders->fields['customers_company'] != '' ? '<br />' . $orders->fields['customers_company'] : ''); ?></td>
//-->
- One more time, merge the following code into admin/includes/orders.php
around 1908 (in my heavily modded orders.php)
<tr>
<td align="center"><?php echo zen_image(DIR_WS_IMAGES . 'icon_status_red.gif', TEXT_BILLING_SHIPPING_MISMATCH, 10, 10); ?></td>
<td class="smallText"><?php echo TEXT_BILLING_SHIPPING_MISMATCH; ?></td>
</tr>
<? php
//////////////// BEGIN FOISO LEGEND ///////////////
?>
<td align="center"><?php echo zen_image(DIR_WS_IMAGES . 'icon_status_yellow.gif', SO_FLAG_ORDERS_CAT1_LEGEND, 10, 10); ?></td>
<td class="smallText"><?php echo SO_FLAG_ORDERS_CAT1_LEGEND; ?></td>
</tr>
<td align="center"><?php echo zen_image(DIR_WS_IMAGES . 'icon_status_green.gif', SO_FLAG_ORDERS_CAT2_LEGEND, 10, 10); ?></td>
<td class="smallText"><?php echo SO_FLAG_ORDERS_CAT2_LEGEND; ?></td>
</tr>
<? php
////////////////////// END FOISO LEGEND //////////////////
?>
<tr>
<td align="center"><?php echo zen_image(DIR_WS_IMAGES . 'icon_cust_info.gif', MINI_ICON_INFO); ?></td>
<td class="smallText"><?php echo MINI_ICON_INFO; ?></td>
</tr>
Special Thanks to Linda McGrath for helping with order checking loop.
If you enjoy this mod and would like to make a donation, send it over to http://www.zen-cart.com/donate and support the Zen Cart open source community.