[ 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: option_values.php 3205 2006-03-19 01:28:24Z ajeh $ 21 // 22 ?> 23 <?php 24 require ('includes/application_top.php'); 25 26 // verify option values exist 27 $chk_option_values = $db->Execute("select * from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where language_id='" . $_SESSION['languages_id'] . "' limit 1"); 28 if ($chk_option_values->RecordCount() < 1) { 29 $messageStack->add_session(ERROR_DEFINE_OPTION_VALUES, 'caution'); 30 zen_redirect(zen_href_link(FILENAME_OPTIONS_VALUES_MANAGER)); 31 } 32 33 require (DIR_WS_CLASSES . 'currencies.php'); 34 $currencies = new currencies(); 35 36 switch($_GET['action']) { 37 case ('update_sort_order'): 38 foreach($_POST['options_values_new_sort_order'] as $id => $new_sort_order) { 39 $row++; 40 41 $db->Execute("UPDATE " . TABLE_PRODUCTS_OPTIONS_VALUES . " set products_options_values_sort_order= " . $_POST['options_values_new_sort_order'][$id] . " where products_options_values_id= $id"); 42 } 43 $messageStack->add_session(SUCCESS_OPTION_VALUES_SORT_ORDER . ' ' . zen_options_name($_GET['options_id']), 'success'); 44 $_GET['action']=''; 45 zen_redirect(zen_href_link(FILENAME_PRODUCTS_OPTIONS_VALUES)); 46 break; 47 // update by product 48 case ('update_product'): 49 $messageStack->add_session(SUCCESS_PRODUCT_UPDATE_SORT . $_POST['products_update_id'] . ' ' . zen_get_products_name($_POST['products_update_id'], $_SESSION['languages_id']), 'success'); 50 zen_update_attributes_products_option_values_sort_order($_POST['products_update_id']); 51 $action=''; 52 zen_redirect(zen_href_link(FILENAME_PRODUCTS_OPTIONS_VALUES)); 53 break; 54 // update by category 55 case ('update_categories_attributes'): 56 $all_products_attributes= $db->Execute("select ptoc.products_id, pa.products_attributes_id from " . 57 TABLE_PRODUCTS_TO_CATEGORIES . " ptoc, " . 58 TABLE_PRODUCTS_ATTRIBUTES . " pa " . " 59 where ptoc.categories_id = '" . $_POST['categories_update_id'] . "' and 60 pa.products_id = ptoc.products_id" 61 ); 62 while (!$all_products_attributes->EOF) { 63 $count++; 64 $product_id_updated .= ' - ' . $all_products_attributes->fields['products_id'] . ':' . $all_products_attributes->fields['products_attributes_id']; 65 zen_update_attributes_products_option_values_sort_order($all_products_attributes->fields['products_id']); 66 $all_products_attributes->MoveNext(); 67 } 68 $messageStack->add_session(SUCCESS_CATEGORIES_UPDATE_SORT . $_POST['categories_update_id'] . ' ' . zen_get_category_name($_POST['categories_update_id'], $_SESSION['languages_id']), 'success'); 69 $action=''; 70 zen_redirect(zen_href_link(FILENAME_PRODUCTS_OPTIONS_VALUES)); 71 break; 72 // update all products in catalog 73 case ('update_all_products_attributes_sort_order'): 74 $all_products_attributes= $db->Execute("select p.products_id, pa.products_attributes_id from " . 75 TABLE_PRODUCTS . " p, " . 76 TABLE_PRODUCTS_ATTRIBUTES . " pa " . " 77 where p.products_id= pa.products_id" 78 ); 79 while (!$all_products_attributes->EOF) { 80 $count++; 81 zen_update_attributes_products_option_values_sort_order($all_products_attributes->fields['products_id']); 82 $all_products_attributes->MoveNext(); 83 } 84 $messageStack->add_session(SUCCESS_PRODUCT_UPDATE_SORT_ALL, 'success'); 85 $action=''; 86 zen_redirect(zen_href_link(FILENAME_PRODUCTS_OPTIONS_VALUES)); 87 break; 88 } // switch 89 ?> 90 <!doctsype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 91 <html <?php echo HTML_PARAMS; ?>> 92 <head> 93 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> 94 <title><?php echo TITLE; ?></title> 95 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> 96 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS"> 97 <script language="javascript" src="includes/menu.js"></script> 98 <script language="javascript" src="includes/general.js"></script> 99 <script type="text/javascript"> 100 <!-- 101 function init() 102 { 103 cssjsmenu('navbar'); 104 if (document.getElementById) 105 { 106 var kill = document.getElementById('hoverJS'); 107 kill.disabled = true; 108 } 109 } 110 // --> 111 </script> 112 </head> 113 <body onload="init()" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF"> 114 <!-- header //--> 115 <?php require(DIR_WS_INCLUDES . 'header.php'); ?> 116 <!-- header_eof //--> 117 118 <!-- body //--> 119 <table border="0" width="100%" cellspacing="2" cellpadding="2"> 120 <tr> 121 <!-- body_text //--> 122 <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> 123 <tr> 124 <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> 125 <tr> 126 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> 127 <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> 128 </tr> 129 </table></td> 130 </tr> 131 <tr> 132 <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> 133 <?php 134 if ($_GET['options_id']=='') { 135 ?> 136 <table border="1" cellspacing="1" cellpadding="2" bordercolor="gray"> 137 <tr class="dataTableHeadingRow"> 138 <td colspan="3" align="center" class="dataTableHeadingContent"><?php echo TEXT_UPDATE_OPTION_VALUES; ?></td> 139 </tr> 140 <tr class="dataTableHeadingRow"> 141 <?php echo zen_draw_form('quick_jump', FILENAME_PRODUCTS_OPTIONS_VALUES, '', 'get'); ?> 142 <td class="dataTableHeadingContent"> <?php echo TEXT_SELECT_OPTION; ?> </td> 143 <td class="dataTableHeadingContent"> <select name="options_id"> 144 <?php 145 $options_values = $db->Execute("select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . $_SESSION['languages_id'] . "' and products_options_name !='' and products_options_type !='" . PRODUCTS_OPTIONS_TYPE_TEXT . "' and products_options_type !='" . PRODUCTS_OPTIONS_TYPE_FILE . "' order by products_options_name"); 146 while(!$options_values->EOF) { 147 echo "\n" . '<option name="' . $options_values->fields['products_options_name'] . '" value="' . $options_values->fields['products_options_id'] . '">' . $options_values->fields['products_options_name'] . '</option>'; 148 $options_values->MoveNext(); 149 } 150 ?> 151 </select> </td> 152 <td align="center" class="dataTableHeadingContent"> <?php echo zen_image_submit('button_edit.gif', IMAGE_EDIT); ?> </td> 153 </form> 154 </tr> 155 </table> 156 <?php 157 } else { 158 ?> 159 <table border="1" cellspacing="3" cellpadding="2" bordercolor="gray"> 160 <tr class="dataTableHeadingRow"> 161 <td colspan="3" class="dataTableHeadingContent" align="center"><?php echo TEXT_EDIT_OPTION_NAME; ?> <?php echo zen_options_name($_GET['options_id']); ?></td> 162 </tr> 163 <?php // echo zen_draw_form('update', zen_href_link(FILENAME_PRODUCTS_OPTIONS_VALUES, 'action=update_sort_order&options_id=' . $_GET['options_id'], 'NONSSL'), '', 'post'); ?> 164 <?php echo zen_draw_form('update', FILENAME_PRODUCTS_OPTIONS_VALUES, 'action=update_sort_order&options_id=' . $_GET['options_id'], 'post'); ?> 165 <?php 166 echo ' <tr class="dataTableHeadingRow"><td class="dataTableHeadingContent">Option ID</td><td class="dataTableHeadingContent">Option Value Name</td><td class="dataTableHeadingContent">Sort Order</td></tr><tr>'; 167 168 $row = $db->Execute("SELECT * FROM " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " povtpo WHERE povtpo.products_options_values_id = pov.products_options_values_id and povtpo.products_options_id='" . $_GET['options_id'] . "' and pov.language_id = '" . $_SESSION['languages_id'] . "' ORDER BY pov.products_options_values_sort_order, pov.products_options_values_id"); 169 170 if (!$row->EOF) { 171 $option_values_exist = true; 172 while (!$row->EOF) { 173 echo ' <td align="right" class="dataTableContent">' . $row->fields["products_options_values_id"] . '</td>' . "\n"; 174 echo ' <td class="dataTableContent">' . $row->fields["products_options_values_name"] . '</td>' . "\n"; 175 echo ' <td class="dataTableContent" align="center">' . "<input type=\"text\" name=\"options_values_new_sort_order[".$row->fields['products_options_values_id']."]\" value={$row->fields['products_options_values_sort_order']} size=\"4\">" . '</td>' . "\n"; 176 echo ' </tr>' . "\n"; 177 $row->MoveNext(); 178 } 179 // while($row = mysql_fetch_array($result)); 180 } else { 181 $option_values_exist = false; 182 echo ' <td colspan="3" height="50" align="center" valign="middle" class="dataTableContent">' . TEXT_NO_OPTION_VALUE . zen_options_name($_GET['options_id']) . '</td>' . "\n"; 183 } 184 ?> 185 <tr class="dataTableHeadingRow"> 186 <?php 187 if ($option_values_exist == true) { 188 ?> 189 <td colspan="2" height="50" align="center" valign="middle" class="dataTableHeadingContent"> 190 <input type="submit" value="<?php echo TEXT_UPDATE_SUBMIT; ?>"> 191 </td> 192 <?php 193 } 194 ?> 195 <td colspan="<?php echo ($option_values_exist == true ? '1' : '3'); ?>"height="50" align="center" valign="middle" class="dataTableHeadingContent"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCTS_OPTIONS_VALUES) . '">'; ?><?php echo zen_image_button('button_cancel.gif', IMAGE_CANCEL); ?></a></td> 196 </tr> 197 </form> 198 </table> 199 <?php 200 } // which table 201 ?> 202 <?php 203 ////////////////////////////////////////// 204 // BOF: Update by Product, Category or All products 205 // only show when not updating Option Value Sort Order 206 if (empty($_GET['options_id'])) { 207 208 // select from all product with attributes 209 ?> 210 <tr> 211 <td colspan="2" class="main" align="left"><br /><?php echo TEXT_UPDATE_SORT_ORDERS_OPTIONS; ?></td> 212 </tr> 213 214 <tr> 215 <td colspan="2" class="main" align="left"><br /><?php echo TEXT_UPDATE_SORT_ORDERS_OPTIONS_PRODUCTS; ?></td> 216 </tr> 217 <tr><form name="update_product_attributes" <?php echo 'action="' . zen_href_link(FILENAME_PRODUCTS_OPTIONS_VALUES, 'action=update_product') . '"'; ?> method="post"><?php echo zen_draw_hidden_field('products_update_id', $_GET['products_update_id']); ?> 218 <td colspan="2"><table border="0" cellspacing="0" cellpadding="2"> 219 <tr> 220 <td class="main"><?php echo zen_draw_products_pull_down_attributes('products_update_id'); ?></td> 221 <td class="main" align="right" valign="top"><?php echo zen_image_submit('button_update.gif', IMAGE_UPDATE); ?></td> 222 </tr> 223 </table></td> 224 </form></tr> 225 226 <?php 227 // select from all categories with products with attributes 228 ?> 229 <tr> 230 <td colspan="2" class="main" align="left"><br /><?php echo TEXT_UPDATE_SORT_ORDERS_OPTIONS_CATEGORIES; ?></td> 231 </tr> 232 <tr><form name="update_categories_attributes" <?php echo 'action="' . zen_href_link(FILENAME_PRODUCTS_OPTIONS_VALUES, 'action=update_categories_attributes') . '"'; ?> method="post"><?php echo zen_draw_hidden_field('categories_update_id', $_GET['categories_update_id']); ?> 233 <td colspan="2"><table border="0" cellspacing="0" cellpadding="2"> 234 <tr> 235 <td class="main" align="left" valign="top"><?php echo zen_draw_products_pull_down_categories_attributes('categories_update_id'); ?></td> 236 <td class="main" align="right" valign="middle"><?php echo zen_image_submit('button_update.gif', IMAGE_UPDATE); ?></td> 237 </tr> 238 </table></td> 239 </form></tr> 240 241 <?php 242 // select the catalog and update all products with attributes 243 ?> 244 <tr> 245 <td colspan="2"><br /><table border="0" cellspacing="0" cellpadding="2"> 246 <tr> 247 <td class="main" align="left" valign="top"><?php echo TEXT_INFO_ATTRIBUTES_FEATURES_UPDATES; ?></td> 248 <td class="main" align="right" valign="middle"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCTS_OPTIONS_VALUES, 'action=update_all_products_attributes_sort_order') . '">' . zen_image_button('button_update.gif', IMAGE_UPDATE) . '</a>'; ?></td> 249 </tr> 250 </table></td> 251 </tr> 252 <?php 253 } 254 // EOF: Update by Product, Category or All products 255 ////////////////////////////////////////// 256 ?> 257 258 </table></td> 259 </tr> 260 261 </table></td> 262 <!-- body_text_eof //--> 263 264 </tr> 265 </table> 266 <!-- body_eof //--> 267 268 <!-- footer //--> 269 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> 270 <!-- footer_eof //--> 271 </body> 272 </html> 273 <?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 |
![]() |