[ Index ] |
|
Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1 |
1 <?php 2 // 3 // +----------------------------------------------------------------------+ 4 // |zen-cart Open Source E-commerce | 5 // +----------------------------------------------------------------------+ 6 // | Copyright (c) 2003 The zen-cart developers | 7 // | | 8 // | http://www.zen-cart.com/index.php | 9 // | | 10 // | Portions Copyright (c) 2003 osCommerce | 11 // +----------------------------------------------------------------------+ 12 // | This source file is subject to version 2.0 of the GPL license, | 13 // | that is bundled with this package in the file LICENSE, and is | 14 // | available through the world-wide-web at the following url: | 15 // | http://www.zen-cart.com/license/2_0.txt. | 16 // | If you did not receive a copy of the zen-cart license and are unable | 17 // | to obtain it through the world-wide-web, please send a note to | 18 // | license@zen-cart.com so we can mail you a copy immediately. | 19 // +----------------------------------------------------------------------+ 20 // $Id: group_pricing.php 3295 2006-03-28 07:27:49Z drbyte $ 21 // 22 23 require ('includes/application_top.php'); 24 25 $action = (isset($_GET['action']) ? $_GET['action'] : ''); 26 27 if (zen_not_null($action)) { 28 switch ($action) { 29 case 'insert': 30 case 'save': 31 if (isset($_GET['gID'])) $group_id = zen_db_prepare_input($_GET['gID']); 32 $group_name = zen_db_prepare_input($_POST['group_name']); 33 $group_percentage = zen_db_prepare_input((float)$_POST['group_percentage']); 34 if ($group_name) { 35 $sql_data_array = array('group_name' => $group_name, 36 'group_percentage' => $group_percentage); 37 if ($action == 'insert') { 38 $insert_sql_data = array('date_added' => 'now()'); 39 $sql_data_array = array_merge($sql_data_array, $insert_sql_data); 40 zen_db_perform(TABLE_GROUP_PRICING, $sql_data_array); 41 $group_id = $db->insert_ID(); 42 } elseif ($action == 'save') { 43 $update_sql_data = array('last_modified' => 'now()'); 44 $sql_data_array = array_merge($sql_data_array, $update_sql_data); 45 zen_db_perform(TABLE_GROUP_PRICING, $sql_data_array, 'update', "group_id = '" . (int)$group_id . "'"); 46 } 47 } 48 zen_redirect(zen_href_link(FILENAME_GROUP_PRICING, (isset($_GET['page']) ? 'page=' . $_GET['page'] . '&' : '') . 'gID=' . $group_id)); 49 break; 50 case 'deleteconfirm': 51 if (zen_admin_demo()) { 52 $_GET['action']= ''; 53 $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution'); 54 zen_redirect(zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'])); 55 } 56 57 $delete_cust_confirmed = (isset($_POST['delete_customers']) && $_POST['delete_customers'] =='on') ? true : false ; 58 59 $group_id = zen_db_prepare_input($_GET['gID']); 60 $customers_query = $db->Execute("select customers_id from " . TABLE_CUSTOMERS . " where customers_group_pricing = '" . (int)$group_id . "'"); 61 62 if ($customers_query->RecordCount() > 0 && $delete_cust_confirmed == true) { 63 $db->Execute("delete from " . TABLE_GROUP_PRICING . " where group_id = '" . (int)$group_id . "'"); 64 $db->Execute("update " . TABLE_CUSTOMERS ." set customers_group_pricing=0 where customers_group_pricing = '" . (int)$group_id . "'"); 65 } elseif ($customers_query->RecordCount() > 0 && $delete_cust_confirmed == false) { 66 $messageStack->add_session(ERROR_GROUP_PRICING_CUSTOMERS_EXIST,'error'); 67 } elseif($customers_query->RecordCount() == 0) { 68 $db->Execute("delete from " . TABLE_GROUP_PRICING . " where group_id = '" . (int)$group_id . "'"); 69 } 70 zen_redirect(zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'])); 71 break; 72 } 73 } 74 75 $query = $db->Execute("select count(*) as count from " . TABLE_GROUP_PRICING ); 76 if ($query->fields['count'] > 0 && (!defined('MODULE_ORDER_TOTAL_GROUP_PRICING_STATUS') || MODULE_ORDER_TOTAL_GROUP_PRICING_STATUS !='true')) { 77 $messageStack->add(ERROR_MODULE_NOT_CONFIGURED,'error'); 78 } 79 80 ?> 81 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 82 <html <?php echo HTML_PARAMS; ?>> 83 <head> 84 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 85 <title><?php echo TITLE; ?></title> 86 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 87 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS"> 88 <script language="javascript" src="includes/menu.js"></script> 89 <script language="javascript" src="includes/general.js"></script> 90 <script type="text/javascript"> 91 <!-- 92 function init() 93 { 94 cssjsmenu('navbar'); 95 if (document.getElementById) 96 { 97 var kill = document.getElementById('hoverJS'); 98 kill.disabled = true; 99 } 100 } 101 // --> 102 </script> 103 </head> 104 <body onload="init()"> 105 <!-- header //--> 106 <?php require(DIR_WS_INCLUDES . 'header.php'); ?> 107 <!-- header_eof //--> 108 109 <!-- body //--> 110 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 111 <tr> 112 <!-- body_text //--> 113 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 114 <tr> 115 <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> 116 <tr> 117 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 118 <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> 119 </tr> 120 </table></td> 121 </tr> 122 <tr> 123 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 124 <tr> 125 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 126 <tr class="dataTableHeadingRow"> 127 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_GROUP_ID; ?></td> 128 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_GROUP_NAME; ?></td> 129 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_GROUP_AMOUNT; ?> </td> 130 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td> 131 </tr> 132 <?php 133 $groups_query_raw = "select * from " . TABLE_GROUP_PRICING; 134 $groups_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $groups_query_raw, $groups_query_numrows); 135 $groups = $db->Execute($groups_query_raw); 136 while (!$groups->EOF) { 137 if ((!isset($_GET['gID']) || (isset($_GET['gID']) && ($_GET['gID'] == $groups->fields['group_id']))) && !isset($gInfo) && (substr($action, 0, 3) != 'new')) { 138 $group_customers = $db->Execute("select count(*) as customer_count from " . TABLE_CUSTOMERS . 139 " where customers_group_pricing = '" . (int)$groups->fields['group_id'] . "'"); 140 $gInfo_array = array_merge($groups->fields, $group_customers->fields); 141 $gInfo = new objectInfo($gInfo_array); 142 } 143 144 if (isset($gInfo) && is_object($gInfo) && ($groups->fields['group_id'] == $gInfo->group_id)) { 145 echo ' <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $groups->fields['group_id'] . '&action=edit') . '\'">' . "\n"; 146 } else { 147 echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $groups->fields['group_id'] . '&action=edit') . '\'">' . "\n"; 148 } 149 ?> 150 <td class="dataTableContent"><?php echo $groups->fields['group_id']; ?></td> 151 <td class="dataTableContent"><?php echo $groups->fields['group_name']; ?></td> 152 <td class="dataTableContent"><?php echo $groups->fields['group_percentage']; ?></td> 153 <td class="dataTableContent" align="right"> 154 <?php echo '<a href="' . zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $groups->fields['group_id'] . '&action=edit') . '">' . zen_image(DIR_WS_IMAGES . 'icon_edit.gif', ICON_EDIT) . '</a>'; ?> 155 <?php echo '<a href="' . zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $groups->fields['group_id'] . '&action=delete') . '">' . zen_image(DIR_WS_IMAGES . 'icon_delete.gif', ICON_DELETE) . '</a>'; ?> 156 <?php if (isset($gInfo) && is_object($gInfo) && ($groups->fields['group_id'] == $gInfo->group_id)) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_GROUP_PRICING, zen_get_all_get_params(array('gID')) . 'gID=' . $groups->fields['group_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?> 157 </td> 158 </tr> 159 <?php 160 $groups->MoveNext(); 161 } 162 ?> 163 <tr> 164 <td colspan="4"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 165 <tr> 166 <td class="smallText" valign="top"><?php echo $groups_split->display_count($groups_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_PRICING_GROUPS); ?></td> 167 <td class="smallText" align="right"><?php echo $groups_split->display_links($groups_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td> 168 </tr> 169 </table></td> 170 </tr> 171 <?php 172 if (empty($action)) { 173 ?> 174 <tr> 175 <td align="right" colspan="4" class="smallText"><?php echo '<a href="' . zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $gInfo->group_id . '&action=new') . '">' . zen_image_button('button_insert.gif', IMAGE_INSERT) . '</a>'; ?></td> 176 </tr> 177 <?php 178 } 179 ?> 180 </table></td> 181 <?php 182 $heading = array(); 183 $contents = array(); 184 185 switch ($action) { 186 case 'new': 187 $heading[] = array('text' => '<b>' . TEXT_HEADING_NEW_PRICING_GROUP . '</b>'); 188 189 $contents = array('form' => zen_draw_form('group_pricing', FILENAME_GROUP_PRICING, 'action=insert', 'post')); 190 $contents[] = array('text' => TEXT_NEW_INTRO); 191 $contents[] = array('text' => '<br>' . TEXT_GROUP_PRICING_NAME . '<br>' . zen_draw_input_field('group_name', '', zen_set_field_length(TABLE_GROUP_PRICING, 'group_name'))); 192 $contents[] = array('text' => '<br>' . TEXT_GROUP_PRICING_AMOUNT . '<br>' . zen_draw_input_field('group_percentage', '')); 193 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $_GET['gID']) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 194 break; 195 case 'edit': 196 $heading[] = array('text' => '<b>' . TEXT_HEADING_EDIT_PRICING_GROUP . '</b>'); 197 198 $contents = array('form' => zen_draw_form('group_pricing', FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $gInfo->group_id . '&action=save', 'post')); 199 $contents[] = array('text' => TEXT_EDIT_INTRO); 200 $contents[] = array('text' => '<br />' . TEXT_GROUP_PRICING_NAME . '<br>' . zen_draw_input_field('group_name', $gInfo->group_name, zen_set_field_length(TABLE_GROUP_PRICING, 'group_name'))); 201 $contents[] = array('text' => '<br>' . TEXT_GROUP_PRICING_AMOUNT . '<br>' . zen_draw_input_field('group_percentage', $gInfo->group_percentage)); 202 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $gInfo->group_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 203 break; 204 case 'delete': 205 $heading[] = array('text' => '<b>' . TEXT_HEADING_DELETE_PRICING_GROUP . '</b>'); 206 207 $contents = array('form' => zen_draw_form('group_pricing', FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $gInfo->group_id . '&action=deleteconfirm')); 208 $contents[] = array('text' => TEXT_DELETE_INTRO); 209 $contents[] = array('text' => '<br><b>' . $gInfo->group_name . '</b>'); 210 211 if ($gInfo->customer_count > 0) { 212 $contents[] = array('text' => '<br>' . zen_draw_checkbox_field('delete_customers') . ' ' . TEXT_DELETE_PRICING_GROUP); 213 $contents[] = array('text' => '<br>' . sprintf(TEXT_DELETE_WARNING_GROUP_MEMBERS, $gInfo->customer_count)); 214 } 215 216 $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . ' <a href="' . zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $gInfo->group_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'); 217 break; 218 default: 219 if (isset($gInfo) && is_object($gInfo)) { 220 $heading[] = array('text' => '<b>' . $gInfo->group_name . '</b>'); 221 222 $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $gInfo->group_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_GROUP_PRICING, 'page=' . $_GET['page'] . '&gID=' . $gInfo->group_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>'); 223 $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . zen_date_short($gInfo->date_added)); 224 if (zen_not_null($gInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . zen_date_short($gInfo->last_modified)); 225 $contents[] = array('text' => '<br>' . TEXT_CUSTOMERS . ' ' . $gInfo->customer_count); 226 } 227 break; 228 } 229 230 if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) { 231 echo ' <td width="25%" valign="top">' . "\n"; 232 233 $box = new box; 234 echo $box->infoBox($heading, $contents); 235 236 echo ' </td>' . "\n"; 237 } 238 ?> 239 </tr> 240 </table></td> 241 </tr> 242 </table></td> 243 <!-- body_text_eof //--> 244 </tr> 245 </table> 246 <!-- body_eof //--> 247 248 <!-- footer //--> 249 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> 250 <!-- footer_eof //--> 251 <br> 252 </body> 253 </html> 254 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 16:45:43 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |