[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 option_values.php

Zen Cart 源代码 option_values.php




下载文件

文件名: option_values.php
文件类型: PHP文件
文件大小: 13.04 KiB
MD5: c61778660d7197d756148d2a472861fa

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


cron