I need some help to add a much needed feature to Super Orders. Right now I have it set up so that orders that are paid for get assigned the status "In Production". I need a function to query the contents of an order before assigning it a status update and if it contains an item from a certain category it gets assigned a different status "Wholesale - In Production".
There's these two functions from admin/includes/functions/general.php
////
function zen_cfg_pull_down_order_statuses($order_status_id, $key = '') {
global $db;
$name = (($key) ? 'configuration[' . $key . ']' : 'configuration_value');
$statuses_array = array(array('id' => '0', 'text' => TEXT_DEFAULT));
$statuses = $db->Execute("select orders_status_id, orders_status_name
from " . TABLE_ORDERS_STATUS . "
where language_id = '" . (int)$_SESSION['languages_id'] . "'
order by orders_status_id");
while (!$statuses->EOF) {
$statuses_array[] = array('id' => $statuses->fields['orders_status_id'],
'text' => $statuses->fields['orders_status_name'] . ' [' . $statuses->fields['orders_status_id'] . ']');
$statuses->MoveNext();
}
return zen_draw_pull_down_menu($name, $statuses_array, $order_status_id);
}
function zen_get_order_status_name($order_status_id, $language_id = '') {
global $db;
if ($order_status_id < 1) return TEXT_DEFAULT;
if (!is_numeric($language_id)) $language_id = $_SESSION['languages_id'];
$status = $db->Execute("select orders_status_name
from " . TABLE_ORDERS_STATUS . "
where orders_status_id = '" . (int)$order_status_id . "'
and language_id = '" . (int)$language_id . "'");
return $status->fields['orders_status_name'] . ' [' . (int)$order_status_id . ']';
}
////
And then there's this from admin/includes/init_includes/init_so_config.php
$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, 'Auto Status - Payment', 'AUTO_STATUS_PAYMENT', '2', 'Number of the order status assigned when a payment (<strong>not</strong> attached to a purchase order) is added to the payment data.', '".$so_configuration_id."', 5, now(), now(), 'zen_get_order_status_name', 'zen_cfg_pull_down_order_statuses(')";
$db->Execute($sql);
I know I pretty much need to clone the above code from init_so_config.php into another drop down option for my admin but I'm not sure if I need to edit one of the two above functions or create an entirely new one to compare the customer's order to their payment status. Any help in accomplishing this would be so greatly appreciated.