[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/admin/ -> products_attributes.php (source)

   1  <?php
   2  /*

   3  $Id: products_attributes.php 14 2006-07-28 17:42:07Z user $

   4  

   5    osCMax Power E-Commerce

   6    http://oscdox.com

   7  

   8    Copyright 2006 osCMax

   9  

  10    Released under the GNU General Public License

  11  */
  12  
  13    require ('includes/application_top.php');
  14    $languages = tep_get_languages();
  15  
  16    $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
  17  
  18    $option_page = (isset($HTTP_GET_VARS['option_page']) && is_numeric($HTTP_GET_VARS['option_page'])) ? $HTTP_GET_VARS['option_page'] : 1;
  19    $value_page = (isset($HTTP_GET_VARS['value_page']) && is_numeric($HTTP_GET_VARS['value_page'])) ? $HTTP_GET_VARS['value_page'] : 1;
  20    $attribute_page = (isset($HTTP_GET_VARS['attribute_page']) && is_numeric($HTTP_GET_VARS['attribute_page'])) ? $HTTP_GET_VARS['attribute_page'] : 1;
  21  
  22    $page_info = 'option_page=' . $option_page . '&value_page=' . $value_page . '&attribute_page=' . $attribute_page;
  23  
  24    if (tep_not_null($action)) {
  25  
  26      switch ($action) {
  27        case 'add_product_options':
  28          $products_options_id = tep_db_prepare_input($HTTP_POST_VARS['products_options_id']);
  29          $option_name_array = $HTTP_POST_VARS['option_name'];
  30  
  31          for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {
  32            $option_name = tep_db_prepare_input($option_name_array[$languages[$i]['id']]);
  33  //BOF: MOD - QT Pro

  34            $track_stock=isset($HTTP_POST_VARS['track_stock'])?1:0;
  35            tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS . " (products_options_id, products_options_name, language_id,products_options_track_stock) values ('" . (int)$products_options_id . "', '" . tep_db_input($option_name) . "', '" . (int)$languages[$i]['id'] . "', '" . (int)$track_stock . "')");
  36  //EOF: MOD - QT Pro

  37          }
  38          tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
  39          break;
  40        case 'add_product_option_values':
  41          $value_name_array = $HTTP_POST_VARS['value_name'];
  42          $value_id = tep_db_prepare_input($HTTP_POST_VARS['value_id']);
  43          $option_id = tep_db_prepare_input($HTTP_POST_VARS['option_id']);
  44  
  45          for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {
  46            $value_name = tep_db_prepare_input($value_name_array[$languages[$i]['id']]);
  47  
  48            tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS_VALUES . " (products_options_values_id, language_id, products_options_values_name) values ('" . (int)$value_id . "', '" . (int)$languages[$i]['id'] . "', '" . tep_db_input($value_name) . "')");
  49          }
  50  
  51          tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " (products_options_id, products_options_values_id) values ('" . (int)$option_id . "', '" . (int)$value_id . "')");
  52  
  53          tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
  54          break;
  55        case 'add_product_attributes':
  56          $products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
  57          $options_id = tep_db_prepare_input($HTTP_POST_VARS['options_id']);
  58          $values_id = tep_db_prepare_input($HTTP_POST_VARS['values_id']);
  59          $value_price = tep_db_prepare_input($HTTP_POST_VARS['value_price']);
  60          $price_prefix = tep_db_prepare_input($HTTP_POST_VARS['price_prefix']);
  61  
  62          tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values (null, '" . (int)$products_id . "', '" . (int)$options_id . "', '" . (int)$values_id . "', '" . (float)tep_db_input($value_price) . "', '" . tep_db_input($price_prefix) . "')");
  63  
  64          if (DOWNLOAD_ENABLED == 'true') {
  65            $products_attributes_id = tep_db_insert_id();
  66  
  67            $products_attributes_filename = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_filename']);
  68            $products_attributes_maxdays = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_maxdays']);
  69            $products_attributes_maxcount = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_maxcount']);
  70  
  71            if (tep_not_null($products_attributes_filename)) {
  72              tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " values (" . (int)$products_attributes_id . ", '" . tep_db_input($products_attributes_filename) . "', '" . tep_db_input($products_attributes_maxdays) . "', '" . tep_db_input($products_attributes_maxcount) . "')");
  73            }
  74          }
  75  
  76          tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
  77          break;
  78        case 'update_option_name':
  79          $option_name_array = $HTTP_POST_VARS['option_name'];
  80          $option_id = tep_db_prepare_input($HTTP_POST_VARS['option_id']);
  81  
  82          for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {
  83            $option_name = tep_db_prepare_input($option_name_array[$languages[$i]['id']]);
  84  //BOF: QT Pro

  85            $track_stock=isset($HTTP_POST_VARS['track_stock'])?1:0;
  86            tep_db_query("update " . TABLE_PRODUCTS_OPTIONS . " set products_options_track_stock='" . (int)$track_stock . "',products_options_name = '" . tep_db_input($option_name) . "' where products_options_id = '" . (int)$option_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'");
  87  //EOF: QT Pro

  88          }
  89  
  90          tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
  91          break;
  92        case 'update_value':
  93          $value_name_array = $HTTP_POST_VARS['value_name'];
  94          $value_id = tep_db_prepare_input($HTTP_POST_VARS['value_id']);
  95          $option_id = tep_db_prepare_input($HTTP_POST_VARS['option_id']);
  96  
  97          for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {
  98            $value_name = tep_db_prepare_input($value_name_array[$languages[$i]['id']]);
  99  
 100            tep_db_query("update " . TABLE_PRODUCTS_OPTIONS_VALUES . " set products_options_values_name = '" . tep_db_input($value_name) . "' where products_options_values_id = '" . tep_db_input($value_id) . "' and language_id = '" . (int)$languages[$i]['id'] . "'");
 101          }
 102  
 103          tep_db_query("update " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " set products_options_id = '" . (int)$option_id . "'  where products_options_values_id = '" . (int)$value_id . "'");
 104  
 105          tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
 106          break;
 107        case 'update_product_attribute':
 108          $products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
 109          $options_id = tep_db_prepare_input($HTTP_POST_VARS['options_id']);
 110          $values_id = tep_db_prepare_input($HTTP_POST_VARS['values_id']);
 111          $value_price = tep_db_prepare_input($HTTP_POST_VARS['value_price']);
 112          $price_prefix = tep_db_prepare_input($HTTP_POST_VARS['price_prefix']);
 113          $attribute_id = tep_db_prepare_input($HTTP_POST_VARS['attribute_id']);
 114  
 115          tep_db_query("update " . TABLE_PRODUCTS_ATTRIBUTES . " set products_id = '" . (int)$products_id . "', options_id = '" . (int)$options_id . "', options_values_id = '" . (int)$values_id . "', options_values_price = '" . (float)tep_db_input($value_price) . "', price_prefix = '" . tep_db_input($price_prefix) . "' where products_attributes_id = '" . (int)$attribute_id . "'");
 116  
 117          if (DOWNLOAD_ENABLED == 'true') {
 118            $products_attributes_filename = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_filename']);
 119            $products_attributes_maxdays = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_maxdays']);
 120            $products_attributes_maxcount = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_maxcount']);
 121  
 122            if (tep_not_null($products_attributes_filename)) {
 123              tep_db_query("replace into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " set products_attributes_id = '" . (int)$attribute_id . "', products_attributes_filename = '" . tep_db_input($products_attributes_filename) . "', products_attributes_maxdays = '" . tep_db_input($products_attributes_maxdays) . "', products_attributes_maxcount = '" . tep_db_input($products_attributes_maxcount) . "'");
 124            }
 125          }
 126  
 127          tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
 128          break;
 129        case 'delete_option':
 130          $option_id = tep_db_prepare_input($HTTP_GET_VARS['option_id']);
 131  
 132          tep_db_query("delete from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$option_id . "'");
 133  
 134          tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
 135          break;
 136        case 'delete_value':
 137          $value_id = tep_db_prepare_input($HTTP_GET_VARS['value_id']);
 138  
 139          tep_db_query("delete from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int)$value_id . "'");
 140          tep_db_query("delete from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int)$value_id . "'");
 141          tep_db_query("delete from " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_values_id = '" . (int)$value_id . "'");
 142  
 143          tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
 144          break;
 145        case 'delete_attribute':
 146          $attribute_id = tep_db_prepare_input($HTTP_GET_VARS['attribute_id']);
 147  
 148          tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_attributes_id = '" . (int)$attribute_id . "'");
 149  
 150  // added for DOWNLOAD_ENABLED. Always try to remove attributes, even if downloads are no longer enabled

 151          tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " where products_attributes_id = '" . (int)$attribute_id . "'");
 152  
 153          tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
 154          break;
 155      }
 156    }
 157  ?>
 158  <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
 159  <html <?php echo HTML_PARAMS; ?>>
 160  <head>
 161  <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
 162  <title><?php echo TITLE; ?></title>
 163  <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
 164  </head>
 165  <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
 166  <!-- header //-->
 167  <?php require (DIR_WS_INCLUDES . 'header.php'); ?>
 168  <!-- header_eof //-->
 169  
 170  <!-- body //-->
 171  <table border="0" width="100%" cellspacing="2" cellpadding="2">
 172    <tr>
 173      <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
 174  <!-- left_navigation //-->
 175  <?php require (DIR_WS_INCLUDES . 'column_left.php'); ?>
 176  <!-- left_navigation_eof //-->
 177      </table></td>
 178  <!-- body_text //-->
 179      <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
 180  <!-- options and values//-->
 181        <tr>
 182          <td width="100%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
 183            <tr>
 184              <td valign="top" width="50%"><table width="100%" border="0" cellspacing="0" cellpadding="2">
 185  <!-- options //-->
 186  <?php
 187    if ($action == 'delete_product_option') { // delete product option
 188      $options = tep_db_query("select products_options_id, products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$HTTP_GET_VARS['option_id'] . "' and language_id = '" . (int)$languages_id . "'");
 189      $options_values = tep_db_fetch_array($options);
 190  ?>
 191                <tr>
 192                  <td class="pageHeading">&nbsp;<?php echo $options_values['products_options_name']; ?>&nbsp;</td>
 193                </tr>
 194                <tr>
 195                  <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
 196                    <tr>
 197                      <td colspan="3"><?php echo tep_black_line(); ?></td>
 198                    </tr>
 199  <?php
 200      $products = tep_db_query("select p.products_id, pd.products_name, pov.products_options_values_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pov.language_id = '" . (int)$languages_id . "' and pd.language_id = '" . (int)$languages_id . "' and pa.products_id = p.products_id and pa.options_id='" . (int)$HTTP_GET_VARS['option_id'] . "' and pov.products_options_values_id = pa.options_values_id order by pd.products_name");
 201      if (tep_db_num_rows($products)) {
 202  ?>
 203                    <tr class="dataTableHeadingRow">
 204                      <td class="dataTableHeadingContent" align="center">&nbsp;<?php echo TABLE_HEADING_ID; ?>&nbsp;</td>
 205                      <td class="dataTableHeadingContent">&nbsp;<?php echo TABLE_HEADING_PRODUCT; ?>&nbsp;</td>
 206                      <td class="dataTableHeadingContent">&nbsp;<?php echo TABLE_HEADING_OPT_VALUE; ?>&nbsp;</td>
 207                    </tr>
 208                    <tr>
 209                      <td colspan="3"><?php echo tep_black_line(); ?></td>
 210                    </tr>
 211  <?php
 212        $rows = 0;
 213        while ($products_values = tep_db_fetch_array($products)) {
 214          $rows++;
 215  ?>
 216                    <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
 217                      <td align="center" class="smallText">&nbsp;<?php echo $products_values['products_id']; ?>&nbsp;</td>
 218                      <td class="smallText">&nbsp;<?php echo $products_values['products_name']; ?>&nbsp;</td>
 219                      <td class="smallText">&nbsp;<?php echo $products_values['products_options_values_name']; ?>&nbsp;</td>
 220                    </tr>
 221  <?php
 222        }
 223  ?>
 224                    <tr>
 225                      <td colspan="3"><?php echo tep_black_line(); ?></td>
 226                    </tr>
 227                    <tr>
 228                      <td colspan="3" class="main"><br><?php echo TEXT_WARNING_OF_DELETE; ?></td>
 229                    </tr>
 230                    <tr>
 231                      <td align="right" colspan="3" class="main"><br><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', ' cancel '); ?></a>&nbsp;</td>
 232                    </tr>
 233  <?php
 234      } else {
 235  ?>
 236                    <tr>
 237                      <td class="main" colspan="3"><br><?php echo TEXT_OK_TO_DELETE; ?></td>
 238                    </tr>
 239                    <tr>
 240                      <td class="main" align="right" colspan="3"><br><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=delete_option&option_id=' . $HTTP_GET_VARS['option_id'] . '&' . $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_delete.gif', ' delete '); ?></a>&nbsp;&nbsp;&nbsp;<?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', ' cancel '); ?></a>&nbsp;</td>
 241                    </tr>
 242  <?php
 243      }
 244  ?>
 245                  </table></td>
 246                </tr>
 247  <?php
 248    } else {
 249  ?>
 250                <tr>
 251  <?php /* MOD: QT Pro Added 1 to colspan */ ?>
 252                  <td colspan="3" class="pageHeading">&nbsp;<?php echo HEADING_TITLE_OPT; ?>&nbsp;</td>
 253                  <td align="right"><br><form name="option_order_by" action="<?php echo FILENAME_PRODUCTS_ATTRIBUTES; ?>"><select name="selected" onChange="go_option()"><option value="products_options_id"<?php if ($option_order_by == 'products_options_id') { echo ' SELECTED'; } ?>><?php echo TEXT_OPTION_ID; ?></option><option value="products_options_name"<?php if ($option_order_by == 'products_options_name') { echo ' SELECTED'; } ?>><?php echo TEXT_OPTION_NAME; ?></option></select></form></td>
 254                </tr>
 255                <tr>
 256  <?php /* MOD: QT Pro Added 1 to colspan */ ?>
 257                  <td colspan="4" class="smallText">
 258  <?php
 259      $options = "select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . (int)$languages_id . "' order by products_options_id";
 260      $options_split = new splitPageResults($option_page, MAX_ROW_LISTS_OPTIONS, $options, $options_query_numrows);
 261  
 262      echo $options_split->display_links($options_query_numrows, MAX_ROW_LISTS_OPTIONS, MAX_DISPLAY_PAGE_LINKS, $option_page, 'value_page=' . $value_page . '&attribute_page=' . $attribute_page, 'option_page');
 263  ?>
 264                  </td>
 265                </tr>
 266                <tr>
 267  <?php /* MOD: QT Pro Added 1 to colspan */ ?>
 268                  <td colspan="4"><?php echo tep_black_line(); ?></td>
 269                </tr>
 270                <tr class="dataTableHeadingRow">
 271                  <td class="dataTableHeadingContent">&nbsp;<?php echo TABLE_HEADING_ID; ?>&nbsp;</td>
 272                  <td class="dataTableHeadingContent">&nbsp;<?php echo TABLE_HEADING_OPT_NAME; ?>&nbsp;</td>
 273  <?php /* BOF: QT Pro changed "TABLE_HEADING_OPT_TYPE" to "TABLE_HEADING_TRACK_STOCK" */ ?>
 274                  <td class="dataTableHeadingContent">&nbsp;<?php echo TABLE_HEADING_TRACK_STOCK; ?>&nbsp;</td>
 275  <?php /* EOF: QT Pro */ ?>
 276                  <td class="dataTableHeadingContent" align="center">&nbsp;<?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
 277                </tr>
 278                <tr>
 279  <?php /* MOD: QT Pro Added 1 to colspan */ ?>
 280                  <td colspan="4"><?php echo tep_black_line(); ?></td>
 281                </tr>
 282  <?php
 283      $next_id = 1;
 284      $rows = 0;
 285      $options = tep_db_query($options);
 286      while ($options_values = tep_db_fetch_array($options)) {
 287        $rows++;
 288  ?>
 289                <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
 290  <?php
 291        if (($action == 'update_option') && ($HTTP_GET_VARS['option_id'] == $options_values['products_options_id'])) {
 292          echo '<form name="option" action="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=update_option_name&' . $page_info, 'NONSSL') . '" method="post">';
 293          $inputs = '';
 294          for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {
 295            $option_name = tep_db_query("select products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . $options_values['products_options_id'] . "' and language_id = '" . $languages[$i]['id'] . "'");
 296            $option_name = tep_db_fetch_array($option_name);
 297            $inputs .= $languages[$i]['code'] . ':&nbsp;<input type="text" name="option_name[' . $languages[$i]['id'] . ']" size="20" value="' . $option_name['products_options_name'] . '">&nbsp;<br>';
 298          }
 299  ?>
 300                  <td align="center" class="smallText">&nbsp;<?php echo $options_values['products_options_id']; ?><input type="hidden" name="option_id" value="<?php echo $options_values['products_options_id']; ?>">&nbsp;</td>
 301                  <td class="smallText"><?php echo $inputs; ?></td>
 302  <?php /* BOF: QT Pro */ ?>
 303                  <td align="center" class="smallText"><input type=checkbox name=track_stock <?php echo $options_values['products_options_track_stock']?"checked":""; ?>></td>
 304  <?php /* EOF: QT Pro */ ?>
 305                  <td align="center" class="smallText">&nbsp;<?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE); ?>&nbsp;<?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', IMAGE_CANCEL); ?></a>&nbsp;</td>
 306  <?php
 307          echo '</form>' . "\n";
 308        } else {
 309  ?>
 310                  <td align="center" class="smallText">&nbsp;<?php echo $options_values["products_options_id"]; ?>&nbsp;</td>
 311                  <td class="smallText">&nbsp;<?php echo $options_values["products_options_name"]; ?>&nbsp;</td>
 312  <?php /* BOF: QT Pro */ ?>
 313                  <td align="center" class="smallText">&nbsp;<?php echo $options_values['products_options_track_stock']?"Yes":"No"; ?></td>
 314  <?php /* EOF: QT Pro */ ?>
 315                  <td align="center" class="smallText">&nbsp;<?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=update_option&option_id=' . $options_values['products_options_id'] . '&option_order_by=' . $option_order_by . '&option_page=' . $option_page, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_edit.gif', IMAGE_UPDATE); ?></a>&nbsp;&nbsp;<?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=delete_product_option&option_id=' . $options_values['products_options_id'], 'NONSSL') , '">'; ?><?php echo tep_image_button('button_delete.gif', IMAGE_DELETE); ?></a>&nbsp;</td>
 316  <?php
 317        }
 318  ?>
 319                </tr>
 320  <?php
 321        $max_options_id_query = tep_db_query("select max(products_options_id) + 1 as next_id from " . TABLE_PRODUCTS_OPTIONS);
 322        $max_options_id_values = tep_db_fetch_array($max_options_id_query);
 323        $next_id = $max_options_id_values['next_id'];
 324      }
 325  ?>
 326                <tr>
 327  <?php /* MOD: QT Pro Added 1 to colspan */ ?>
 328                  <td colspan="4"><?php echo tep_black_line(); ?></td>
 329                </tr>
 330  <?php
 331      if ($action != 'update_option') {
 332  ?>
 333                <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
 334  <?php
 335        echo '<form name="options" action="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=add_product_options&' . $page_info, 'NONSSL') . '" method="post"><input type="hidden" name="products_options_id" value="' . $next_id . '">';
 336        $inputs = '';
 337        for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {
 338          $inputs .= $languages[$i]['code'] . ':&nbsp;<input type="text" name="option_name[' . $languages[$i]['id'] . ']" size="20">&nbsp;<br>';
 339        }
 340  ?>
 341                  <td align="center" class="smallText">&nbsp;<?php echo $next_id; ?>&nbsp;</td>
 342                  <td class="smallText"><?php echo $inputs; ?></td>
 343  <?php /* BOF: QT Pro */ ?>
 344                  <td align="center" ><input type=checkbox name=track_stock></td>
 345                  <td align="left" class="smallText">&nbsp;<?php echo tep_image_submit('button_insert.gif', IMAGE_INSERT); ?>&nbsp;</td>
 346  <?php /* EOF: QT Pro */ ?>
 347  <?php
 348        echo '</form>';
 349  ?>
 350                </tr>
 351                <tr>
 352  <?php /* MOD: QT Pro Added 1 to colspan */ ?>
 353                  <td colspan="4"><?php echo tep_black_line(); ?></td>
 354                </tr>
 355  <?php
 356      }
 357    }
 358  ?>
 359              </table></td>
 360  <!-- options eof //-->
 361              <td valign="top" width="50%"><table width="100%" border="0" cellspacing="0" cellpadding="2">
 362  <!-- value //-->
 363  <?php
 364    if ($action == 'delete_option_value') { // delete product option value
 365      $values = tep_db_query("select products_options_values_id, products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int)$HTTP_GET_VARS['value_id'] . "' and language_id = '" . (int)$languages_id . "'");
 366      $values_values = tep_db_fetch_array($values);
 367  ?>
 368                <tr>
 369                  <td colspan="3" class="pageHeading">&nbsp;<?php echo $values_values['products_options_values_name']; ?>&nbsp;</td>
 370                </tr>
 371                <tr>
 372                  <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
 373                    <tr>
 374                      <td colspan="3"><?php echo tep_black_line(); ?></td>
 375                    </tr>
 376  <?php
 377      $products = tep_db_query("select p.products_id, pd.products_name, po.products_options_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS . " po, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and po.language_id = '" . (int)$languages_id . "' and pa.products_id = p.products_id and pa.options_values_id='" . (int)$HTTP_GET_VARS['value_id'] . "' and po.products_options_id = pa.options_id order by pd.products_name");
 378      if (tep_db_num_rows($products)) {
 379  ?>
 380                    <tr class="dataTableHeadingRow">
 381                      <td class="dataTableHeadingContent" align="center">&nbsp;<?php echo TABLE_HEADING_ID; ?>&nbsp;</td>
 382                      <td class="dataTableHeadingContent">&nbsp;<?php echo TABLE_HEADING_PRODUCT; ?>&nbsp;</td>
 383                      <td class="dataTableHeadingContent">&nbsp;<?php echo TABLE_HEADING_OPT_NAME; ?>&nbsp;</td>
 384                    </tr>
 385                    <tr>
 386                      <td colspan="3"><?php echo tep_black_line(); ?></td>
 387                    </tr>
 388  <?php
 389        while ($products_values = tep_db_fetch_array($products)) {
 390          $rows++;
 391  ?>
 392                    <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
 393                      <td align="center" class="smallText">&nbsp;<?php echo $products_values['products_id']; ?>&nbsp;</td>
 394                      <td class="smallText">&nbsp;<?php echo $products_values['products_name']; ?>&nbsp;</td>
 395                      <td class="smallText">&nbsp;<?php echo $products_values['products_options_name']; ?>&nbsp;</td>
 396                    </tr>
 397  <?php
 398        }
 399  ?>
 400                    <tr>
 401                      <td colspan="3"><?php echo tep_black_line(); ?></td>
 402                    </tr>
 403                    <tr>
 404                      <td class="main" colspan="3"><br><?php echo TEXT_WARNING_OF_DELETE; ?></td>
 405                    </tr>
 406                    <tr>
 407                      <td class="main" align="right" colspan="3"><br><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', ' cancel '); ?></a>&nbsp;</td>
 408                    </tr>
 409  <?php
 410      } else {
 411  ?>
 412                    <tr>
 413                      <td class="main" colspan="3"><br><?php echo TEXT_OK_TO_DELETE; ?></td>
 414                    </tr>
 415                    <tr>
 416                      <td class="main" align="right" colspan="3"><br><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=delete_value&value_id=' . $HTTP_GET_VARS['value_id'] . '&' . $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_delete.gif', ' delete '); ?></a>&nbsp;&nbsp;&nbsp;<?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', ' cancel '); ?></a>&nbsp;</td>
 417                    </tr>
 418  <?php
 419      }
 420  ?>
 421                    </table></td>
 422                </tr>
 423  <?php
 424    } else {
 425  ?>
 426                <tr>
 427                  <td colspan="3" class="pageHeading">&nbsp;<?php echo HEADING_TITLE_VAL; ?>&nbsp;</td>
 428                </tr>
 429                <tr>
 430                  <td colspan="4" class="smallText">
 431  <?php
 432      $values = "select pov.products_options_values_id, pov.products_options_values_name, pov2po.products_options_id from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov left join " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " pov2po on pov.products_options_values_id = pov2po.products_options_values_id where pov.language_id = '" . (int)$languages_id . "' order by pov.products_options_values_id";
 433      $values_split = new splitPageResults($value_page, MAX_ROW_LISTS_OPTIONS, $values, $values_query_numrows);
 434  
 435      echo $values_split->display_links($values_query_numrows, MAX_ROW_LISTS_OPTIONS, MAX_DISPLAY_PAGE_LINKS, $value_page, 'option_page=' . $option_page . '&attribute_page=' . $attribute_page, 'value_page');
 436  ?>
 437                  </td>
 438                </tr>
 439                <tr>
 440                  <td colspan="4"><?php echo tep_black_line(); ?></td>
 441                </tr>
 442                <tr class="dataTableHeadingRow">
 443                  <td class="dataTableHeadingContent">&nbsp;<?php echo TABLE_HEADING_ID; ?>&nbsp;</td>
 444                  <td class="dataTableHeadingContent">&nbsp;<?php echo TABLE_HEADING_OPT_NAME; ?>&nbsp;</td>
 445                  <td class="dataTableHeadingContent">&nbsp;<?php echo TABLE_HEADING_OPT_VALUE; ?>&nbsp;</td>
 446                  <td class="dataTableHeadingContent" align="center">&nbsp;<?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
 447                </tr>
 448                <tr>
 449                  <td colspan="4"><?php echo tep_black_line(); ?></td>
 450                </tr>
 451  <?php
 452      $next_id = 1;
 453      $rows = 0;
 454      $values = tep_db_query($values);
 455      while ($values_values = tep_db_fetch_array($values)) {
 456        $options_name = tep_options_name($values_values['products_options_id']);
 457        $values_name = $values_values['products_options_values_name'];
 458        $rows++;
 459  ?>
 460                <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
 461  <?php
 462        if (($action == 'update_option_value') && ($HTTP_GET_VARS['value_id'] == $values_values['products_options_values_id'])) {
 463          echo '<form name="values" action="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=update_value&' . $page_info, 'NONSSL') . '" method="post">';
 464          $inputs = '';
 465          for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {
 466            $value_name = tep_db_query("select products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int)$values_values['products_options_values_id'] . "' and language_id = '" . (int)$languages[$i]['id'] . "'");
 467            $value_name = tep_db_fetch_array($value_name);
 468            $inputs .= $languages[$i]['code'] . ':&nbsp;<input type="text" name="value_name[' . $languages[$i]['id'] . ']" size="15" value="' . $value_name['products_options_values_name'] . '">&nbsp;<br>';
 469          }
 470  ?>
 471                  <td align="center" class="smallText">&nbsp;<?php echo $values_values['products_options_values_id']; ?><input type="hidden" name="value_id" value="<?php echo $values_values['products_options_values_id']; ?>">&nbsp;</td>
 472                  <td align="center" class="smallText">&nbsp;<?php echo "\n"; ?><select name="option_id">
 473  <?php
 474          $options = tep_db_query("select products_options_id, products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . (int)$languages_id . "' order by products_options_name");
 475          while ($options_values = tep_db_fetch_array($options)) {
 476            echo "\n" . '<option name="' . $options_values['products_options_name'] . '" value="' . $options_values['products_options_id'] . '"';
 477            if ($values_values['products_options_id'] == $options_values['products_options_id']) { 
 478              echo ' selected';
 479            }
 480            echo '>' . $options_values['products_options_name'] . '</option>';
 481          } 
 482  ?>
 483                  </select>&nbsp;</td>
 484                  <td class="smallText"><?php echo $inputs; ?></td>
 485                  <td align="center" class="smallText">&nbsp;<?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE); ?>&nbsp;<?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', IMAGE_CANCEL); ?></a>&nbsp;</td>
 486  <?php
 487          echo '</form>';
 488        } else {
 489  ?>
 490                  <td align="center" class="smallText">&nbsp;<?php echo $values_values["products_options_values_id"]; ?>&nbsp;</td>
 491                  <td align="center" class="smallText">&nbsp;<?php echo $options_name; ?>&nbsp;</td>
 492                  <td class="smallText">&nbsp;<?php echo $values_name; ?>&nbsp;</td>
 493                  <td align="center" class="smallText">&nbsp;<?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=update_option_value&value_id=' . $values_values['products_options_values_id'] . (isset($HTTP_GET_VARS['value_page']) ? '&value_page=' . $HTTP_GET_VARS['value_page'] : ''), 'NONSSL') . '">'; ?><?php echo tep_image_button('button_edit.gif', IMAGE_UPDATE); ?></a>&nbsp;&nbsp;<?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=delete_option_value&value_id=' . $values_values['products_options_values_id'], 'NONSSL') , '">'; ?><?php echo tep_image_button('button_delete.gif', IMAGE_DELETE); ?></a>&nbsp;</td>
 494  <?php
 495        }
 496        $max_values_id_query = tep_db_query("select max(products_options_values_id) + 1 as next_id from " . TABLE_PRODUCTS_OPTIONS_VALUES);
 497        $max_values_id_values = tep_db_fetch_array($max_values_id_query);
 498        $next_id = $max_values_id_values['next_id'];
 499      }
 500  ?>
 501                </tr>
 502                <tr>
 503                  <td colspan="4"><?php echo tep_black_line(); ?></td>
 504                </tr>
 505  <?php
 506      if ($action != 'update_option_value') {
 507  ?>
 508                <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
 509  <?php
 510        echo '<form name="values" action="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=add_product_option_values&value_page=' . $value_page, 'NONSSL') . '" method="post">';
 511  ?>
 512                  <td align="center" class="smallText">&nbsp;<?php echo $next_id; ?>&nbsp;</td>
 513                  <td align="center" class="smallText">&nbsp;<select name="option_id">
 514  <?php
 515        $options = tep_db_query("select products_options_id, products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . $languages_id . "' order by products_options_name");
 516        while ($options_values = tep_db_fetch_array($options)) {
 517          echo '<option name="' . $options_values['products_options_name'] . '" value="' . $options_values['products_options_id'] . '">' . $options_values['products_options_name'] . '</option>';
 518        }
 519  
 520        $inputs = '';
 521        for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {
 522          $inputs .= $languages[$i]['code'] . ':&nbsp;<input type="text" name="value_name[' . $languages[$i]['id'] . ']" size="15">&nbsp;<br>';
 523        }
 524  ?>
 525                  </select>&nbsp;</td>
 526                  <td class="smallText"><input type="hidden" name="value_id" value="<?php echo $next_id; ?>"><?php echo $inputs; ?></td>
 527                  <td align="center" class="smallText">&nbsp;<?php echo tep_image_submit('button_insert.gif', IMAGE_INSERT); ?>&nbsp;</td>
 528  <?php
 529        echo '</form>';
 530  ?>
 531                </tr>
 532                <tr>
 533                  <td colspan="4"><?php echo tep_black_line(); ?></td>
 534                </tr>
 535  <?php
 536      }
 537    }
 538  ?>
 539              </table></td>
 540            </tr>
 541          </table></td>
 542  <!-- option value eof //-->
 543        </tr> 
 544  <!-- products_attributes //-->  
 545        <tr>
 546          <td class="smallText">&nbsp;</td>
 547        </tr>
 548        <tr>
 549          <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
 550            <tr>
 551              <td class="pageHeading">&nbsp;<?php echo HEADING_TITLE_ATRIB; ?>&nbsp;</td>
 552            </tr>
 553          </table></td>
 554        </tr>
 555        <tr>
 556  <?php
 557    if ($action == 'update_attribute') {
 558      $form_action = 'update_product_attribute';
 559    } else {
 560      $form_action = 'add_product_attributes';
 561    }
 562  ?>
 563          <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
 564            <tr>
 565              <td class="smallText" align="right">
 566  <?php
 567    $attributes = "select pa.* from " . TABLE_PRODUCTS_ATTRIBUTES . " pa left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on pa.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by pd.products_name";
 568    $attributes_split = new splitPageResults($attribute_page, MAX_ROW_LISTS_OPTIONS, $attributes, $attributes_query_numrows);
 569  
 570    echo $attributes_split->display_links($attributes_query_numrows, MAX_ROW_LISTS_OPTIONS, MAX_DISPLAY_PAGE_LINKS, $attribute_page, 'option_page=' . $option_page . '&value_page=' . $value_page, 'attribute_page');
 571  ?>
 572              </td>
 573            </tr>
 574          </table>
 575          <form name="attributes" action="<?php echo tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=' . $form_action . '&' . $page_info); ?>" method="post"><table border="0" width="100%" cellspacing="0" cellpadding="2">
 576            <tr>
 577              <td colspan="7"><?php echo tep_black_line(); ?></td>
 578            </tr>
 579            <tr class="dataTableHeadingRow">
 580              <td class="dataTableHeadingContent">&nbsp;<?php echo TABLE_HEADING_ID; ?>&nbsp;</td>
 581              <td class="dataTableHeadingContent">&nbsp;<?php echo TABLE_HEADING_PRODUCT; ?>&nbsp;</td>
 582              <td class="dataTableHeadingContent">&nbsp;<?php echo TABLE_HEADING_OPT_NAME; ?>&nbsp;</td>
 583              <td class="dataTableHeadingContent">&nbsp;<?php echo TABLE_HEADING_OPT_VALUE; ?>&nbsp;</td>
 584              <td class="dataTableHeadingContent" align="right">&nbsp;<?php echo TABLE_HEADING_OPT_PRICE; ?>&nbsp;</td>
 585              <td class="dataTableHeadingContent" align="center">&nbsp;<?php echo TABLE_HEADING_OPT_PRICE_PREFIX; ?>&nbsp;</td>
 586              <td class="dataTableHeadingContent" align="center">&nbsp;<?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
 587            </tr>
 588            <tr>
 589              <td colspan="7"><?php echo tep_black_line(); ?></td>
 590            </tr>
 591  <?php
 592    $next_id = 1;
 593    $attributes = tep_db_query($attributes);
 594    while ($attributes_values = tep_db_fetch_array($attributes)) {
 595      $products_name_only = tep_get_products_name($attributes_values['products_id']);
 596      $options_name = tep_options_name($attributes_values['options_id']);
 597      $values_name = tep_values_name($attributes_values['options_values_id']);
 598      $rows++;
 599  ?>
 600            <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
 601  <?php
 602      if (($action == 'update_attribute') && ($HTTP_GET_VARS['attribute_id'] == $attributes_values['products_attributes_id'])) {
 603  ?>
 604              <td class="smallText">&nbsp;<?php echo $attributes_values['products_attributes_id']; ?><input type="hidden" name="attribute_id" value="<?php echo $attributes_values['products_attributes_id']; ?>">&nbsp;</td>
 605              <td class="smallText">&nbsp;<select name="products_id">
 606  <?php
 607        $products = tep_db_query("select p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "' order by pd.products_name");
 608        while($products_values = tep_db_fetch_array($products)) {
 609          if ($attributes_values['products_id'] == $products_values['products_id']) {
 610            echo "\n" . '<option name="' . $products_values['products_name'] . '" value="' . $products_values['products_id'] . '" SELECTED>' . $products_values['products_name'] . '</option>';
 611          } else {
 612            echo "\n" . '<option name="' . $products_values['products_name'] . '" value="' . $products_values['products_id'] . '">' . $products_values['products_name'] . '</option>';
 613          }
 614        } 
 615  ?>
 616              </select>&nbsp;</td>
 617              <td class="smallText">&nbsp;<select name="options_id">
 618  <?php
 619        $options = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . $languages_id . "' order by products_options_name");
 620        while($options_values = tep_db_fetch_array($options)) {
 621          if ($attributes_values['options_id'] == $options_values['products_options_id']) {
 622            echo "\n" . '<option name="' . $options_values['products_options_name'] . '" value="' . $options_values['products_options_id'] . '" SELECTED>' . $options_values['products_options_name'] . '</option>';
 623          } else {
 624            echo "\n" . '<option name="' . $options_values['products_options_name'] . '" value="' . $options_values['products_options_id'] . '">' . $options_values['products_options_name'] . '</option>';
 625          }
 626        } 
 627  ?>
 628              </select>&nbsp;</td>
 629              <td class="smallText">&nbsp;<select name="values_id">
 630  <?php
 631        $values = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where language_id ='" . $languages_id . "' order by products_options_values_name");
 632        while($values_values = tep_db_fetch_array($values)) {
 633          if ($attributes_values['options_values_id'] == $values_values['products_options_values_id']) {
 634            echo "\n" . '<option name="' . $values_values['products_options_values_name'] . '" value="' . $values_values['products_options_values_id'] . '" SELECTED>' . $values_values['products_options_values_name'] . '</option>';
 635          } else {
 636            echo "\n" . '<option name="' . $values_values['products_options_values_name'] . '" value="' . $values_values['products_options_values_id'] . '">' . $values_values['products_options_values_name'] . '</option>';
 637          }
 638        } 
 639  ?>        
 640              </select>&nbsp;</td>
 641              <td align="right" class="smallText">&nbsp;<input type="text" name="value_price" value="<?php echo $attributes_values['options_values_price']; ?>" size="6">&nbsp;</td>
 642              <td align="center" class="smallText">&nbsp;<input type="text" name="price_prefix" value="<?php echo $attributes_values['price_prefix']; ?>" size="2">&nbsp;</td>
 643              <td align="center" class="smallText">&nbsp;<?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE); ?>&nbsp;<?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', IMAGE_CANCEL); ?></a>&nbsp;</td>
 644  <?php
 645        if (DOWNLOAD_ENABLED == 'true') {
 646          $download_query_raw ="select products_attributes_filename, products_attributes_maxdays, products_attributes_maxcount 
 647                                from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " 
 648                                where products_attributes_id='" . $attributes_values['products_attributes_id'] . "'";
 649          $download_query = tep_db_query($download_query_raw);
 650          if (tep_db_num_rows($download_query) > 0) {
 651            $download = tep_db_fetch_array($download_query);
 652            $products_attributes_filename = $download['products_attributes_filename'];
 653            $products_attributes_maxdays  = $download['products_attributes_maxdays'];
 654            $products_attributes_maxcount = $download['products_attributes_maxcount'];
 655          }
 656  ?>
 657            <tr class="<?php echo (!($rows % 2)? 'attributes-even' : 'attributes-odd');?>">
 658              <td>&nbsp;</td>
 659              <td colspan="5">
 660                <table>
 661                  <tr class="<?php echo (!($rows % 2)? 'attributes-even' : 'attributes-odd');?>">
 662                    <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_DOWNLOAD; ?>&nbsp;</td>
 663                    <td class="smallText"><?php echo TABLE_TEXT_FILENAME; ?></td>
 664                    <td class="smallText"><?php echo tep_draw_input_field('products_attributes_filename', $products_attributes_filename, 'size="15"'); ?>&nbsp;</td>
 665                    <td class="smallText"><?php echo TABLE_TEXT_MAX_DAYS; ?></td>
 666                    <td class="smallText"><?php echo tep_draw_input_field('products_attributes_maxdays', $products_attributes_maxdays, 'size="5"'); ?>&nbsp;</td>
 667                    <td class="smallText"><?php echo TABLE_TEXT_MAX_COUNT; ?></td>
 668                    <td class="smallText"><?php echo tep_draw_input_field('products_attributes_maxcount', $products_attributes_maxcount, 'size="5"'); ?>&nbsp;</td>
 669                  </tr>
 670                </table>
 671              </td>
 672              <td>&nbsp;</td>
 673            </tr>
 674  <?php
 675        }
 676  ?>
 677  <?php
 678      } elseif (($action == 'delete_product_attribute') && ($HTTP_GET_VARS['attribute_id'] == $attributes_values['products_attributes_id'])) {
 679  ?>
 680              <td class="smallText">&nbsp;<b><?php echo $attributes_values["products_attributes_id"]; ?></b>&nbsp;</td>
 681              <td class="smallText">&nbsp;<b><?php echo $products_name_only; ?></b>&nbsp;</td>
 682              <td class="smallText">&nbsp;<b><?php echo $options_name; ?></b>&nbsp;</td>
 683              <td class="smallText">&nbsp;<b><?php echo $values_name; ?></b>&nbsp;</td>
 684              <td align="right" class="smallText">&nbsp;<b><?php echo $attributes_values["options_values_price"]; ?></b>&nbsp;</td>
 685              <td align="center" class="smallText">&nbsp;<b><?php echo $attributes_values["price_prefix"]; ?></b>&nbsp;</td>
 686              <td align="center" class="smallText">&nbsp;<b><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=delete_attribute&attribute_id=' . $HTTP_GET_VARS['attribute_id'] . '&' . $page_info) . '">'; ?><?php echo tep_image_button('button_confirm.gif', IMAGE_CONFIRM); ?></a>&nbsp;&nbsp;<?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', IMAGE_CANCEL); ?></a>&nbsp;</b></td>
 687  <?php
 688      } else {
 689  ?>
 690              <td class="smallText">&nbsp;<?php echo $attributes_values["products_attributes_id"]; ?>&nbsp;</td>
 691              <td class="smallText">&nbsp;<?php echo $products_name_only; ?>&nbsp;</td>
 692              <td class="smallText">&nbsp;<?php echo $options_name; ?>&nbsp;</td>
 693              <td class="smallText">&nbsp;<?php echo $values_name; ?>&nbsp;</td>
 694              <td align="right" class="smallText">&nbsp;<?php echo $attributes_values["options_values_price"]; ?>&nbsp;</td>
 695              <td align="center" class="smallText">&nbsp;<?php echo $attributes_values["price_prefix"]; ?>&nbsp;</td>
 696              <td align="center" class="smallText">&nbsp;<?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=update_attribute&attribute_id=' . $attributes_values['products_attributes_id'] . '&' . $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_edit.gif', IMAGE_UPDATE); ?></a>&nbsp;&nbsp;<?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=delete_product_attribute&attribute_id=' . $attributes_values['products_attributes_id'] . '&' . $page_info, 'NONSSL') , '">'; ?><?php echo tep_image_button('button_delete.gif', IMAGE_DELETE); ?></a>&nbsp;</td>
 697  <?php
 698      }
 699      $max_attributes_id_query = tep_db_query("select max(products_attributes_id) + 1 as next_id from " . TABLE_PRODUCTS_ATTRIBUTES);
 700      $max_attributes_id_values = tep_db_fetch_array($max_attributes_id_query);
 701      $next_id = $max_attributes_id_values['next_id'];
 702  ?>
 703            </tr>
 704  <?php
 705    }
 706    if ($action != 'update_attribute') {
 707  ?>
 708            <tr>
 709              <td colspan="7"><?php echo tep_black_line(); ?></td>
 710            </tr>
 711            <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
 712              <td class="smallText">&nbsp;<?php echo $next_id; ?>&nbsp;</td>
 713                <td class="smallText">&nbsp;<select name="products_id">
 714  <?php
 715      $products = tep_db_query("select p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "' order by pd.products_name");
 716      while ($products_values = tep_db_fetch_array($products)) {
 717        echo '<option name="' . $products_values['products_name'] . '" value="' . $products_values['products_id'] . '">' . $products_values['products_name'] . '</option>';
 718      } 
 719  ?>
 720              </select>&nbsp;</td>
 721              <td class="smallText">&nbsp;<select name="options_id">
 722  <?php
 723      $options = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . $languages_id . "' order by products_options_name");
 724      while ($options_values = tep_db_fetch_array($options)) {
 725        echo '<option name="' . $options_values['products_options_name'] . '" value="' . $options_values['products_options_id'] . '">' . $options_values['products_options_name'] . '</option>';
 726      } 
 727  ?>
 728              </select>&nbsp;</td>
 729              <td class="smallText">&nbsp;<select name="values_id">
 730  <?php
 731      $values = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where language_id = '" . $languages_id . "' order by products_options_values_name");
 732      while ($values_values = tep_db_fetch_array($values)) {
 733        echo '<option name="' . $values_values['products_options_values_name'] . '" value="' . $values_values['products_options_values_id'] . '">' . $values_values['products_options_values_name'] . '</option>';
 734      } 
 735  ?>
 736              </select>&nbsp;</td>
 737              <td align="right" class="smallText">&nbsp;<input type="text" name="value_price" size="6">&nbsp;</td>
 738              <td align="right" class="smallText">&nbsp;<input type="text" name="price_prefix" size="2" value="+">&nbsp;</td>
 739              <td align="center" class="smallText">&nbsp;<?php echo tep_image_submit('button_insert.gif', IMAGE_INSERT); ?>&nbsp;</td>
 740            </tr>
 741  <?php
 742        if (DOWNLOAD_ENABLED == 'true') {
 743          $products_attributes_maxdays  = DOWNLOAD_MAX_DAYS;
 744          $products_attributes_maxcount = DOWNLOAD_MAX_COUNT;
 745  ?>
 746            <tr class="<?php echo (!($rows % 2)? 'attributes-even' : 'attributes-odd');?>">
 747              <td>&nbsp;</td>
 748              <td colspan="5">
 749                <table>
 750                  <tr class="<?php echo (!($rows % 2)? 'attributes-even' : 'attributes-odd');?>">
 751                    <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_DOWNLOAD; ?>&nbsp;</td>
 752                    <td class="smallText"><?php echo TABLE_TEXT_FILENAME; ?></td>
 753                    <td class="smallText"><?php echo tep_draw_input_field('products_attributes_filename', $products_attributes_filename, 'size="15"'); ?>&nbsp;</td>
 754                    <td class="smallText"><?php echo TABLE_TEXT_MAX_DAYS; ?></td>
 755                    <td class="smallText"><?php echo tep_draw_input_field('products_attributes_maxdays', $products_attributes_maxdays, 'size="5"'); ?>&nbsp;</td>
 756                    <td class="smallText"><?php echo TABLE_TEXT_MAX_COUNT; ?></td>
 757                    <td class="smallText"><?php echo tep_draw_input_field('products_attributes_maxcount', $products_attributes_maxcount, 'size="5"'); ?>&nbsp;</td>
 758                  </tr>
 759                </table>
 760              </td>
 761              <td>&nbsp;</td>
 762            </tr>
 763  <?php
 764        } // end of DOWNLOAD_ENABLED section

 765  ?>
 766  <?php
 767    }
 768  ?>
 769            <tr>
 770              <td colspan="7"><?php echo tep_black_line(); ?></td>
 771            </tr>
 772          </table></form></td>
 773        </tr>
 774      </table></td>
 775  <!-- products_attributes_eof //-->
 776    </tr>
 777  </table>
 778  <!-- body_text_eof //-->
 779  <!-- footer //-->
 780  <?php require (DIR_WS_INCLUDES . 'footer.php'); ?>
 781  <!-- footer_eof //-->
 782  </body>
 783  </html>
 784  <?php require (DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7