[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文件
文件大小: 12.89 KiB
MD5: 0c32e9cb893f26b6c2c507a05d6e85a1

option_values.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2010 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 17891 2010-10-08 22:17:22Z wilt $
  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 = '" . $_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.       $all_products_attributes= $db->Execute("select p.products_id, pa.products_attributes_id from " .
  62.       TABLE_PRODUCTS . " p, " .
  63.       TABLE_PRODUCTS_ATTRIBUTES . " pa " . "
  64.      where p.products_id= pa.products_id"
  65.       );
  66.       while (!$all_products_attributes->EOF) {
  67.         $count++;
  68.         zen_update_attributes_products_option_values_sort_order($all_products_attributes->fields['products_id']);
  69.         $all_products_attributes->MoveNext();
  70.       }
  71.       $messageStack->add_session(SUCCESS_PRODUCT_UPDATE_SORT_ALL, 'success');
  72.       $action='';
  73.       zen_redirect(zen_href_link(FILENAME_PRODUCTS_OPTIONS_VALUES));
  74.       break;
  75.   } // switch
  76. ?>
  77. <!doctsype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  78. <html <?php echo HTML_PARAMS; ?>>
  79. <head>
  80. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  81. <title><?php echo TITLE; ?></title>
  82. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  83. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  84. <script language="javascript" src="includes/menu.js"></script>
  85. <script language="javascript" src="includes/general.js"></script>
  86. <script type="text/javascript">
  87.   <!--
  88.   function init()
  89.   {
  90.     cssjsmenu('navbar');
  91.     if (document.getElementById)
  92.     {
  93.       var kill = document.getElementById('hoverJS');
  94.       kill.disabled = true;
  95.     }
  96.   }
  97.   // -->
  98. </script>
  99. </head>
  100. <body onload="init()" marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
  101. <!-- header //-->
  102. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  103. <!-- header_eof //-->
  104.  
  105. <!-- body //-->
  106. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  107.   <tr>
  108. <!-- body_text //-->
  109.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  110.       <tr>
  111.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  112.           <tr>
  113.             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  114.             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  115.           </tr>
  116.         </table></td>
  117.       </tr>
  118.       <tr>
  119.         <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  120. <?php
  121. if ($_GET['options_id']=='') {
  122. ?>
  123.   <table border="1" cellspacing="1" cellpadding="2" bordercolor="gray">
  124.     <tr class="dataTableHeadingRow">
  125.       <td colspan="3" align="center" class="dataTableHeadingContent"><?php echo TEXT_UPDATE_OPTION_VALUES; ?></td>
  126.     </tr>
  127.     <tr class="dataTableHeadingRow">
  128. <?php echo zen_draw_form('quick_jump', FILENAME_PRODUCTS_OPTIONS_VALUES, '', 'get'); ?>
  129.       <td class="dataTableHeadingContent"> <?php echo TEXT_SELECT_OPTION; ?> </td>
  130.       <td class="dataTableHeadingContent">&nbsp;<select name="options_id">
  131. <?php
  132.         $options_values = $db->Execute("select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . (int)$_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");
  133.         while(!$options_values->EOF) {
  134.             echo "\n" . '<option name="' . $options_values->fields['products_options_name'] . '" value="' . $options_values->fields['products_options_id'] . '">' . $options_values->fields['products_options_name'] . '</option>';
  135.             $options_values->MoveNext();
  136.         }
  137. ?>
  138.       </select>&nbsp;</td>
  139.       <td align="center" class="dataTableHeadingContent">&nbsp;<?php echo zen_image_submit('button_edit.gif', IMAGE_EDIT); ?>&nbsp;</td>
  140.       </form>
  141.     </tr>
  142.   </table>
  143. <?php
  144. } else {
  145. ?>
  146.   <table border="1" cellspacing="3" cellpadding="2" bordercolor="gray">
  147.     <tr class="dataTableHeadingRow">
  148.       <td colspan="3" class="dataTableHeadingContent" align="center"><?php echo TEXT_EDIT_OPTION_NAME; ?> <?php echo zen_options_name($_GET['options_id']); ?></td>
  149.     </tr>
  150. <?php // echo zen_draw_form('update', zen_href_link(FILENAME_PRODUCTS_OPTIONS_VALUES, 'action=update_sort_order&options_id=' . $_GET['options_id'], 'NONSSL'), '', 'post'); ?>
  151. <?php echo zen_draw_form('update', FILENAME_PRODUCTS_OPTIONS_VALUES, 'action=update_sort_order&options_id=' . $_GET['options_id'], 'post'); ?>
  152. <?php
  153.     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>';
  154.  
  155.     $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");
  156.  
  157.     if (!$row->EOF) {
  158.        $option_values_exist = true;
  159.         while (!$row->EOF) {
  160.             echo '      <td align="right" class="dataTableContent">' . $row->fields["products_options_values_id"] . '</td>' . "\n";
  161.             echo '      <td class="dataTableContent">' . $row->fields["products_options_values_name"] . '</td>' . "\n";
  162.             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";
  163.             echo '    </tr>' . "\n";
  164.           $row->MoveNext();
  165.         }
  166. //        while($row = mysql_fetch_array($result));
  167.     } else {
  168.        $option_values_exist = false;
  169.        echo '      <td colspan="3" height="50" align="center" valign="middle" class="dataTableContent">' . TEXT_NO_OPTION_VALUE . zen_options_name($_GET['options_id']) . '</td>' . "\n";
  170.     }
  171. ?>
  172.     <tr class="dataTableHeadingRow">
  173.       <?php
  174.         if ($option_values_exist == true) {
  175.       ?>
  176.       <td colspan="2" height="50" align="center" valign="middle" class="dataTableHeadingContent">
  177.         <input type="submit" value="<?php echo TEXT_UPDATE_SUBMIT; ?>">
  178.       </td>
  179.       <?php
  180.         }
  181.       ?>
  182.       <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>
  183.     </tr>
  184.   </form>
  185.   </table>
  186. <?php
  187. } // which table
  188. ?>
  189. <?php
  190. //////////////////////////////////////////
  191. // BOF: Update by Product, Category or All products
  192. // only show when not updating Option Value Sort Order
  193. if (empty($_GET['options_id'])) {
  194.  
  195. // select from all product with attributes
  196. ?>
  197.       <tr>
  198.         <td colspan="2" class="main" align="left"><br /><?php echo TEXT_UPDATE_SORT_ORDERS_OPTIONS; ?></td>
  199.       </tr>
  200.  
  201.       <tr>
  202.         <td colspan="2" class="main" align="left"><br /><?php echo TEXT_UPDATE_SORT_ORDERS_OPTIONS_PRODUCTS; ?></td>
  203.       </tr>
  204.       <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']); ?>
  205.         <td colspan="2"><table border="0" cellspacing="0" cellpadding="2">
  206.           <tr>
  207.             <td class="main"><?php echo zen_draw_products_pull_down_attributes('products_update_id'); ?></td>
  208.             <td class="main" align="right" valign="top"><?php echo zen_image_submit('button_update.gif', IMAGE_UPDATE); ?></td>
  209.           </tr>
  210.         </table></td>
  211.       </form></tr>
  212.  
  213. <?php
  214. // select from all categories with products with attributes
  215. ?>
  216.       <tr>
  217.         <td colspan="2" class="main" align="left"><br /><?php echo TEXT_UPDATE_SORT_ORDERS_OPTIONS_CATEGORIES; ?></td>
  218.       </tr>
  219.       <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']); ?>
  220.         <td colspan="2"><table border="0" cellspacing="0" cellpadding="2">
  221.           <tr>
  222.             <td class="main" align="left" valign="top"><?php echo zen_draw_products_pull_down_categories_attributes('categories_update_id'); ?></td>
  223.             <td class="main" align="right" valign="middle"><?php echo zen_image_submit('button_update.gif', IMAGE_UPDATE); ?></td>
  224.           </tr>
  225.         </table></td>
  226.       </form></tr>
  227.  
  228. <?php
  229. // select the catalog and update all products with attributes
  230. ?>
  231.       <tr>
  232.         <td colspan="2"><br /><table border="0" cellspacing="0" cellpadding="2">
  233.           <tr>
  234.             <td class="main" align="left" valign="top"><?php echo TEXT_INFO_ATTRIBUTES_FEATURES_UPDATES; ?></td>
  235.             <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>
  236.           </tr>
  237.         </table></td>
  238.       </tr>
  239. <?php
  240. }
  241. // EOF: Update by Product, Category or All products
  242. //////////////////////////////////////////
  243. ?>
  244.  
  245.         </table></td>
  246.       </tr>
  247.  
  248.     </table></td>
  249. <!-- body_text_eof //-->
  250.  
  251.   </tr>
  252. </table>
  253. <!-- body_eof //-->
  254.  
  255. <!-- footer //-->
  256. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  257. <!-- footer_eof //-->
  258. </body>
  259. </html>
  260. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  261.  


cron