$group_name, 'group_percentage' => $group_percentage); if ($action == 'insert') { $insert_sql_data = array('date_added' => 'now()'); $sql_data_array = array_merge($sql_data_array, $insert_sql_data); zen_db_perform(TABLE_GROUP_PRICING, $sql_data_array); $group_id = $db->insert_ID(); } elseif ($action == 'save') { $update_sql_data = array('last_modified' => 'now()'); $sql_data_array = array_merge($sql_data_array, $update_sql_data); zen_db_perform(TABLE_GROUP_PRICING, $sql_data_array, 'update', "group_id = '" . (int)$group_id . "'"); } } zen_redirect(zen_href_link(FILENAME_GROUP_PRICING, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'gID=' . $group_id)); break; case 'deleteconfirm': if (zen_admin_demo()) { $_GET['action']= ''; $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); zen_redirect(zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'])); } $delete_cust_confirmed = (isset($_POST['delete_customers']) && $_POST['delete_customers'] =='on') ? true : false ; $group_id = zen_db_prepare_input($_GET['gID']); $customers_query = $db->Execute("select customers_id from " . TABLE_CUSTOMERS . " where customers_group_pricing = '" . (int)$group_id . "'"); if ($customers_query->RecordCount() > 0 && $delete_cust_confirmed == true) { $db->Execute("delete from " . TABLE_GROUP_PRICING . " where group_id = '" . (int)$group_id . "'"); $db->Execute("update " . TABLE_CUSTOMERS ." set customers_group_pricing=0 where customers_group_pricing = '" . (int)$group_id . "'"); } elseif ($customers_query->RecordCount() > 0 && $delete_cust_confirmed == false) { $messageStack->add_session(ERROR_GROUP_PRICING_CUSTOMERS_EXIST,'error'); } elseif($customers_query->RecordCount() == 0) { $db->Execute("delete from " . TABLE_GROUP_PRICING . " where group_id = '" . (int)$group_id . "'"); } zen_redirect(zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'])); break; } } $query = $db->Execute("select count(*) as count from " . TABLE_GROUP_PRICING ); if ($query->fields['count'] > 0 && (!defined('MODULE_ORDER_TOTAL_GROUP_PRICING_STATUS') || MODULE_ORDER_TOTAL_GROUP_PRICING_STATUS !='true')) { $messageStack->add(ERROR_MODULE_NOT_CONFIGURED,'error'); } ?> > <?php echo TITLE; ?>
'' . TEXT_HEADING_NEW_PRICING_GROUP . ''); $contents = array('form' => zen_draw_form('group_pricing', FILENAME_GROUP_PRICING, 'action=insert', 'post')); $contents[] = array('text' => TEXT_NEW_INTRO); $contents[] = array('text' => '
' . TEXT_GROUP_PRICING_NAME . '
' . zen_draw_input_field('group_name', '', zen_set_field_length(TABLE_GROUP_PRICING, 'group_name'))); $contents[] = array('text' => '
' . TEXT_GROUP_PRICING_AMOUNT . '
' . zen_draw_input_field('group_percentage', '')); $contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_save.gif', IMAGE_SAVE) . ' ' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; case 'edit': $heading[] = array('text' => '' . TEXT_HEADING_EDIT_PRICING_GROUP . ''); $contents = array('form' => zen_draw_form('group_pricing', FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $gInfo->group_id . '&action=save', 'post')); $contents[] = array('text' => TEXT_EDIT_INTRO); $contents[] = array('text' => '
' . TEXT_GROUP_PRICING_NAME . '
' . zen_draw_input_field('group_name', $gInfo->group_name, zen_set_field_length(TABLE_GROUP_PRICING, 'group_name'))); $contents[] = array('text' => '
' . TEXT_GROUP_PRICING_AMOUNT . '
' . zen_draw_input_field('group_percentage', $gInfo->group_percentage)); $contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_save.gif', IMAGE_SAVE) . ' ' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; case 'delete': $heading[] = array('text' => '' . TEXT_HEADING_DELETE_PRICING_GROUP . ''); $contents = array('form' => zen_draw_form('group_pricing', FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $gInfo->group_id . '&action=deleteconfirm')); $contents[] = array('text' => TEXT_DELETE_INTRO); $contents[] = array('text' => '
' . $gInfo->group_name . ''); if ($gInfo->customer_count > 0) { $contents[] = array('text' => '
' . zen_draw_checkbox_field('delete_customers') . ' ' . TEXT_DELETE_PRICING_GROUP); $contents[] = array('text' => '
' . sprintf(TEXT_DELETE_WARNING_GROUP_MEMBERS, $gInfo->customer_count)); } $contents[] = array('align' => 'center', 'text' => '
' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' ' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . ''); break; default: if (isset($gInfo) && is_object($gInfo)) { $heading[] = array('text' => '' . $gInfo->group_name . ''); $contents[] = array('align' => 'center', 'text' => '' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '' . zen_image_button('button_delete.gif', IMAGE_DELETE) . ''); $contents[] = array('text' => '
' . TEXT_DATE_ADDED . ' ' . zen_date_short($gInfo->date_added)); if (zen_not_null($gInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . zen_date_short($gInfo->last_modified)); $contents[] = array('text' => '
' . TEXT_CUSTOMERS . ' ' . $gInfo->customer_count); } break; } if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) { echo ' ' . "\n"; } ?>
Execute($groups_query_raw); while (!$groups->EOF) { if ((!isset($_GET['gID']) || (isset($_GET['gID']) && ($_GET['gID'] == $groups->fields['group_id']))) && !isset($gInfo) && (substr($action, 0, 3) != 'new')) { $group_customers = $db->Execute("select count(*) as customer_count from " . TABLE_CUSTOMERS . " where customers_group_pricing = '" . (int)$groups->fields['group_id'] . "'"); $gInfo_array = array_merge($groups->fields, $group_customers->fields); $gInfo = new objectInfo($gInfo_array); } if (isset($gInfo) && is_object($gInfo) && ($groups->fields['group_id'] == $gInfo->group_id)) { echo ' ' . "\n"; } else { echo ' ' . "\n"; } ?> MoveNext(); } ?>
   
fields['group_id']; ?> fields['group_name']; ?> fields['group_percentage']; ?> fields['group_id'] . '&action=edit') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . ''; ?> fields['group_id'] . '&action=delete') . '">' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . ''; ?> fields['group_id'] == $gInfo->group_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . ''; } ?>
display_count($groups_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_PRICING_GROUPS); ?> display_links($groups_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?>
group_id . '&action=new') . '">' . zen_image_button('button_insert.gif', IMAGE_INSERT) . ''; ?>
' . "\n"; $box = new box; echo $box->infoBox($heading, $contents); echo '