ZenCart_Documentation  1.5.0
http://www.collinsharper.com
C:/xampp/htdocs/zen-cart/admin/attributes_controller.php
Go to the documentation of this file.
00001 <?php
00009   require('includes/application_top.php');
00010   // troubleshooting/debug of option name/value IDs:
00011   $show_name_numbers = true;
00012   $show_value_numbers = true;
00013   // verify option names, values, products
00014   $chk_option_names = $db->Execute("select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id='" . (int)$_SESSION['languages_id'] . "' limit 1");
00015   if ($chk_option_names->RecordCount() < 1) {
00016     $messageStack->add_session(ERROR_DEFINE_OPTION_NAMES, 'caution');
00017     zen_redirect(zen_href_link(FILENAME_OPTIONS_NAME_MANAGER));
00018   }
00019   $chk_option_values = $db->Execute("select * from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where language_id='" . (int)$_SESSION['languages_id'] . "' limit 1");
00020   if ($chk_option_values->RecordCount() < 1) {
00021     $messageStack->add_session(ERROR_DEFINE_OPTION_VALUES, 'caution');
00022     zen_redirect(zen_href_link(FILENAME_OPTIONS_VALUES_MANAGER));
00023   }
00024   $chk_products = $db->Execute("select * from " . TABLE_PRODUCTS . " limit 1");
00025   if ($chk_products->RecordCount() < 1) {
00026     $messageStack->add_session(ERROR_DEFINE_PRODUCTS, 'caution');
00027     zen_redirect(zen_href_link(FILENAME_CATEGORIES));
00028   }
00029 
00030   require(DIR_WS_CLASSES . 'currencies.php');
00031   $currencies = new currencies();
00032 
00033   $languages = zen_get_languages();
00034 
00035   $action = (isset($_GET['action']) ? $_GET['action'] : '');
00036 
00037   $_GET['products_filter'] = $products_filter = (isset($_GET['products_filter']) ? (int)$_GET['products_filter'] : (int)$products_filter);
00038   $_GET['attributes_id'] = (isset($_GET['attributes_id']) ? (int)$_GET['attributes_id'] : 0);
00039 
00040   $_GET['current_category_id'] = $current_category_id = (isset($_GET['current_category_id']) ? (int)$_GET['current_category_id'] : (int)$current_category_id);
00041   if (isset($_POST['products_filter'])) $_POST['products_filter'] = (int)$_POST['products_filter'];
00042   if (isset($_POST['current_category_id'])) $_POST['current_category_id'] = (int)$_POST['current_category_id'];
00043   if (isset($_POST['products_options_id_all'])) $_POST['products_options_id_all'] = (int)$_POST['products_options_id_all'];
00044   if (isset($_POST['current_category_id'])) $_POST['current_category_id'] = (int)$_POST['current_category_id'];
00045   if (isset($_POST['categories_update_id'])) $_POST['categories_update_id'] = (int)$_POST['categories_update_id'];
00046 
00047   if ($action == 'new_cat') {
00048     $sql =     "select ptc.*
00049     from " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc
00050     left join " . TABLE_PRODUCTS_DESCRIPTION . " pd
00051     on ptc.products_id = pd.products_id
00052     and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
00053     where ptc.categories_id='" . $current_category_id . "'
00054     order by pd.products_name";
00055     $new_product_query = $db->Execute($sql);
00056     $products_filter = $new_product_query->fields['products_id'];
00057     zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
00058   }
00059 
00060 // set categories and products if not set
00061   if ($products_filter == '' and $current_category_id != '') {
00062     $sql =     "select ptc.*
00063     from " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc
00064     left join " . TABLE_PRODUCTS_DESCRIPTION . " pd
00065     on ptc.products_id = pd.products_id
00066     and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
00067     where ptc.categories_id='" . $current_category_id . "'
00068     order by pd.products_name";
00069     $new_product_query = $db->Execute($sql);
00070     $products_filter = $new_product_query->fields['products_id'];
00071     if ($products_filter != '') {
00072       zen_redirect(zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
00073     }
00074   } else {
00075     if ($products_filter == '' and $current_category_id == '') {
00076       $reset_categories_id = zen_get_category_tree('', '', '0', '', '', true);
00077       $current_category_id = $reset_categories_id[0]['id'];
00078       $sql = "select ptc.*
00079       from " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc
00080       left join " . TABLE_PRODUCTS_DESCRIPTION . " pd
00081       on ptc.products_id = pd.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
00082       where ptc.categories_id='" . $current_category_id . "'
00083       order by pd.products_name";
00084       $new_product_query = $db->Execute($sql);
00085       $products_filter = $new_product_query->fields['products_id'];
00086       $_GET['products_filter'] = $products_filter;
00087     }
00088   }
00089 
00090   require(DIR_WS_MODULES . FILENAME_PREV_NEXT);
00091 
00092   if (zen_not_null($action)) {
00093     $_SESSION['page_info'] = '';
00094     if (isset($_GET['option_page'])) $_SESSION['page_info'] .= 'option_page=' . $_GET['option_page'] . '&';
00095     if (isset($_GET['value_page'])) $_SESSION['page_info'] .= 'value_page=' . $_GET['value_page'] . '&';
00096     if (isset($_GET['attribute_page'])) $_SESSION['page_info'] .= 'attribute_page=' . $_GET['attribute_page'] . '&';
00097     if (isset($_GET['products_filter'])) $_SESSION['page_info'] .= 'products_filter=' . $_GET['products_filter'] . '&';
00098     if (isset($_GET['current_category_id'])) $_SESSION['page_info'] .= 'current_category_id=' . $_GET['current_category_id'] . '&';
00099 
00100     if (zen_not_null($_SESSION['page_info'])) {
00101       $_SESSION['page_info'] = substr($_SESSION['page_info'], 0, -1);
00102     }
00103 
00104     switch ($action) {
00107       case 'set_flag_attributes_display_only':
00108         if (isset($_POST['divertClickProto']))
00109         {
00110           $action='';
00111           $new_flag= $db->Execute("select products_attributes_id, products_id, attributes_display_only from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
00112           if ($new_flag->fields['attributes_display_only'] == '0') {
00113             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . " set attributes_display_only='1' where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
00114           } else {
00115             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . " set attributes_display_only='0' where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
00116           }
00117         }
00118         break;
00119 
00120       case 'set_flag_product_attribute_is_free':
00121         if (isset($_POST['divertClickProto']))
00122         {
00123           $action='';
00124           $new_flag= $db->Execute("select products_attributes_id, products_id, product_attribute_is_free from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
00125           if ($new_flag->fields['product_attribute_is_free'] == '0') {
00126             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . " set product_attribute_is_free='1' where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
00127           } else {
00128             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . " set product_attribute_is_free='0' where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
00129           }
00130           zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, $_SESSION['page_info'] . '&products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $_GET['current_category_id']));
00131         }
00132         break;
00133 
00134       case 'set_flag_attributes_default':
00135         if (isset($_POST['divertClickProto']))
00136         {
00137           $action='';
00138           $new_flag= $db->Execute("select products_attributes_id, products_id, attributes_default from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
00139           if ($new_flag->fields['attributes_default'] == '0') {
00140             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . " set attributes_default='1' where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
00141           } else {
00142             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . " set attributes_default='0' where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
00143           }
00144           zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, $_SESSION['page_info'] . '&products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $_GET['current_category_id']));
00145         }
00146         break;
00147 
00148       case 'set_flag_attributes_discounted':
00149         if (isset($_POST['divertClickProto']))
00150         {
00151           $action='';
00152           $new_flag= $db->Execute("select products_attributes_id, products_id, attributes_discounted from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
00153           if ($new_flag->fields['attributes_discounted'] == '0') {
00154             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . " set attributes_discounted='1' where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
00155           } else {
00156             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . " set attributes_discounted='0' where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
00157           }
00158           // reset products_price_sorter for searches etc.
00159           zen_update_products_price_sorter($_GET['products_filter']);
00160           zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, $_SESSION['page_info'] . '&products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $_GET['current_category_id']));
00161         }
00162         break;
00163 
00164       case 'set_flag_attributes_price_base_included':
00165         if (isset($_POST['divertClickProto']))
00166         {
00167           $action='';
00168           $new_flag= $db->Execute("select products_attributes_id, products_id, attributes_price_base_included from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
00169           if ($new_flag->fields['attributes_price_base_included'] == '0') {
00170             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . " set attributes_price_base_included='1' where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
00171           } else {
00172             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . " set attributes_price_base_included='0' where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
00173           }
00174 
00175           // reset products_price_sorter for searches etc.
00176           zen_update_products_price_sorter($_GET['products_filter']);
00177 
00178           zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, $_SESSION['page_info'] . '&products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $_GET['current_category_id']));
00179         }
00180         break;
00181 
00182       case 'set_flag_attributes_required':
00183         if (isset($_POST['divertClickProto']))
00184         {
00185           $action='';
00186           $new_flag= $db->Execute("select products_attributes_id, products_id, attributes_required from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
00187           if ($new_flag->fields['attributes_required'] == '0') {
00188             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . " set attributes_required='1' where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
00189           } else {
00190             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . " set attributes_required='0' where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
00191           }
00192           zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, $_SESSION['page_info'] . '&products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $_GET['current_category_id']));
00193         }
00194         break;
00195 
00198 
00199       case 'set_products_filter':
00200         $_GET['products_filter'] = (int)$_POST['products_filter'];
00201         $_GET['current_category_id'] = (int)$_POST['current_category_id'];
00202         $action='';
00203         zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, $_SESSION['page_info'] . '&products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $_GET['current_category_id']));
00204         break;
00205 // update by product
00206       case ('update_attribute_sort'):
00207         if (isset($_POST['confirm']) && $_POST['confirm'] == 'y')
00208         {
00209           if (!zen_has_product_attributes($products_filter, 'false')) {
00210             $messageStack->add_session(SUCCESS_PRODUCT_UPDATE_SORT_NONE . $products_filter . ' ' . zen_get_products_name($products_filter, $_SESSION['languages_id']), 'error');
00211           } else {
00212             zen_update_attributes_products_option_values_sort_order($products_filter);
00213             $messageStack->add_session(SUCCESS_PRODUCT_UPDATE_SORT . $products_filter . ' ' . zen_get_products_name($products_filter, $_SESSION['languages_id']), 'success');
00214           }
00215           $action='';
00216           zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $_GET['current_category_id']));
00217         }
00218         break;
00219       case 'add_product_attributes':
00220         $current_image_name = '';
00221         for ($i=0; $i<sizeof($_POST['values_id']); $i++) {
00222           if (isset($_POST['values_id'][$i])) $_POST['values_id'][$i] = (int)$_POST['values_id'][$i];
00223           if (isset($_POST['options_id'])) $_POST['options_id'] = (int)$_POST['options_id'];
00224           if (isset($_POST['products_id'])) $_POST['products_id'] = (int)$_POST['products_id'];
00225 // check for duplicate and block them
00226           $check_duplicate = $db->Execute("select * from " . TABLE_PRODUCTS_ATTRIBUTES . "
00227                                            where products_id ='" . (int)$_POST['products_id'] . "'
00228                                            and options_id = '" . (int)$_POST['options_id'] . "'
00229                                            and options_values_id = '" . (int)$_POST['values_id'][$i] . "'");
00230           if ($check_duplicate->RecordCount() > 0) {
00231             // do not add duplicates -- give a warning
00232             $messageStack->add_session(ATTRIBUTE_WARNING_DUPLICATE . ' - ' . zen_options_name($_POST['options_id']) . ' : ' . zen_values_name($_POST['values_id'][$i]), 'error');
00233           } else {
00234 // For TEXT and FILE option types, ignore option value entered by administrator and use PRODUCTS_OPTIONS_VALUES_TEXT instead.
00235             $products_options_array = $db->Execute("select products_options_type from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . $_POST['options_id'] . "'");
00236             $values_id = zen_db_prepare_input((($products_options_array->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_TEXT) or ($products_options_array->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_FILE)) ? PRODUCTS_OPTIONS_VALUES_TEXT_ID : $_POST['values_id'][$i]);
00237 
00238             $products_id = zen_db_prepare_input($_POST['products_id']);
00239             $options_id = zen_db_prepare_input($_POST['options_id']);
00240 //            $values_id = zen_db_prepare_input($_POST['values_id'][$i]);
00241             $value_price = zen_db_prepare_input($_POST['value_price']);
00242             $price_prefix = zen_db_prepare_input($_POST['price_prefix']);
00243 
00244             $products_options_sort_order = zen_db_prepare_input($_POST['products_options_sort_order']);
00245 
00246 // modified options sort order to use default if not otherwise set
00247             if (zen_not_null($_POST['products_options_sort_order'])) {
00248               $products_options_sort_order = zen_db_prepare_input($_POST['products_options_sort_order']);
00249             } else {
00250               $sort_order_query = $db->Execute("select products_options_values_sort_order from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . $_POST['values_id'][$i] . "'");
00251               $products_options_sort_order = $sort_order_query->fields['products_options_values_sort_order'];
00252             } // end if (zen_not_null($_POST['products_options_sort_order'])
00253 
00254 // end modification for sort order
00255 
00256             $product_attribute_is_free = zen_db_prepare_input($_POST['product_attribute_is_free']);
00257             $products_attributes_weight = zen_db_prepare_input($_POST['products_attributes_weight']);
00258             $products_attributes_weight_prefix = zen_db_prepare_input($_POST['products_attributes_weight_prefix']);
00259             $attributes_display_only = zen_db_prepare_input($_POST['attributes_display_only']);
00260             $attributes_default = zen_db_prepare_input($_POST['attributes_default']);
00261             $attributes_discounted = zen_db_prepare_input($_POST['attributes_discounted']);
00262             $attributes_price_base_included = zen_db_prepare_input($_POST['attributes_price_base_included']);
00263 
00264             $attributes_price_onetime = zen_db_prepare_input($_POST['attributes_price_onetime']);
00265             $attributes_price_factor = zen_db_prepare_input($_POST['attributes_price_factor']);
00266             $attributes_price_factor_offset = zen_db_prepare_input($_POST['attributes_price_factor_offset']);
00267             $attributes_price_factor_onetime = zen_db_prepare_input($_POST['attributes_price_factor_onetime']);
00268             $attributes_price_factor_onetime_offset = zen_db_prepare_input($_POST['attributes_price_factor_onetime_offset']);
00269             $attributes_qty_prices = zen_db_prepare_input($_POST['attributes_qty_prices']);
00270             $attributes_qty_prices_onetime = zen_db_prepare_input($_POST['attributes_qty_prices_onetime']);
00271 
00272             $attributes_price_words = zen_db_prepare_input($_POST['attributes_price_words']);
00273             $attributes_price_words_free = zen_db_prepare_input($_POST['attributes_price_words_free']);
00274             $attributes_price_letters = zen_db_prepare_input($_POST['attributes_price_letters']);
00275             $attributes_price_letters_free = zen_db_prepare_input($_POST['attributes_price_letters_free']);
00276             $attributes_required = zen_db_prepare_input($_POST['attributes_required']);
00277 
00278 // add - update as record exists
00279 // attributes images
00280 // when set to none remove from database
00281 // only processes image once for multiple selection of options_values_id
00282             if ($i == 0) {
00283               if (isset($_POST['attributes_image']) && zen_not_null($_POST['attributes_image']) && ($_POST['attributes_image'] != 'none')) {
00284                 $attributes_image = zen_db_prepare_input($_POST['attributes_image']);
00285               } else {
00286                 $attributes_image = '';
00287               }
00288 
00289               $attributes_image = new upload('attributes_image');
00290               $attributes_image->set_destination(DIR_FS_CATALOG_IMAGES . $_POST['img_dir']);
00291               if ($attributes_image->parse() && $attributes_image->save($_POST['overwrite'])) {
00292                 $attributes_image_name = $_POST['img_dir'] . $attributes_image->filename;
00293               } else {
00294                 $attributes_image_name = (isset($_POST['attributes_previous_image']) ? $_POST['attributes_previous_image'] : '');
00295               }
00296               $current_image_name = $attributes_image_name;
00297             } else {
00298               $attributes_image_name = $current_image_name;
00299             }
00300 
00301             $db->Execute("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " (products_attributes_id, products_id, options_id, options_values_id, options_values_price, price_prefix, products_options_sort_order, product_attribute_is_free, products_attributes_weight, products_attributes_weight_prefix, attributes_display_only, attributes_default, attributes_discounted, attributes_image, attributes_price_base_included, attributes_price_onetime, attributes_price_factor, attributes_price_factor_offset, attributes_price_factor_onetime, attributes_price_factor_onetime_offset, attributes_qty_prices, attributes_qty_prices_onetime, attributes_price_words, attributes_price_words_free, attributes_price_letters, attributes_price_letters_free, attributes_required)
00302                           values (0,
00303                                   '" . (int)$products_id . "',
00304                                   '" . (int)$options_id . "',
00305                                   '" . (int)$values_id . "',
00306                                   '" . (float)zen_db_input($value_price) . "',
00307                                   '" . zen_db_input($price_prefix) . "',
00308                                   '" . (int)zen_db_input($products_options_sort_order) . "',
00309                                   '" . (int)zen_db_input($product_attribute_is_free) . "',
00310                                   '" . (float)zen_db_input($products_attributes_weight) . "',
00311                                   '" . zen_db_input($products_attributes_weight_prefix) . "',
00312                                   '" . (int)zen_db_input($attributes_display_only) . "',
00313                                   '" . (int)zen_db_input($attributes_default) . "',
00314                                   '" . (int)zen_db_input($attributes_discounted) . "',
00315                                   '" . zen_db_input($attributes_image_name) . "',
00316                                   '" . (int)zen_db_input($attributes_price_base_included) . "',
00317                                   '" . (float)zen_db_input($attributes_price_onetime) . "',
00318                                   '" . (float)zen_db_input($attributes_price_factor) . "',
00319                                   '" . (float)zen_db_input($attributes_price_factor_offset) . "',
00320                                   '" . (float)zen_db_input($attributes_price_factor_onetime) . "',
00321                                   '" . (float)zen_db_input($attributes_price_factor_onetime_offset) . "',
00322                                   '" . zen_db_input($attributes_qty_prices) . "',
00323                                   '" . zen_db_input($attributes_qty_prices_onetime) . "',
00324                                   '" . (float)zen_db_input($attributes_price_words) . "',
00325                                   '" . (int)zen_db_input($attributes_price_words_free) . "',
00326                                   '" . (float)zen_db_input($attributes_price_letters) . "',
00327                                   '" . (int)zen_db_input($attributes_price_letters_free) . "',
00328                                   '" . (int)zen_db_input($attributes_required) . "')");
00329 
00330             if (DOWNLOAD_ENABLED == 'true') {
00331               $products_attributes_id = $db->Insert_ID();
00332 
00333               $products_attributes_filename = zen_db_prepare_input($_POST['products_attributes_filename']);
00334               $products_attributes_maxdays = (int)zen_db_prepare_input($_POST['products_attributes_maxdays']);
00335               $products_attributes_maxcount = (int)zen_db_prepare_input($_POST['products_attributes_maxcount']);
00336 
00337 //die( 'I am adding ' . strlen($_POST['products_attributes_filename']) . ' vs ' . strlen(trim($_POST['products_attributes_filename'])) . ' vs ' . strlen(zen_db_prepare_input($_POST['products_attributes_filename'])) . ' vs ' . strlen(zen_db_input($products_attributes_filename)) );
00338               if (zen_not_null($products_attributes_filename)) {
00339                 $db->Execute("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . "
00340                               (products_attributes_id, products_attributes_filename, products_attributes_maxdays, products_attributes_maxcount)
00341                               values (" . (int)$products_attributes_id . ",
00342                                       '" . zen_db_input($products_attributes_filename) . "',
00343                                       '" . zen_db_input($products_attributes_maxdays) . "',
00344                                       '" . zen_db_input($products_attributes_maxcount) . "')");
00345               }
00346             }
00347           }
00348         }
00349 
00350         // reset products_price_sorter for searches etc.
00351         zen_update_products_price_sorter($_POST['products_id']);
00352 
00353         zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, $_SESSION['page_info'] . '&products_filter=' . $_POST['products_id'] . '&current_category_id=' . $_POST['current_category_id']));
00354         break;
00355       case 'update_product_attribute':
00356         $check_duplicate = $db->Execute("select * from " . TABLE_PRODUCTS_ATTRIBUTES . "
00357                                          where products_id ='" . (int)$_POST['products_id'] . "'
00358                                          and options_id = '" . (int)$_POST['options_id'] . "'
00359                                          and options_values_id = '" . (int)$_POST['values_id'] . "'
00360                                          and products_attributes_id != '" . (int)$_POST['attribute_id'] . "'");
00361 
00362         if ($check_duplicate->RecordCount() > 0) {
00363           // do not add duplicates give a warning
00364           $messageStack->add_session(ATTRIBUTE_WARNING_DUPLICATE_UPDATE . ' - ' . zen_options_name($_POST['options_id']) . ' : ' . zen_values_name($_POST['values_id']), 'error');
00365         } else {
00366           // Validate options_id and options_value_id
00367           if (!zen_validate_options_to_options_value($_POST['options_id'], $_POST['values_id'])) {
00368             // do not add invalid match
00369             $messageStack->add_session(ATTRIBUTE_WARNING_INVALID_MATCH_UPDATE . ' - ' . zen_options_name($_POST['options_id']) . ' : ' . zen_values_name($_POST['values_id']), 'error');
00370           } else {
00371             // add the new attribute
00372 // iii 030811 added:  Enforce rule that TEXT and FILE Options use value PRODUCTS_OPTIONS_VALUES_TEXT_ID
00373         $products_options_query = $db->Execute("select products_options_type from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$_POST['options_id'] . "'");
00374         switch ($products_options_array->fields['products_options_type']) {
00375           case PRODUCTS_OPTIONS_TYPE_TEXT:
00376           case PRODUCTS_OPTIONS_TYPE_FILE:
00377             $values_id = PRODUCTS_OPTIONS_VALUES_TEXT_ID;
00378             break;
00379           default:
00380           $values_id = zen_db_prepare_input($_POST['values_id']);
00381         }
00382 // iii 030811 added END
00383 
00384             $products_id = zen_db_prepare_input($_POST['products_id']);
00385             $options_id = zen_db_prepare_input($_POST['options_id']);
00386 //            $values_id = zen_db_prepare_input($_POST['values_id']);
00387             $value_price = zen_db_prepare_input($_POST['value_price']);
00388             $price_prefix = zen_db_prepare_input($_POST['price_prefix']);
00389 
00390             $products_options_sort_order = zen_db_prepare_input($_POST['products_options_sort_order']);
00391             $product_attribute_is_free = zen_db_prepare_input($_POST['product_attribute_is_free']);
00392             $products_attributes_weight = zen_db_prepare_input($_POST['products_attributes_weight']);
00393             $products_attributes_weight_prefix = zen_db_prepare_input($_POST['products_attributes_weight_prefix']);
00394             $attributes_display_only = zen_db_prepare_input($_POST['attributes_display_only']);
00395             $attributes_default = zen_db_prepare_input($_POST['attributes_default']);
00396             $attributes_discounted = zen_db_prepare_input($_POST['attributes_discounted']);
00397             $attributes_price_base_included = zen_db_prepare_input($_POST['attributes_price_base_included']);
00398 
00399             $attributes_price_onetime = zen_db_prepare_input($_POST['attributes_price_onetime']);
00400             $attributes_price_factor = zen_db_prepare_input($_POST['attributes_price_factor']);
00401             $attributes_price_factor_offset = zen_db_prepare_input($_POST['attributes_price_factor_offset']);
00402             $attributes_price_factor_onetime = zen_db_prepare_input($_POST['attributes_price_factor_onetime']);
00403             $attributes_price_factor_onetime_offset = zen_db_prepare_input($_POST['attributes_price_factor_onetime_offset']);
00404             $attributes_qty_prices = zen_db_prepare_input($_POST['attributes_qty_prices']);
00405             $attributes_qty_prices_onetime = zen_db_prepare_input($_POST['attributes_qty_prices_onetime']);
00406 
00407             $attributes_price_words = zen_db_prepare_input($_POST['attributes_price_words']);
00408             $attributes_price_words_free = zen_db_prepare_input($_POST['attributes_price_words_free']);
00409             $attributes_price_letters = zen_db_prepare_input($_POST['attributes_price_letters']);
00410             $attributes_price_letters_free = zen_db_prepare_input($_POST['attributes_price_letters_free']);
00411             $attributes_required = zen_db_prepare_input($_POST['attributes_required']);
00412 
00413             $attribute_id = zen_db_prepare_input($_POST['attribute_id']);
00414 
00415 // edit
00416 // attributes images
00417 // when set to none remove from database
00418           if (isset($_POST['attributes_image']) && zen_not_null($_POST['attributes_image']) && ($_POST['attributes_image'] != 'none')) {
00419             $attributes_image = zen_db_prepare_input($_POST['attributes_image']);
00420             $attributes_image_none = false;
00421           } else {
00422             $attributes_image = '';
00423             $attributes_image_none = true;
00424           }
00425 
00426           $attributes_image = new upload('attributes_image');
00427           $attributes_image->set_destination(DIR_FS_CATALOG_IMAGES . $_POST['img_dir']);
00428           if ($attributes_image->parse() && $attributes_image->save($_POST['overwrite'])) {
00429             $attributes_image_name = ($attributes_image->filename != 'none' ? ($_POST['img_dir'] . $attributes_image->filename) : '');
00430           } else {
00431             $attributes_image_name = ((isset($_POST['attributes_previous_image']) and $_POST['attributes_image'] != 'none') ? $_POST['attributes_previous_image'] : '');
00432           }
00433 
00434 if ($_POST['image_delete'] == 1) {
00435   $attributes_image_name = '';
00436 }
00437 // turned off until working
00438           $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . "
00439                         set attributes_image = '" .  zen_db_input($attributes_image_name) . "'
00440                         where products_attributes_id = '" . (int)$attribute_id . "'");
00441 
00442             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . "
00443                           set products_id = '" . (int)$products_id . "',
00444                               options_id = '" . (int)$options_id . "',
00445                               options_values_id = '" . (int)$values_id . "',
00446                               options_values_price = '" . zen_db_input($value_price) . "',
00447                               price_prefix = '" . zen_db_input($price_prefix) . "',
00448                               products_options_sort_order = '" . zen_db_input($products_options_sort_order) . "',
00449                               product_attribute_is_free = '" . zen_db_input($product_attribute_is_free) . "',
00450                               products_attributes_weight = '" . zen_db_input($products_attributes_weight) . "',
00451                               products_attributes_weight_prefix = '" . zen_db_input($products_attributes_weight_prefix) . "',
00452                               attributes_display_only = '" . zen_db_input($attributes_display_only) . "',
00453                               attributes_default = '" . zen_db_input($attributes_default) . "',
00454                               attributes_discounted = '" . zen_db_input($attributes_discounted) . "',
00455                               attributes_price_base_included = '" . zen_db_input($attributes_price_base_included) . "',
00456                               attributes_price_onetime = '" . zen_db_input($attributes_price_onetime) . "',
00457                               attributes_price_factor = '" . zen_db_input($attributes_price_factor) . "',
00458                               attributes_price_factor_offset = '" . zen_db_input($attributes_price_factor_offset) . "',
00459                               attributes_price_factor_onetime = '" . zen_db_input($attributes_price_factor_onetime) . "',
00460                               attributes_price_factor_onetime_offset = '" . zen_db_input($attributes_price_factor_onetime_offset) . "',
00461                               attributes_qty_prices = '" . zen_db_input($attributes_qty_prices) . "',
00462                               attributes_qty_prices_onetime = '" . zen_db_input($attributes_qty_prices_onetime) . "',
00463                               attributes_price_words = '" . zen_db_input($attributes_price_words) . "',
00464                               attributes_price_words_free = '" . zen_db_input($attributes_price_words_free) . "',
00465                               attributes_price_letters = '" . zen_db_input($attributes_price_letters) . "',
00466                               attributes_price_letters_free = '" . zen_db_input($attributes_price_letters_free) . "',
00467                               attributes_required = '" . zen_db_input($attributes_required) . "'
00468                           where products_attributes_id = '" . (int)$attribute_id . "'");
00469 
00470             if (DOWNLOAD_ENABLED == 'true') {
00471               $products_attributes_filename = zen_db_prepare_input($_POST['products_attributes_filename']);
00472               $products_attributes_maxdays = zen_db_prepare_input($_POST['products_attributes_maxdays']);
00473               $products_attributes_maxcount = zen_db_prepare_input($_POST['products_attributes_maxcount']);
00474 
00475               if (zen_not_null($products_attributes_filename)) {
00476                 $db->Execute("replace into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . "
00477                               set products_attributes_id = '" . (int)$attribute_id . "',
00478                                   products_attributes_filename = '" . zen_db_input($products_attributes_filename) . "',
00479                                   products_attributes_maxdays = '" . zen_db_input($products_attributes_maxdays) . "',
00480                                   products_attributes_maxcount = '" . zen_db_input($products_attributes_maxcount) . "'");
00481               }
00482             }
00483           }
00484         }
00485 
00486         // reset products_price_sorter for searches etc.
00487         zen_update_products_price_sorter($_POST['products_id']);
00488 
00489         zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, $_SESSION['page_info'] . '&current_category_id=' . $_POST['current_category_id']));
00490         break;
00491       case 'delete_attribute':
00492         // demo active test
00493         if (zen_admin_demo()) {
00494           $_GET['action']= '';
00495           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
00496           zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, $_SESSION['page_info'] . '&current_category_id=' . $_POST['current_category_id']));
00497         }
00498         if (isset($_POST['delete_attribute_id']))
00499         {
00500           $attribute_id = zen_db_prepare_input($_POST['delete_attribute_id']);
00501 
00502           $db->Execute("delete from " . TABLE_PRODUCTS_ATTRIBUTES . "
00503                       where products_attributes_id = '" . (int)$attribute_id . "'");
00504 
00505 // added for DOWNLOAD_ENABLED. Always try to remove attributes, even if downloads are no longer enabled
00506           $db->Execute("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . "
00507                       where products_attributes_id = '" . (int)$attribute_id . "'");
00508 
00509         // reset products_price_sorter for searches etc.
00510           zen_update_products_price_sorter($products_filter);
00511 
00512           zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, $_SESSION['page_info'] . '&current_category_id=' . $_POST['current_category_id']));
00513         }
00514         break;
00515 // delete all attributes
00516       case 'delete_all_attributes':
00517         zen_delete_products_attributes($_POST['products_filter']);
00518         $messageStack->add_session(SUCCESS_ATTRIBUTES_DELETED . ' ID#' . $products_filter, 'success');
00519         $action='';
00520         $products_filter = (int)$_POST['products_filter'];
00521 
00522         // reset products_price_sorter for searches etc.
00523         zen_update_products_price_sorter($products_filter);
00524 
00525         zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $_POST['current_category_id']));
00526         break;
00527 
00528       case 'delete_option_name_values':
00529         $delete_attributes_options_id = $db->Execute("select * from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id='" . $_POST['products_filter'] . "' and options_id='" . $_POST['products_options_id_all'] . "'");
00530         while (!$delete_attributes_options_id->EOF) {
00531 // remove any attached downloads
00532           $remove_downloads = $db->Execute("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " where products_attributes_id= '" . $delete_attributes_options_id->fields['products_attributes_id'] . "'");
00533 // remove all option values
00534           $delete_attributes_options_id_values = $db->Execute("delete from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id='" . $_POST['products_filter'] . "' and options_id='" . $_POST['products_options_id_all'] . "'");
00535           $delete_attributes_options_id->MoveNext();
00536         }
00537 
00538         $action='';
00539         $products_filter = $_POST['products_filter'];
00540         $messageStack->add_session(SUCCESS_ATTRIBUTES_DELETED_OPTION_NAME_VALUES. ' ID#' . zen_options_name($_POST['products_options_id_all']), 'success');
00541 
00542         // reset products_price_sorter for searches etc.
00543         zen_update_products_price_sorter($products_filter);
00544 
00545         zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $_POST['current_category_id']));
00546         break;
00547 
00548 
00549 // attributes copy to product
00550     case 'update_attributes_copy_to_product':
00551       $copy_attributes_delete_first = ($_POST['copy_attributes'] == 'copy_attributes_delete' ? '1' : '0');
00552       $copy_attributes_duplicates_skipped = ($_POST['copy_attributes'] == 'copy_attributes_ignore' ? '1' : '0');
00553       $copy_attributes_duplicates_overwrite = ($_POST['copy_attributes'] == 'copy_attributes_update' ? '1' : '0');
00554       zen_copy_products_attributes($_POST['products_filter'], $_POST['products_update_id']);
00555       $_GET['action']= '';
00556       $products_filter = $_POST['products_update_id'];
00557       zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $_POST['current_category_id']));
00558       break;
00559 
00560 // attributes copy to category
00561     case 'update_attributes_copy_to_category':
00562       $copy_attributes_delete_first = ($_POST['copy_attributes'] == 'copy_attributes_delete' ? '1' : '0');
00563       $copy_attributes_duplicates_skipped = ($_POST['copy_attributes'] == 'copy_attributes_ignore' ? '1' : '0');
00564       $copy_attributes_duplicates_overwrite = ($_POST['copy_attributes'] == 'copy_attributes_update' ? '1' : '0');
00565       if ($_POST['categories_update_id'] == '') {
00566         $messageStack->add_session(WARNING_PRODUCT_COPY_TO_CATEGORY_NONE . ' ID#' . $_POST['products_filter'], 'warning');
00567       } else {
00568         $copy_to_category = $db->Execute("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id='" . $_POST['categories_update_id'] . "'");
00569         while (!$copy_to_category->EOF) {
00570           zen_copy_products_attributes($_POST['products_filter'], $copy_to_category->fields['products_id']);
00571           $copy_to_category->MoveNext();
00572         }
00573       }
00574       $_GET['action']= '';
00575       $products_filter = $_POST['products_filter'];
00576       zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $_POST['current_category_id']));
00577       break;
00578 
00579     }
00580   }
00581 
00582 //iii 031103 added to get results from database option type query
00583   $products_options_types_list = array();
00584 //  $products_options_type_array = $db->Execute("select products_options_types_id, products_options_types_name from " . TABLE_PRODUCTS_OPTIONS_TYPES . " where language_id='" . $_SESSION['languages_id'] . "' order by products_options_types_id");
00585   $products_options_type_array = $db->Execute("select products_options_types_id, products_options_types_name from " . TABLE_PRODUCTS_OPTIONS_TYPES . " order by products_options_types_id");
00586   while (!$products_options_type_array->EOF) {
00587     $products_options_types_list[$products_options_type_array->fields['products_options_types_id']] = $products_options_type_array->fields['products_options_types_name'];
00588     $products_options_type_array->MoveNext();
00589   }
00590 
00591 //CLR 030312 add function to draw pulldown list of option types
00592 // Draw a pulldown for Option Types
00593 //iii 031103 modified to use results of database option type query from above
00594 function draw_optiontype_pulldown($name, $default = '') {
00595   global $products_options_types_list;
00596   $values = array();
00597   foreach ($products_options_types_list as $id => $text) {
00598     $values[] = array('id' => $id, 'text' => $text);
00599   }
00600   return zen_draw_pull_down_menu($name, $values, $default);
00601 }
00602 
00603 //CLR 030312 add function to translate type_id to name
00604 // Translate option_type_values to english string
00605 //iii 031103 modified to use results of database option type query from above
00606 function translate_type_to_name($opt_type) {
00607   global $products_options_types_list;
00608   return $products_options_types_list[$opt_type];
00609 }
00610 
00611   function zen_js_option_values_list($selectedName, $fieldName) {
00612     global $db, $show_value_numbers;
00613     $attributes_sql = "SELECT povpo.products_options_id, povpo.products_options_values_id, po.products_options_name, po.products_options_sort_order,
00614                        pov.products_options_values_name, pov.products_options_values_sort_order
00615                        FROM " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " povpo, " . TABLE_PRODUCTS_OPTIONS . " po, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov
00616                        WHERE povpo.products_options_id = po.products_options_id
00617                        AND povpo.products_options_values_id = pov.products_options_values_id
00618                        AND pov.language_id = po.language_id
00619                        AND po.language_id = " . (int)$_SESSION['languages_id'] . "
00620                        ORDER BY po.products_options_id, po.products_options_name, pov.products_options_values_name";
00621 
00622 //           "
00623 //           ORDER BY po.products_options_name, pov.products_options_values_sort_order";
00624 
00625     $attributes = $db->Execute($attributes_sql);
00626 
00627     $counter = 1;
00628     $val_count = 0;
00629     $value_string = '  // Build conditional Option Values Lists' . "\n";
00630     $last_option_processed = null;
00631     while (!$attributes->EOF) {
00632       $products_options_values_name = str_replace('-', '\-', $attributes->fields['products_options_values_name']);
00633       $products_options_values_name = str_replace('(', '\(', $products_options_values_name);
00634       $products_options_values_name = str_replace(')', '\)', $products_options_values_name);
00635       $products_options_values_name = str_replace('"', '\"', $products_options_values_name);
00636       $products_options_values_name = str_replace('&quot;', '\"', $products_options_values_name);
00637       $products_options_values_name = str_replace('&frac12;', '1/2', $products_options_values_name);
00638 
00639       if ($counter == 1) {
00640         $value_string .= '  if (' . $selectedName . ' == "' . $attributes->fields['products_options_id'] . '") {' . "\n";
00641       } elseif ($last_option_processed != $attributes->fields['products_options_id']) {
00642         $value_string .= '  } else if (' . $selectedName . ' == "' . $attributes->fields['products_options_id'] . '") {' . "\n";
00643         $val_count = 0;
00644       }
00645 
00646       $value_string .= '    ' . $fieldName . '.options[' . $val_count . '] = new Option("' . $products_options_values_name . ($attributes->fields['products_options_values_id'] == 0 ? '/UPLOAD FILE' : '') . ($show_value_numbers ? ' [ #' . $attributes->fields['products_options_values_id'] . ' ] ' : '') . '", "' . $attributes->fields['products_options_values_id'] . '");' . "\n";
00647 
00648       $last_option_processed = $attributes->fields['products_options_id'];;
00649       $val_count++;
00650       $counter++;
00651       $attributes->MoveNext();
00652     }
00653     if ($counter > 1) {
00654       $value_string .= '  }' . "\n";
00655     }
00656     return $value_string;
00657   }
00658 
00659 ?>
00660 <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
00661 <html <?php echo HTML_PARAMS; ?>>
00662 <head>
00663 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
00664 <title><?php echo TITLE; ?></title>
00665 <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
00666 <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
00667 <script language="javascript" src="includes/menu.js"></script>
00668 <script language="javascript" src="includes/general.js"></script>
00669 <script language="javascript"><!--
00670 function go_option() {
00671   if (document.option_order_by.selected.options[document.option_order_by.selected.selectedIndex].value != "none") {
00672     location = "<?php echo zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'option_page=' . ($_GET['option_page'] ? $_GET['option_page'] : 1)); ?>&option_order_by="+document.option_order_by.selected.options[document.option_order_by.selected.selectedIndex].value;
00673   }
00674 }
00675 function popupWindow(url) {
00676   window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=600,height=460,screenX=150,screenY=150,top=150,left=150')
00677 }
00678 //--></script>
00679 <script type="text/javascript">
00680   <!--
00681   function init()
00682   {
00683     cssjsmenu('navbar');
00684     if (document.getElementById)
00685     {
00686       var kill = document.getElementById('hoverJS');
00687       kill.disabled = true;
00688     }
00689   }
00690   // -->
00691 </script>
00692 </head>
00693 <!-- <body onload="init()"> -->
00694 <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="init()">
00695 <!-- header //-->
00696 <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
00697 <!-- header_eof //-->
00698 
00699 <!-- body //-->
00700 <table border="0" width="100%" cellspacing="2" cellpadding="2">
00701   <tr>
00702 <!-- body_text //-->
00703     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
00704               <tr>
00705                 <td class="smallText" align="right">
00706 <?php
00707     echo zen_draw_form('search', FILENAME_CATEGORIES, '', 'get');
00708 // show reset search
00709     if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
00710       echo '<a href="' . zen_href_link(FILENAME_CATEGORIES) . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a>&nbsp;&nbsp;';
00711     }
00712     echo HEADING_TITLE_SEARCH_DETAIL . ' ' . zen_draw_input_field('search') . zen_hide_session_id();
00713     if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
00714       $keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
00715       echo '<br/ >' . TEXT_INFO_SEARCH_DETAIL_FILTER . $keywords;
00716     }
00717     echo '</form>';
00718 ?>
00719                 </td>
00720               </tr>
00721 
00722       <tr>
00723         <td width="100%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
00724 <!-- products_attributes //-->
00725       <tr>
00726         <td width="100%"><table border="0" cellspacing="2" cellpadding="2">
00727           <tr>
00728                 <td height="40" valign="bottom"><a href="<?php echo  zen_href_link(FILENAME_OPTIONS_NAME_MANAGER, '', 'NONSSL') ?>"><?php echo zen_image_button('button_option_names.gif', IMAGE_OPTION_NAMES); ?></a></td>
00729                 <td height="40" valign="bottom"><a href="<?php echo  zen_href_link(FILENAME_OPTIONS_VALUES_MANAGER, '', 'NONSSL') ?>"><?php echo zen_image_button('button_option_values.gif', IMAGE_OPTION_VALUES); ?></a></td>
00730           </tr>
00731         </table></td>
00732       </tr>
00733       <tr>
00734         <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
00735           <tr>
00736             <td class="pageHeading">&nbsp;<?php echo HEADING_TITLE_ATRIB; ?>&nbsp;</td>
00737           </tr>
00738         </table></td>
00739       </tr>
00740 
00741 <?php
00742 if ($action == 'attributes_preview') {
00743   // don't show anything from here down
00744 ?>
00745 
00746 <tr><td><table align="center"><tr>
00747             <td class="pageHeading" align="center"><?php echo TEXT_ATTRIBUTES_PREVIEW_DISPLAY . $products_filter . '<br />' . zen_get_products_name($products_filter); ?></td>
00748 </tr></table></td></tr>
00749 
00750 <?php
00751 } else {
00752   // show the attributes
00753 ?>
00754 <?php
00755   if ($products_filter != '' and $action != 'attribute_features_copy_to_product' and $action != 'attribute_features_copy_to_category' and $action != 'delete_all_attributes_confirm') {
00756 ?>
00757       <tr>
00758         <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
00759       </tr>
00760 
00761       <tr>
00762         <td colspan="2"><table border="1" cellspacing="2" cellpadding="4" align="left">
00763           <tr>
00764             <td colspan="7" class="main" align="center">
00765               <?php echo TEXT_PRODUCTS_LISTING . TEXT_PRODUCTS_ID . $products_filter .  TEXT_PRODUCT_IN_CATEGORY_NAME . zen_get_category_name(zen_get_products_category_id($products_filter), (int)$_SESSION['languages_id']) . '<br />' . zen_get_products_name($products_filter); ?>
00766             </td>
00767           </tr>
00768           <tr>
00769             <td class="smallText" align="center"><?php echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'action=new_product' . '&cPath=' . zen_get_product_path($products_filter) . '&pID=' . $products_filter . '&product_type=' . zen_get_products_type($products_filter)) . '">' . zen_image_button('button_edit_product.gif', IMAGE_EDIT_PRODUCT) . '<br />' . TEXT_PRODUCT_EDIT . '</a>'; ?></td>
00770             <td class="smallText" align="center">
00771               <?php
00772                 if ($zc_products->get_allow_add_to_cart($products_filter) == "Y") {
00773                   echo '<a href="' . zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '">' . zen_image_button('button_products_price_manager.gif', IMAGE_PRODUCTS_PRICE_MANAGER) . '<br />' . TEXT_PRODUCTS_PRICE_MANAGER . '</a>';
00774                 } else {
00775                   echo TEXT_INFO_ALLOW_ADD_TO_CART_NO;
00776                 }
00777               ?>
00778             </td>
00779 <?php
00780   if (zen_has_product_attributes($products_filter, 'false')) {
00781 ?>
00782             <td class="smallText" align="center"><?php echo zen_draw_form('update_sort', FILENAME_ATTRIBUTES_CONTROLLER, 'action=update_attribute_sort' . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id); ?><?php echo zen_image_submit('button_update_sort.gif', IMAGE_UPDATE_SORT); ?><?php echo zen_draw_hidden_field('confirm', 'y'); ?></form><br /><?php echo TEXT_ATTRIBUTES_UPDATE_SORT_ORDER; ?></td>
00783             <td class="smallText" align="center"><?php echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, '&action=attributes_preview' . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '">' . zen_image_button('button_preview.gif', IMAGE_PREVIEW) . '<br />' . TEXT_ATTRIBUTES_PREVIEW . '</a>'; ?></td>
00784             <td class="smallText" align="center"><?php echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, '&action=delete_all_attributes_confirm' . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '<br />' . TEXT_ATTRIBUTES_DELETE . '</a>'; ?></td>
00785             <td class="smallText" align="center"><?php echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, '&action=attribute_features_copy_to_product' . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '">' . zen_image_button('button_copy_to.gif', IMAGE_COPY) . '<br />' . TEXT_ATTRIBUTES_COPY_TO_PRODUCTS . '</a>'; ?></td>
00786             <td class="smallText" align="center"><?php echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, '&action=attribute_features_copy_to_category' . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '">' . zen_image_button('button_copy_to.gif', IMAGE_COPY) . '<br />' . TEXT_ATTRIBUTES_COPY_TO_CATEGORY . '</a>'; ?></td>
00787 <?php
00788 } else {
00789 ?>
00790             <td class="main" align="center" width="200"><?php echo TEXT_NO_ATTRIBUTES_DEFINED . $products_filter; ?></td>
00791 <?php
00792 }
00793 ?>
00794           </tr>
00795           <tr>
00796             <td class="smallText" align="center" colspan="7"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCTS_TO_CATEGORIES, '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '">' . IMAGE_PRODUCTS_TO_CATEGORIES . '</a>'; ?></td>
00797           </tr>
00798         </table></td>
00799       </form></tr>
00800       <tr>
00801         <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
00802       </tr>
00803 <?php
00804 }
00805 ?>
00806 <?php
00807 } // eof: attributes_preview
00808 ?>
00809 
00810 <?php
00811 // remove all attributes from the product
00812   if ($action == 'delete_all_attributes_confirm') {
00813 ?>
00814       <tr><form name="delete_all"<?php echo 'action="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=delete_all_attributes') . '"'; ?> method="post"><?php echo zen_draw_hidden_field('products_filter', $_GET['products_filter']); ?><?php echo zen_draw_hidden_field('current_category_id', $_GET['current_category_id']); ?><?php echo zen_draw_hidden_field('securityToken', $_SESSION['securityToken']); ?>
00815         <td colspan="2"><table border="2" cellspacing="2" cellpadding="4">
00816           <tr>
00817             <td><table border="0" cellspacing="2" cellpadding="2">
00818               <tr>
00819                 <td class="alert" align="center"><?php echo TEXT_DELETE_ALL_ATTRIBUTES . $products_filter . '<br />' . zen_get_products_name($products_filter); ?></td>
00820                 <td class="main" align="center"><?php echo zen_image_submit('button_delete.gif', IMAGE_DELETE) . '&nbsp;&nbsp;' . '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
00821               </tr>
00822             </table></td>
00823           </table></td>
00824         </tr>
00825       </form></tr>
00826 <?php
00827 }
00828 ?>
00829 
00830 <?php
00831 // remove option name and all values from the product
00832   if ($action == 'delete_option_name_values_confirm') {
00833 ?>
00834       <tr><form name="delete_all"<?php echo 'action="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=delete_option_name_values') . '"'; ?> method="post"><?php echo zen_draw_hidden_field('securityToken', $_SESSION['securityToken']); ?>
00835         <?php echo zen_draw_hidden_field('products_filter', $_GET['products_filter']); ?>
00836         <?php echo zen_draw_hidden_field('current_category_id', $_GET['current_category_id']); ?>
00837         <?php echo zen_draw_hidden_field('products_options_id_all', $_GET['products_options_id_all']); ?>
00838         <td colspan="2"><table border="2" cellspacing="2" cellpadding="4">
00839           <tr>
00840             <td><table border="0" cellspacing="2" cellpadding="2">
00841               <tr class="pageHeading">
00842                 <td class="alert" align="center" colspan="2"><?php echo TEXT_DELETE_ATTRIBUTES_OPTION_NAME_VALUES; ?></td>
00843               </tr>
00844               <tr>
00845                 <td class="main" align="left"><?php echo TEXT_INFO_PRODUCT_NAME . zen_get_products_name($products_filter) . '<br />' . TEXT_INFO_PRODUCTS_OPTION_ID . $_GET['products_options_id_all'] . '&nbsp;' . TEXT_INFO_PRODUCTS_OPTION_NAME . '&nbsp;' . zen_options_name($_GET['products_options_id_all']); ?></td>
00846                 <td class="main" align="left"><?php echo zen_image_submit('button_delete.gif', IMAGE_DELETE) . '&nbsp;&nbsp;' . '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
00847               </tr>
00848             </table></td>
00849           </table></td>
00850         </tr>
00851       </form></tr>
00852 <?php
00853 }
00854 ?>
00855 
00856 <?php
00857   if ($action == 'attribute_features_copy_to_product') {
00858     $_GET['products_update_id'] = '';
00859     // excluded current product from the pull down menu of products
00860     $products_exclude_array = array();
00861     $products_exclude_array[] = $products_filter;
00862 ?>
00863       <tr><form name="product_copy_to_product"<?php echo 'action="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=update_attributes_copy_to_product') . '"'; ?> method="post"><?php echo zen_draw_hidden_field('products_filter', $_GET['products_filter']) . zen_draw_hidden_field('products_id', $_GET['products_filter']) . zen_draw_hidden_field('products_update_id', $_GET['products_update_id']) . zen_draw_hidden_field('copy_attributes', $_GET['copy_attributes']); ?><?php echo zen_draw_hidden_field('securityToken', $_SESSION['securityToken']); ?>
00864         <td colspan="2"><table border="2" cellspacing="0" cellpadding="2">
00865           <tr>
00866             <td><table border="0" cellspacing="2" cellpadding="4">
00867               <tr>
00868                 <td class="main" align="center"><?php echo TEXT_INFO_ATTRIBUTES_FEATURES_COPY_TO_PRODUCT . $products_filter . '<br />' . zen_get_products_name($products_filter); ?></td>
00869                 <td class="main" align="left"><?php echo TEXT_COPY_ATTRIBUTES_CONDITIONS . '<br />' . zen_draw_radio_field('copy_attributes', 'copy_attributes_delete', true) . ' ' . TEXT_COPY_ATTRIBUTES_DELETE . '<br />' . zen_draw_radio_field('copy_attributes', 'copy_attributes_update') . ' ' . TEXT_COPY_ATTRIBUTES_UPDATE . '<br />' . zen_draw_radio_field('copy_attributes', 'copy_attributes_ignore') . ' ' . TEXT_COPY_ATTRIBUTES_IGNORE; ?></td>
00870               </tr>
00871               <tr>
00872                 <td class="alert" align="center"><?php echo TEXT_INFO_ATTRIBUTES_FEATURE_COPY_TO . '<br />' . zen_draw_products_pull_down('products_update_id', 'size="15"', $products_exclude_array, true, '', true); ?></td>
00873                 <td class="main" align="center"><?php echo zen_image_submit('button_copy.gif', IMAGE_COPY) . '&nbsp;&nbsp;' . '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
00874               </tr>
00875             </table></td>
00876           </table></td>
00877         </tr>
00878       </form></tr>
00879 <?php
00880 }
00881 ?>
00882 
00883 <?php
00884   if ($action == 'attribute_features_copy_to_category') {
00885 ?>
00886       <tr><form name="product_copy_to_category"<?php echo 'action="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=update_attributes_copy_to_category') . '"'; ?> method="post"><?php echo zen_draw_hidden_field('products_filter', $_GET['products_filter']) . zen_draw_hidden_field('products_id', $_GET['products_filter']) . zen_draw_hidden_field('products_update_id', $_GET['products_update_id']) . zen_draw_hidden_field('copy_attributes', $_GET['copy_attributes']) . zen_draw_hidden_field('current_category_id', $_GET['current_category_id']); ?><?php echo zen_draw_hidden_field('securityToken', $_SESSION['securityToken']); ?>
00887         <td colspan="2"><table border="2" cellspacing="0" cellpadding="2">
00888           <tr>
00889             <td><table border="0" cellspacing="2" cellpadding="4">
00890               <tr>
00891                 <td class="main" align="center"><?php echo TEXT_INFO_ATTRIBUTES_FEATURES_COPY_TO_CATEGORY . $products_filter . '<br />' . zen_get_products_name($products_filter); ?></td>
00892                 <td class="main" align="left"><?php echo TEXT_COPY_ATTRIBUTES_CONDITIONS . '<br />' . zen_draw_radio_field('copy_attributes', 'copy_attributes_delete', true) . ' ' . TEXT_COPY_ATTRIBUTES_DELETE . '<br />' . zen_draw_radio_field('copy_attributes', 'copy_attributes_update') . ' ' . TEXT_COPY_ATTRIBUTES_UPDATE . '<br />' . zen_draw_radio_field('copy_attributes', 'copy_attributes_ignore') . ' ' . TEXT_COPY_ATTRIBUTES_IGNORE; ?></td>
00893               </tr>
00894               <tr>
00895                 <td class="alert" align="center"><?php echo TEXT_INFO_ATTRIBUTES_FEATURE_CATEGORIES_COPY_TO . '<br />' . zen_draw_products_pull_down_categories('categories_update_id', 'size="5"', '', true, true); ?></td>
00896                 <td class="main" align="center"><?php echo zen_image_submit('button_copy.gif', IMAGE_COPY) . '&nbsp;&nbsp;' . '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
00897               </tr>
00898             </table></td>
00899           </table></td>
00900         </tr>
00901       </form></tr>
00902 
00903 <?php
00904 }
00905 ?>
00906 
00907 <?php
00908 // fix here
00909 // preview shot of attributes
00910 if ($action == 'attributes_preview') {
00911   $_GET['products_id'] = $products_filter;
00912   $pInfo->products_id = $products_filter;
00913 
00914   include(DIR_WS_INCLUDES . 'attributes_preview.php');
00915 ?>
00916       <tr>
00917         <td colspan="2" class="main" align="center" height= "40" valign="middle"><?php echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
00918       </tr>
00919       <tr>
00920         <td colspan="2"><table border="1" cellspacing="0" cellpadding="2" align="center" class="main_page">
00921           <tr>
00922             <td class="main">
00923 <?php
00924 //            where    patrib.products_id='" . $pInfo->products_id . "'
00925 //            where    patrib.products_id='" . (int)$_GET['products_id'] . "'
00926   $check_template = $db->Execute("select template_dir from " . TABLE_TEMPLATE_SELECT);
00927   echo '<link rel="stylesheet" type="text/css" href="' . DIR_WS_CATALOG_TEMPLATE . $check_template->fields['template_dir'] . '/css/stylesheet.css' . '" />';
00928 ?>
00929 
00930   <tr>
00931     <td colspan="2" class="main" align="center">
00932 <?php
00933   if ($pr_attr->fields['total'] > 0) {
00934 ?>
00935       <table border="0" width="90%" cellspacing="0" cellpadding="2">
00936         <tr>
00937           <td colspan="2" class="main" align="left"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
00938         </tr>
00939 <?php
00940     for($i=0;$i<sizeof($options_name);$i++) {
00941 ?>
00942 <?php
00943   if ($options_comment[$i] != '' and $options_comment_position[$i] == '0') {
00944 ?>
00945         <tr>
00946           <td colspan="2" class="ProductInfoComments" align="left" valign="bottom"><?php echo $options_comment[$i]; ?></td>
00947         </tr>
00948 <?php
00949   }
00950 ?>
00951         <tr>
00952           <td class="main" align="left" valign="top"><?php echo $options_name[$i] . ':'; ?></td>
00953           <td class="main" align="left" valign="top" width="75%"><?php echo $options_menu[$i]; ?></td>
00954         </tr>
00955 <?php if ($options_comment[$i] != '' and $options_comment_position[$i] == '1') { ?>
00956         <tr>
00957           <td colspan="2" class="ProductInfoComments" align="left" valign="top"><?php echo $options_comment[$i]; ?></td>
00958         </tr>
00959 <?php } ?>
00960 
00961 <?php
00962 if ($options_attributes_image[$i] != '') {
00963 ?>
00964         <tr><td colspan="2"><table border= "0" align="center" valign="top" cellpadding="2" cellspacing="2"><tr>
00965           <?php echo $options_attributes_image[$i]; ?>
00966         </tr></table></td></tr>
00967 <?php
00968 }
00969 ?>
00970 <?php
00971     }
00972 ?>
00973       </table>
00974 <?php
00975   }
00976 ?>
00977     </td>
00978   </tr>
00979             </td>
00980           </tr>
00981         </table></td>
00982       </tr>
00983 
00984       <tr>
00985         <td colspan="2" class="main" align="center" height= "40" valign="middle"><?php echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>
00986       </tr>
00987 <?php
00988 } // eof: attributes preview
00989 ?>
00990 
00991       <tr>
00992         <td colspan="3" class="main" height="20" align="center"><?php echo zen_draw_separator('pixel_black.gif', '90%', '2'); ?></td>
00993       </tr>
00994 
00995 <?php
00996 if ($action == 'attributes_preview') {
00997   // don't show anything from here down
00998 } else {
00999   // show the attributes
01000 ?>
01001 <?php
01002   if ($action == '') {
01003 ?>
01004       <tr>
01005         <td colspan="2"><table>
01006           <?php require(DIR_WS_MODULES . FILENAME_PREV_NEXT_DISPLAY); ?>
01007         </table></td>
01008       </tr>
01009 
01010       <tr><form name="set_products_filter_id" <?php echo 'action="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=set_products_filter') . '"'; ?> method="post"><?php echo zen_draw_hidden_field('products_filter', $products_filter); ?><?php echo zen_draw_hidden_field('current_category_id', $current_category_id); ?><?php echo zen_draw_hidden_field('securityToken', $_SESSION['securityToken']); ?>
01011         <td colspan="2"><table border="0" cellspacing="0" cellpadding="2">
01012 
01013 <?php
01014     if ($_GET['products_filter'] != '') {
01015 ?>
01016           <tr>
01017             <td class="main" width="200" align="left" valign="top">&nbsp;</td>
01018             <td colspan="2" class="main"><?php echo TEXT_PRODUCT_TO_VIEW; ?></td>
01019           </tr>
01020           <tr>
01021             <td class="main" width="200" align="center" valign="top">
01022 <?php
01023   $display_priced_by_attributes = zen_get_products_price_is_priced_by_attributes($_GET['products_filter']);
01024   echo ($display_priced_by_attributes ? '<span class="alert">' . TEXT_PRICED_BY_ATTRIBUTES . '</span>' . '<br />' : '');
01025   echo zen_get_products_display_price($_GET['products_filter']) . '<br /><br />';
01026   echo zen_get_products_quantity_min_units_display($_GET['products_filter'], $include_break = true);
01027 ?>
01028             </td>
01029             <td class="attributes-even" align="center"><?php echo zen_draw_products_pull_down('products_filter', 'size="10"', '', true, $_GET['products_filter'], true, true); ?></td>
01030             <td class="main" align="right" valign="top"><?php echo zen_image_submit('button_display.gif', IMAGE_DISPLAY); ?></td>
01031           </tr>
01032         </table></td>
01033       </form></tr>
01034 
01035 <?php
01036     } // product dropdown
01037 ?>
01038 <?php
01039   } // $action == ''
01040 ?>
01041 <?php
01042 // start of attributes display
01043 if ($_GET['products_filter'] == '') {
01044 ?>
01045       <tr>
01046         <td colspan="2" class="pageHeading" align="center" valign="middle" height="200"><?php echo HEADING_TITLE_ATRIB_SELECT; ?></td>
01047       </tr>
01048 <?php
01049 } else {
01051 // attribute listings and add
01052 
01053   if ($action == 'update_attribute') {
01054     $form_action = 'update_product_attribute';
01055   } elseif ($action == 'delete_product_attribute') {
01056     $form_action = 'delete_attribute';
01057   } else {
01058     $form_action = 'add_product_attributes';
01059   }
01060 
01061   if (!isset($_GET['attribute_page'])) {
01062     $_GET['attribute_page'] = 1;
01063   }
01064   $prev_attribute_page = $_GET['attribute_page'] - 1;
01065   $next_attribute_page = $_GET['attribute_page'] + 1;
01066 ?>
01067 
01068 <?php
01069 if ($action == '') {
01070 ?>
01071 <tr>
01072   <td>
01073     <table border="2" align="left" cellpadding="2" cellspacing="2">
01074       <tr>
01075         <td class="smallText" align="right"><?php echo LEGEND_BOX; ?></td>
01076         <td class="smallText" align="center"><?php echo LEGEND_ATTRIBUTES_DISPLAY_ONLY; ?></td>
01077         <td class="smallText" align="center"><?php echo LEGEND_ATTRIBUTES_IS_FREE; ?></td>
01078         <td class="smallText" align="center"><?php echo LEGEND_ATTRIBUTES_DEFAULT; ?></td>
01079         <td class="smallText" align="center"><?php echo LEGEND_ATTRIBUTE_IS_DISCOUNTED; ?></td>
01080         <td class="smallText" align="center"><?php echo LEGEND_ATTRIBUTE_PRICE_BASE_INCLUDED; ?></td>
01081         <td class="smallText" align="center"><?php echo LEGEND_ATTRIBUTES_REQUIRED; ?></td>
01082         <td class="smallText" align="center"><?php echo LEGEND_ATTRIBUTES_IMAGES ?></td>
01083         <td class="smallText" align="center"><?php echo LEGEND_ATTRIBUTES_DOWNLOAD ?></td>
01084       </tr>
01085       <tr>
01086         <td class="smallText" align="right"><?php echo LEGEND_KEYS; ?></td>
01087         <td class="smallText" align="center"><?php echo zen_image(DIR_WS_IMAGES . 'icon_yellow_off.gif') . zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif'); ?></td>
01088         <td class="smallText" align="center"><?php echo zen_image(DIR_WS_IMAGES . 'icon_blue_off.gif') . zen_image(DIR_WS_IMAGES . 'icon_blue_on.gif'); ?></td>
01089         <td class="smallText" align="center"><?php echo zen_image(DIR_WS_IMAGES . 'icon_orange_off.gif') . zen_image(DIR_WS_IMAGES . 'icon_orange_on.gif'); ?></td>
01090         <td class="smallText" align="center"><?php echo zen_image(DIR_WS_IMAGES . 'icon_pink_off.gif') . zen_image(DIR_WS_IMAGES . 'icon_pink_on.gif'); ?></td>
01091         <td class="smallText" align="center"><?php echo zen_image(DIR_WS_IMAGES . 'icon_purple_off.gif') . zen_image(DIR_WS_IMAGES . 'icon_purple_on.gif'); ?></td>
01092         <td class="smallText" align="center"><?php echo zen_image(DIR_WS_IMAGES . 'icon_red_off.gif') . zen_image(DIR_WS_IMAGES . 'icon_red_on.gif'); ?></td>
01093         <td class="smallText" align="center"><?php echo zen_image(DIR_WS_IMAGES . 'icon_status_yellow.gif'); ?></td>
01094         <td class="smallText" align="center"><?php echo zen_image(DIR_WS_IMAGES . 'icon_status_green.gif') . '&nbsp;' . zen_image(DIR_WS_IMAGES . 'icon_status_red.gif'); ?></td>
01095       </tr>
01096     </table>
01097   </td>
01098 <?php } ?>
01099 <?php
01100 // fix here border width
01101 ?>
01102       <tr>
01103         <td><form name="attributes" action="<?php echo zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=' . $form_action . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter ); ?>" method="post", enctype="multipart/form-data"><?php echo zen_draw_hidden_field('securityToken', $_SESSION['securityToken']); ?><table border="0" cellspacing="0" cellpadding="2">
01104           <tr>
01105             <td colspan="10" class="smallText">
01106 <?php
01107   $per_page = (defined('MAX_ROW_LISTS_ATTRIBUTES_CONTROLLER') && (int)MAX_ROW_LISTS_ATTRIBUTES_CONTROLLER > 3) ? (int)MAX_ROW_LISTS_ATTRIBUTES_CONTROLLER : 40;
01108   $attributes = "select pa.*
01109   from (" . TABLE_PRODUCTS_ATTRIBUTES . " pa
01110   left join " . TABLE_PRODUCTS_DESCRIPTION . " pd
01111   on pa.products_id = pd.products_id
01112   and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
01113   left join " . TABLE_PRODUCTS_OPTIONS . " po
01114   on pa.options_id = po.products_options_id
01115   and po.language_id = '" . (int)$_SESSION['languages_id'] . "'" . ")
01116   where pa.products_id ='" . $products_filter . "'
01117   order by pd.products_name, LPAD(po.products_options_sort_order,11,'0'), LPAD(pa.options_id,11,'0'), LPAD(pa.products_options_sort_order,11,'0')";
01118   $attribute_query = $db->Execute($attributes);
01119 
01120   $attribute_page_start = ($per_page * $_GET['attribute_page']) - $per_page;
01121   $num_rows = $attribute_query->RecordCount();
01122 
01123   if ($num_rows <= $per_page) {
01124      $num_pages = 1;
01125   } else if (($num_rows % $per_page) == 0) {
01126      $num_pages = ($num_rows / $per_page);
01127   } else {
01128      $num_pages = ($num_rows / $per_page) + 1;
01129   }
01130   $num_pages = (int) $num_pages;
01131 
01132 // fix limit error on some versions
01133     if ($attribute_page_start < 0) { $attribute_page_start = 0; }
01134 
01135   $attributes = $attributes . " LIMIT $attribute_page_start, $per_page";
01136 
01137   // Previous
01138   if ($prev_attribute_page) {
01139     echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'attribute_page=' . $prev_attribute_page . '&products_filter=' . $products_filter) . '"> &lt;&lt; </a> | ';
01140   }
01141 
01142   for ($i = 1; $i <= $num_pages; $i++) {
01143     if ($i != $_GET['attribute_page']) {
01144       echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'attribute_page=' . $i  . '&products_filter=' . $products_filter) . '">' . $i . '</a> | ';
01145     } else {
01146       echo '<b><font color="red">' . $i . '</font></b> | ';
01147     }
01148   }
01149 
01150   // Next
01151   if ($_GET['attribute_page'] != $num_pages) {
01152     echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'attribute_page=' . $next_attribute_page . '&products_filter=' . $products_filter) . '"> &gt;&gt; </a>';
01153   }
01154 ?>
01155             </td>
01156           </tr>
01157           <tr>
01158             <td colspan="10"><?php echo zen_black_line(); ?></td>
01159           </tr>
01160           <tr class="dataTableHeadingRow">
01161             <td class="dataTableHeadingContent">&nbsp;<?php echo TABLE_HEADING_ID; ?>&nbsp;</td>
01162             <td class="dataTableHeadingContent">&nbsp;<?php // echo TABLE_HEADING_PRODUCT; ?>&nbsp;</td>
01163             <td class="dataTableHeadingContent">&nbsp;<?php echo TABLE_HEADING_OPT_NAME; ?>&nbsp;</td>
01164             <td class="dataTableHeadingContent">&nbsp;<?php echo TABLE_HEADING_OPT_VALUE; ?>&nbsp;</td>
01165             <td class="dataTableHeadingContent" align="right">&nbsp;<?php echo TABLE_HEADING_OPT_PRICE_PREFIX; ?>&nbsp;<?php echo TABLE_HEADING_OPT_PRICE; ?>&nbsp;</td>
01166             <td class="dataTableHeadingContent" align="right">&nbsp;<?php echo TABLE_HEADING_OPT_WEIGHT_PREFIX; ?>&nbsp;<?php echo TABLE_HEADING_OPT_WEIGHT; ?>&nbsp;</td>
01167             <td class="dataTableHeadingContent" align="right">&nbsp;<?php echo TABLE_HEADING_OPT_SORT_ORDER; ?>&nbsp;</td>
01168             <td class="dataTableHeadingContent" align="center"><?php echo LEGEND_BOX; ?></td>
01169             <td class="dataTableHeadingContent" align="right">&nbsp;<?php echo TABLE_HEADING_PRICE_TOTAL; ?>&nbsp;</td>
01170             <td class="dataTableHeadingContent" align="center">&nbsp;<?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
01171           </tr>
01172           <tr>
01173             <td colspan="10"><?php echo zen_black_line(); ?></td>
01174           </tr>
01175 
01176 <?php
01177   $next_id = 1;
01178   $attributes_values = $db->Execute($attributes);
01179 
01180   if ($attributes_values->RecordCount() == 0) {
01181 ?>
01182           <tr class="attributeBoxContent">
01183             <td colspan="10" class="dataTableHeadingContent">&nbsp;</td>
01184           </tr>
01185           <tr class="attributes-even">
01186             <td colspan="10" class="pageHeading" align="center">
01187               <?php echo ($products_filter == '' ? TEXT_NO_PRODUCTS_SELECTED : TEXT_NO_ATTRIBUTES_DEFINED . $products_filter . ' ' . zen_get_products_model($products_filter) . ' - ' . zen_get_products_name($products_filter)); ?>
01188             </td>
01189           </tr>
01190           <tr class="dataTableHeadingRow">
01191             <td colspan="10" class="dataTableHeadingContent">&nbsp;</td>
01192           </tr>
01193 
01194 <?php
01195 } else {
01196 ?>
01197           <tr class="attributeBoxContent">
01198             <td colspan="10" class="dataTableHeadingContent">&nbsp;</td>
01199           </tr>
01200           <tr class="attributes-even">
01201             <td colspan="10" class="pageHeading" align="center">
01202               <?php echo TEXT_INFO_ID . $products_filter . ' ' . zen_get_products_model($products_filter) . ' - ' . zen_get_products_name($products_filter); ?>
01203             </td>
01204           </tr>
01205           <tr class="attributeBoxContent">
01206             <td colspan="10" class="dataTableHeadingContent">&nbsp;</td>
01207           </tr>
01208 <?php } ?>
01209 <?php
01210   $current_options_name = '';
01211   while (!$attributes_values->EOF) {
01212     $current_attributes_products_id = $attributes_values->fields['products_id'];
01213     $current_attributes_options_id = $attributes_values->fields['options_id'];
01214 
01215     $products_name_only = zen_get_products_name($attributes_values->fields['products_id']);
01216     $options_name = zen_options_name($attributes_values->fields['options_id']);
01217     $values_name = zen_values_name($attributes_values->fields['options_values_id']);
01218     $rows++;
01219 
01220 // delete all option name values
01221     if ($current_options_name != $options_name) {
01222       $current_options_name = $options_name;
01223 ?>
01224           <tr>
01225             <td>
01226               <?php
01227               if ($action == '') {
01228                 echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=delete_option_name_values_confirm&products_options_id_all=' . $current_attributes_options_id . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id ) , '">' .
01229                 zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>';
01230               }
01231               ?>
01232               </td>
01233             <td class="pageHeading"><?php echo $current_options_name; ?></td>
01234           </tr>
01235 <?php } // option name delete ?>
01236           <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
01237 <?php
01238     if (($action == 'update_attribute') && ($_GET['attribute_id'] == $attributes_values->fields['products_attributes_id'])) {
01239 ?>
01240           <tr>
01241             <td colspan="10"><?php echo zen_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
01242           </tr>
01243           <tr>
01244             <td colspan="10"><?php echo zen_black_line(); ?></td>
01245           </tr>
01246 
01247 <tr><td colspan="10" class="attributeBoxContent"><table border="0" width="100%">
01248 
01249 <tr><td class="pageHeading"><?php echo PRODUCTS_ATTRIBUTES_EDITING; ?>
01250 
01251 <?php // fix here edit ?>
01252 <tr><td class="attributeBoxContent">
01253 <table border="0" cellpadding="4" cellspacing="2">
01254 
01255 <tr>
01256             <td class="smallText" valign="top" width="40">&nbsp;<?php echo $attributes_values->fields['products_attributes_id']; ?><input type="hidden" name="attribute_id" value="<?php echo $attributes_values->fields['products_attributes_id']; ?>">&nbsp;</td>
01257             <td class="smallText" valign="top">
01258             <td class="pageHeading" valign="top">&nbsp;
01259               <input type="hidden" name="products_id" value="<?php echo $products_filter; ?>">
01260               <input type="hidden" name="current_category_id" value="<?php echo $current_category_id; ?>">
01261               <?php
01262                 $show_model = zen_get_products_model($products_filter);
01263                 if(!empty($show_model)) {
01264                   $show_model = " - (" . $show_model . ")";
01265                 }
01266                 echo zen_clean_html(zen_get_products_name($products_filter)) . $show_model;
01267               ?>
01268             </td>
01269 
01270           </tr></table></td></tr>
01271           <tr class="attributeBoxContent"><td><table><tr>
01272             <td class="smallText" valign="top" width="40">&nbsp;</td>
01273             <td class="pageHeading">&nbsp;
01274               <input type="hidden" name="options_id" value="<?php echo $attributes_values->fields['options_id']; ?>">
01275               <?php echo zen_get_option_name_language($attributes_values->fields['options_id'], $_SESSION['languages_id']); ?>:
01276             </td>
01277             <td class="smallText">&nbsp;<?php echo TABLE_HEADING_OPT_VALUE . '<br />'; ?><select name="values_id" size="10">
01278 <?php
01279 // FIX HERE 2 - editing
01280       $values_values = $db->Execute("select pov.* from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov left join " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " povtpo on pov.products_options_values_id = povtpo.products_options_values_id
01281                                      where pov.language_id ='" . (int)$_SESSION['languages_id'] . "'
01282                                      and povtpo.products_options_id='" . $attributes_values->fields['options_id'] . "'
01283                                      order by pov.products_options_values_name");
01284 
01285       while(!$values_values->EOF) {
01286 
01287         if ($show_value_numbers == false) {
01288           $show_option_name= '&nbsp;&nbsp;&nbsp;[' . strtoupper(zen_get_products_options_name_from_value($values_values->fields['products_options_values_id'])) . ' ]';
01289         } else {
01290           $show_option_name= ' [ #' . $values_values->fields['products_options_values_id'] . ' ] ' . '&nbsp;&nbsp;&nbsp;[' . strtoupper(zen_get_products_options_name_from_value($values_values->fields['products_options_values_id'])) . ' ]';
01291         }
01292         if ($attributes_values->fields['options_values_id'] == $values_values->fields['products_options_values_id']) {
01293           echo "\n" . '<option name="' . $values_values->fields['products_options_values_name'] . '" value="' . $values_values->fields['products_options_values_id'] . '" SELECTED>' . $values_values->fields['products_options_values_name'] . $show_option_name . '</option>';
01294         } else {
01295           echo "\n" . '<option name="' . $values_values->fields['products_options_values_name'] . '" value="' . $values_values->fields['products_options_values_id'] . '">' . $values_values->fields['products_options_values_name'] . $show_option_name . '</option>';
01296         }
01297         $values_values->MoveNext();
01298       }
01299 ?>
01300 <?php
01301 // set radio values attributes_display_only
01302     switch ($attributes_values->fields['attributes_display_only']) {
01303       case '0': $on_attributes_display_only = false; $off_attributes_display_only = true; break;
01304       case '1': $on_attributes_display_only = true; $off_attributes_display_only = false; break;
01305       default: $on_attributes_display_only = false; $off_attributes_display_only = true;
01306     }
01307 // set radio values attributes_default
01308     switch ($attributes_values->fields['product_attribute_is_free']) {
01309       case '0': $on_product_attribute_is_free = false; $off_product_attribute_is_free = true; break;
01310       case '1': $on_product_attribute_is_free = true; $off_product_attribute_is_free = false; break;
01311       default: $on_product_attribute_is_free = false; $off_product_attribute_is_free = true;
01312     }
01313 // set radio values attributes_default
01314     switch ($attributes_values->fields['attributes_default']) {
01315       case '0': $on_attributes_default = false; $off_attributes_default = true; break;
01316       case '1': $on_attributes_default = true; $off_attributes_default = false; break;
01317       default: $on_attributes_default = false; $off_attributes_default = true;
01318     }
01319 // set radio values attributes_discounted
01320     switch ($attributes_values->fields['attributes_discounted']) {
01321       case '0': $on_attributes_discounted = false; $off_attributes_discounted = true; break;
01322       case '1': $on_attributes_discounted = true; $off_attributes_discounted = false; break;
01323       default: $on_attributes_discounted = false; $off_attributes_discounted = true;
01324     }
01325 // set radio values attributes_price_base_included
01326     switch ($attributes_values->fields['attributes_price_base_included']) {
01327       case '0': $on_attributes_price_base_included = false; $off_attributes_price_base_included = true; break;
01328       case '1': $on_attributes_price_base_included = true; $off_attributes_price_base_included = false; break;
01329       default: $on_attributes_price_base_included = false; $off_attributes_price_base_included = true;
01330     }
01331 // set radio values attributes_required
01332     switch ($attributes_values->fields['attributes_required']) {
01333       case '0': $on_attributes_required = false; $off_attributes_required = true; break;
01334       case '1': $on_attributes_required = true; $off_attributes_required = false; break;
01335       default: $on_attributes_required = false; $off_attributes_required = true;
01336     }
01337 // set image overwrite
01338   $on_overwrite = true;
01339   $off_overwrite = false;
01340 // set image delete
01341   $on_image_delete = false;
01342   $off_image_delete = true;
01343 
01344 ?>
01345             </select>&nbsp;</td>
01346 
01347 </table></td></tr>
01348 
01349 <!-- bof: Edit Prices -->
01350 <tr>
01351   <td class="attributeBoxContent">
01352     <table border="1" cellpadding="4" cellspacing="2" align="left" width="100%">
01353       <tr>
01354         <td align="right" class="pageHeading"><?php echo TEXT_SAVE_CHANGES . '&nbsp;&nbsp;' . zen_image_submit('button_update.gif', IMAGE_UPDATE); ?>&nbsp;<?php echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id ) . '">'; ?><?php echo zen_image_button('button_cancel.gif', IMAGE_CANCEL); ?></a>&nbsp;</td>
01355       </tr>
01356     </table>
01357   </td>
01358 </tr>
01359 
01360 <tr><td>
01361   <table border="0">
01362     <tr>
01363       <td colspan="3" class="pageHeading"><?php echo TEXT_PRICES_AND_WEIGHTS; ?></td>
01364     </tr>
01365     <tr>
01366       <td class="attributeBoxContent">
01367         <table border="1" cellpadding="4" cellspacing="2" align="left">
01368           <tr>
01369             <td align="center" class="smallText">&nbsp;<?php echo TABLE_HEADING_OPT_PRICE; ?><br /><input type="text" name="price_prefix" value="<?php echo $attributes_values->fields['price_prefix']; ?>" size="2">&nbsp;<input type="text" name="value_price" value="<?php echo $attributes_values->fields['options_values_price']; ?>" size="6">&nbsp;</td>
01370             <td align="center" class="smallText">&nbsp;<?php echo TABLE_HEADING_OPT_WEIGHT; ?><br /><input type="text" name="products_attributes_weight_prefix" value="<?php echo $attributes_values->fields['products_attributes_weight_prefix']; ?>" size="2">&nbsp;<input type="text" name="products_attributes_weight" value="<?php echo $attributes_values->fields['products_attributes_weight']; ?>" size="6">&nbsp;</td>
01371             <td align="center" class="smallText">&nbsp;<?php echo TABLE_HEADING_OPT_SORT_ORDER; ?><br /><input type="text" name="products_options_sort_order" value="<?php echo $attributes_values->fields['products_options_sort_order']; ?>" size="4">&nbsp;</td>
01372             <td align="center" class="smallText">&nbsp;<?php echo TABLE_HEADING_ATTRIBUTES_PRICE_ONETIME; ?><br />&nbsp;<input type="text" name="attributes_price_onetime" value="<?php echo $attributes_values->fields['attributes_price_onetime']; ?>" size="6">&nbsp;</td>
01373           </tr>
01374         </table>
01375       </td>
01376 
01377 <?php if (ATTRIBUTES_ENABLED_PRICE_FACTOR == 'true') { ?>
01378       <td class="attributeBoxContent">
01379         <table border="1" cellpadding="4" cellspacing="2" align="left">
01380           <tr>
01381             <td align="center" class="smallText" nowrap="nowrap">&nbsp;<?php echo TABLE_HEADING_ATTRIBUTES_PRICE_FACTOR . ' ' . TABLE_HEADING_ATTRIBUTES_PRICE_FACTOR_OFFSET; ?><br />&nbsp;<input type="text" name="attributes_price_factor" value="<?php echo $attributes_values->fields['attributes_price_factor']; ?>" size="6">&nbsp;&nbsp;<input type="text" name="attributes_price_factor_offset" value="<?php echo $attributes_values->fields['attributes_price_factor_offset']; ?>" size="6">&nbsp;</td>
01382             <td align="center" class="smallText" nowrap="nowrap">&nbsp;<?php echo TABLE_HEADING_ATTRIBUTES_PRICE_FACTOR_ONETIME . ' ' . TABLE_HEADING_ATTRIBUTES_PRICE_FACTOR_OFFSET_ONETIME; ?><br />&nbsp;<input type="text" name="attributes_price_factor_onetime" value="<?php echo $attributes_values->fields['attributes_price_factor_onetime']; ?>" size="6">&nbsp;&nbsp;<input type="text" name="attributes_price_factor_onetime_offset" value="<?php echo $attributes_values->fields['attributes_price_factor_onetime_offset']; ?>" size="6">&nbsp;</td>
01383           </tr>
01384         </table>
01385       </td>
01386 <?php
01387     } else {
01388       echo zen_draw_hidden_field('attributes_price_factor', $attributes_values->fields['attributes_price_factor']);
01389       echo zen_draw_hidden_field('attributes_price_factor_offset', $attributes_values->fields['attributes_price_factor_offset']);
01390       echo zen_draw_hidden_field('attributes_price_factor_onetime', $attributes_values->fields['attributes_price_factor_onetime']);
01391       echo zen_draw_hidden_field('attributes_price_factor_onetime_offset', $attributes_values->fields['attributes_price_factor_onetime_offset']);
01392     } // ATTRIBUTES_ENABLED_PRICE_FACTOR
01393 ?>
01394 
01395     </tr>
01396   </table>
01397 </td></tr>
01398 
01399 <?php if (ATTRIBUTES_ENABLED_QTY_PRICES == 'true') { ?>
01400     <tr>
01401       <td class="attributeBoxContent">
01402         <table border="1" cellpadding="4" cellspacing="2" align="left">
01403           <tr>
01404             <td align="center" class="smallText" nowrap="nowrap">&nbsp;<?php echo TABLE_HEADING_ATTRIBUTES_QTY_PRICES; ?><br />&nbsp;<input type="text" name="attributes_qty_prices" value="<?php echo $attributes_values->fields['attributes_qty_prices']; ?>" size="60">&nbsp;</td>
01405             <td align="center" class="smallText" nowrap="nowrap">&nbsp;<?php echo TABLE_HEADING_ATTRIBUTES_QTY_PRICES_ONETIME; ?><br />&nbsp;<input type="text" name="attributes_qty_prices_onetime" value="<?php echo $attributes_values->fields['attributes_qty_prices_onetime']; ?>" size="60">&nbsp;</td>
01406           </tr>
01407         </table>
01408       </td>
01409     </tr>
01410 <?php
01411     } else {
01412       echo zen_draw_hidden_field('attributes_qty_prices', $attributes_values->fields['attributes_qty_prices']);
01413       echo zen_draw_hidden_field('attributes_qty_prices_onetime', $attributes_values->fields['attributes_qty_prices_onetime']);
01414     } // ATTRIBUTES_ENABLED_QTY_PRICES
01415 ?>
01416 
01417 <?php if (ATTRIBUTES_ENABLED_TEXT_PRICES == 'true') { ?>
01418     <tr>
01419       <td class="attributeBoxContent">
01420         <table border="1" cellpadding="4" cellspacing="2" align="left">
01421           <tr>
01422             <td align="center" class="smallText" nowrap="nowrap">&nbsp;<?php echo TABLE_HEADING_ATTRIBUTES_PRICE_WORDS . ' ' . TABLE_HEADING_ATTRIBUTES_PRICE_WORDS_FREE; ?><br />&nbsp;<input type="text" name="attributes_price_words" value="<?php echo $attributes_values->fields['attributes_price_words']; ?>" size="6">&nbsp;&nbsp;<input type="text" name="attributes_price_words_free" value="<?php echo $attributes_values->fields['attributes_price_words_free']; ?>" size="6">&nbsp;</td>
01423             <td align="center" class="smallText" nowrap="nowrap">&nbsp;<?php echo TABLE_HEADING_ATTRIBUTES_PRICE_LETTERS . ' ' . TABLE_HEADING_ATTRIBUTES_PRICE_LETTERS_FREE; ?><br />&nbsp;<input type="text" name="attributes_price_letters" value="<?php echo $attributes_values->fields['attributes_price_letters']; ?>" size="6">&nbsp;&nbsp;<input type="text" name="attributes_price_letters_free" value="<?php echo $attributes_values->fields['attributes_price_letters_free']; ?>" size="6">&nbsp;</td>
01424           </tr>
01425         </table>
01426       </td>
01427     </tr>
01428 <?php
01429     } else {
01430       echo zen_draw_hidden_field('attributes_price_words', $attributes_values->fields['attributes_price_words']);
01431       echo zen_draw_hidden_field('attributes_price_words_free', $attributes_values->fields['attributes_price_words_free']);
01432       echo zen_draw_hidden_field('attributes_price_letters', $attributes_values->fields['attributes_price_letters']);
01433       echo zen_draw_hidden_field('attributes_price_letters_free', $attributes_values->fields['attributes_price_letters_free']);
01434     } // ATTRIBUTES_ENABLED_TEXT_PRICES
01435 ?>
01436 
01437 <!-- eof: Edit Prices -->
01438 
01439 <tr><td class="attributeBoxContent">
01440 <table border="1" cellpadding="4" cellspacing="2">
01441 
01442               <tr >
01443                 <td class="attributeBoxContent" align="center" width="50"><?php echo TEXT_ATTRIBUTES_FLAGS; ?></td>
01444                 <td class="smallText" align="center" width="150" bgcolor="#ffff00"><strong><?php echo TEXT_ATTRIBUTES_DISPLAY_ONLY . '</strong><br>' . zen_draw_radio_field('attributes_display_only', '0', $off_attributes_display_only) . '&nbsp;' . TABLE_HEADING_NO . ' ' . zen_draw_radio_field('attributes_display_only', '1', $on_attributes_display_only) . '&nbsp;' . TABLE_HEADING_YES; ?></td>
01445                 <td class="smallText" align="center" width="150" bgcolor="#2C54F5"><strong><?php echo TEXT_ATTRIBUTES_IS_FREE . '</strong><br>' . zen_draw_radio_field('product_attribute_is_free', '0', $off_product_attribute_is_free) . '&nbsp;' . TABLE_HEADING_NO . ' ' . zen_draw_radio_field('product_attribute_is_free', '1', $on_product_attribute_is_free) . '&nbsp;' . TABLE_HEADING_YES; ?></td>
01446                 <td class="smallText" align="center" width="150" bgcolor="#ffa346"><strong><?php echo TEXT_ATTRIBUTES_DEFAULT . '</strong><br>' . zen_draw_radio_field('attributes_default', '0', $off_attributes_default) . '&nbsp;' . TABLE_HEADING_NO . ' ' . zen_draw_radio_field('attributes_default', '1', $on_attributes_default) . '&nbsp;' . TABLE_HEADING_YES; ?></td>
01447                 <td class="smallText" align="center" width="150" bgcolor="#ff00ff"><strong><?php echo TEXT_ATTRIBUTE_IS_DISCOUNTED . '</strong><br>' . zen_draw_radio_field('attributes_discounted', '0', $off_attributes_discounted) . '&nbsp;' . TABLE_HEADING_NO . ' ' . zen_draw_radio_field('attributes_discounted', '1', $on_attributes_discounted) . '&nbsp;' . TABLE_HEADING_YES; ?></td>
01448                 <td class="smallText" align="center" width="150" bgcolor="#d200f0"><strong><?php echo TEXT_ATTRIBUTE_PRICE_BASE_INCLUDED . '</strong><br>' . zen_draw_radio_field('attributes_price_base_included', '0', $off_attributes_price_base_included) . '&nbsp;' . TABLE_HEADING_NO . ' ' . zen_draw_radio_field('attributes_price_base_included', '1', $on_attributes_price_base_included) . '&nbsp;' . TABLE_HEADING_YES; ?></td>
01449                 <td align="center" class="smallText" width="150" bgcolor="#FF0606"><strong><?php echo TEXT_ATTRIBUTES_REQUIRED . '</strong><br>' . zen_draw_radio_field('attributes_required', '0', $off_attributes_required) . '&nbsp;' . TABLE_HEADING_NO . ' ' . zen_draw_radio_field('attributes_required', '1', $on_attributes_required) . '&nbsp;' . TABLE_HEADING_YES; ?></td>
01450               </tr>
01451 
01452 </table></td></tr>
01453 
01454 <?php if (ATTRIBUTES_ENABLED_IMAGES == 'true') { ?>
01455 
01456 <?php
01457 // edit
01458 // attributes images
01459   $dir = @dir(DIR_FS_CATALOG_IMAGES);
01460   $dir_info[] = array('id' => '', 'text' => "Main Directory");
01461   while ($file = $dir->read()) {
01462     if (is_dir(DIR_FS_CATALOG_IMAGES . $file) && strtoupper($file) != 'CVS' && $file != "." && $file != "..") {
01463       $dir_info[] = array('id' => $file . '/', 'text' => $file);
01464     }
01465   }
01466   $dir->close();
01467 
01468   sort($dir_info);
01469 
01470   if ($attributes_values->fields['attributes_image'] != '') {
01471     $default_directory = substr( $attributes_values->fields['attributes_image'], 0,strpos( $attributes_values->fields['attributes_image'], '/')+1);
01472   } else {
01473     $default_directory = 'attributes/';
01474   }
01475 ?>
01476 <tr><td class="attributeBoxContent">
01477 <table border="0" cellpadding="4" cellspacing="2">
01478 
01479           <tr class="attributeBoxContent">
01480             <td>&nbsp;</td>
01481             <td colspan="5">
01482               <table>
01483                 <tr class="attributeBoxContent">
01484                   <td class="main" valign="top">&nbsp;</td>
01485                   <td class="main" valign="top"><?php echo TEXT_ATTRIBUTES_IMAGE . '<br />' . zen_draw_file_field('attributes_image') . '<br />' . zen_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . $attributes_values->fields['attributes_image']  . zen_draw_hidden_field('attributes_previous_image', $attributes_values->fields['attributes_image']); ?></td>
01486                   <td class="main" valign="top"><?php echo TEXT_ATTRIBUTES_IMAGE_DIR . '<br />' . zen_draw_pull_down_menu('img_dir', $dir_info, $default_directory); ?></td>
01487                   <td class="main" valign="middle"><?php echo ($attributes_values->fields['attributes_image'] != '' ? zen_image(DIR_WS_CATALOG_IMAGES . $attributes_values->fields['attributes_image']) : ''); ?></td>
01488                   <td class="main" valign="top"><?php echo TEXT_IMAGES_OVERWRITE . '<br />' . zen_draw_radio_field('overwrite', '0', $off_overwrite) . '&nbsp;' . TABLE_HEADING_NO . ' ' . zen_draw_radio_field('overwrite', '1', $on_overwrite) . '&nbsp;' . TABLE_HEADING_YES; ?></td>
01489                   <td class="main" valign="top"><?php echo TEXT_IMAGES_DELETE . '<br />' . zen_draw_radio_field('image_delete', '0', $off_image_delete) . '&nbsp;' . TABLE_HEADING_NO . ' ' . zen_draw_radio_field('image_delete', '1', $on_image_delete) . '&nbsp;' . TABLE_HEADING_YES; ?></td>
01490                 </tr>
01491               </table>
01492             </td>
01493             <td>&nbsp;</td>
01494           </tr>
01495 
01496 </table></td></tr>
01497 <?php
01498     } else {
01499       echo zen_draw_hidden_field('attributes_previous_image', $attributes_values->fields['attributes_image']);
01500       echo zen_draw_hidden_field('attributes_image', $attributes_values->fields['attributes_image']);
01501     } // ATTRIBUTES_ENABLED_IMAGES
01502 ?>
01503 
01504 <?php
01505       if (DOWNLOAD_ENABLED == 'true') {
01506         $download_query_raw ="select products_attributes_filename, products_attributes_maxdays, products_attributes_maxcount
01507                               from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . "
01508                               where products_attributes_id='" . $attributes_values->fields['products_attributes_id'] . "'";
01509         $download = $db->Execute($download_query_raw);
01510         if ($download->RecordCount() > 0) {
01511           $products_attributes_filename = $download->fields['products_attributes_filename'];
01512           $products_attributes_maxdays  = $download->fields['products_attributes_maxdays'];
01513           $products_attributes_maxcount = $download->fields['products_attributes_maxcount'];
01514         }
01515 ?>
01516 <tr><td class="attributeBoxContent">
01517 <table border="0" cellpadding="4" cellspacing="2">
01518           <tr class="attributeBoxContent">
01519             <td colspan="5">
01520                 <tr class="attributeBoxContent">
01521                   <td class="attributeBoxContent" valign="top"><?php echo TABLE_HEADING_DOWNLOAD; ?>&nbsp;</td>
01522                   <td class="attributeBoxContent"><?php echo TABLE_TEXT_FILENAME . '<br />' . zen_draw_input_field('products_attributes_filename', $products_attributes_filename, zen_set_field_length(TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD, 'products_attributes_filename', 35)); ?>&nbsp;</td>
01523                   <td class="attributeBoxContent"><?php echo TABLE_TEXT_MAX_DAYS . '<br />' . zen_draw_input_field('products_attributes_maxdays', $products_attributes_maxdays, 'size="5"'); ?>&nbsp;</td>
01524                   <td class="attributeBoxContent"><?php echo TABLE_TEXT_MAX_COUNT . '<br />' . zen_draw_input_field('products_attributes_maxcount', $products_attributes_maxcount, 'size="5"'); ?>&nbsp;</td>
01525                 </tr>
01526 
01527 </table></td></tr>
01528 </td></tr>
01529 
01530 <?php
01531       }
01532 ?>
01533 
01534 </td></tr>
01535 </table></td></tr>
01536 
01537           <tr>
01538             <td colspan="10"><?php echo zen_black_line(); ?></td>
01539           </tr>
01540           <tr>
01541             <td colspan="10"><?php echo zen_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
01542           </tr>
01543 
01544 <?php
01545     } elseif (($action == 'delete_product_attribute') && ($_GET['attribute_id'] == $attributes_values->fields['products_attributes_id'])) {
01546         echo zen_draw_hidden_field('products_filter', $_GET['products_filter']);
01547         echo zen_draw_hidden_field('current_category_id', $_GET['current_category_id']);
01548         echo zen_draw_hidden_field('delete_attribute_id', $_GET['attribute_id']);
01549         ?>
01550           <tr>
01551             <td colspan="10"><?php echo zen_black_line(); ?></td>
01552           </tr>
01553           <tr class="attributeBoxContent">
01554             <td align="left" colspan="6" class="pageHeading"><?php echo PRODUCTS_ATTRIBUTES_DELETE; ?></td><td colspan="3" align="center" class="pageHeading"><?php echo PRODUCTS_ATTRIBUTES_DELETE; ?></td>
01555             <td colspan="3" align="center" class="attributeBoxContent">&nbsp;</td>
01556           </tr>
01557           <tr>
01558             <td class="attributeBoxContent">&nbsp;<b><?php echo $attributes_values->fields["products_attributes_id"]; ?></b>&nbsp;</td>
01559             <td class="attributeBoxContent">&nbsp;<b><?php echo $products_name_only; ?></b>&nbsp;</td>
01560             <td class="attributeBoxContent">&nbsp;<b><?php echo $options_name; ?></b>&nbsp;</td>
01561             <td class="attributeBoxContent">&nbsp;<b><?php echo $values_name; ?></b>&nbsp;</td>
01562             <td align="right" class="attributeBoxContent">&nbsp;<b><?php echo $attributes_values->fields["options_values_price"]; ?></b>&nbsp;</td>
01563             <td align="center" class="attributeBoxContent">&nbsp;<b><?php echo $attributes_values->fields["price_prefix"]; ?></b>&nbsp;</td>
01564             <td colspan="3" align="center" class="attributeBoxContent">&nbsp;<b><?php echo  zen_image_submit('button_confirm.gif', IMAGE_CONFIRM); ?></a>&nbsp;&nbsp;<?php echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id ) . '">'; ?><?php echo zen_image_button('button_cancel.gif', IMAGE_CANCEL); ?></a>&nbsp;</b></td>
01565             <td colspan="3" align="center" class="attributeBoxContent">&nbsp;</td>
01566           </tr>
01567           <tr class="attributeBoxContent">
01568             <td colspan="10" class="attributeBoxContent">&nbsp;</td>
01569           </tr>
01570           <tr>
01571             <td colspan="10"><?php echo zen_black_line(); ?></td>
01572           </tr>
01573           <tr>
01574 <?php
01575     } else {
01576 // attributes display listing
01577 
01578 // calculate current total attribute price
01579 // $attributes_values
01580 $attributes_price_final = zen_get_attributes_price_final($attributes_values->fields["products_attributes_id"], 1, $attributes_values, 'false');
01581 $attributes_price_final_value = $attributes_price_final;
01582 $attributes_price_final = $currencies->display_price($attributes_price_final, zen_get_tax_rate(1), 1);
01583 $attributes_price_final_onetime = zen_get_attributes_price_final_onetime($attributes_values->fields["products_attributes_id"], 1, $attributes_values);
01584 $attributes_price_final_onetime = $currencies->display_price($attributes_price_final_onetime, zen_get_tax_rate(1), 1);
01585 ?>
01586             <td class="smallText">&nbsp;<?php echo $attributes_values->fields["products_attributes_id"]; ?>&nbsp;</td>
01587             <td class="smallText">&nbsp;<?php // echo $products_name_only; ?>&nbsp;</td>
01588             <td class="smallText">&nbsp;<?php echo $options_name; ?>&nbsp;</td>
01589             <td class="smallText">&nbsp;<?php echo ($attributes_values->fields['attributes_image'] != '' ? zen_image(DIR_WS_IMAGES . 'icon_status_yellow.gif') . '&nbsp;' : '&nbsp;&nbsp;') . $values_name; ?>&nbsp;</td>
01590             <td align="right" class="smallText">&nbsp;<?php echo $attributes_values->fields["price_prefix"]; ?>&nbsp;<?php echo $attributes_values->fields["options_values_price"]; ?>&nbsp;</td>
01591             <td align="right" class="smallText">&nbsp;<?php echo $attributes_values->fields["products_attributes_weight_prefix"]; ?>&nbsp;<?php echo $attributes_values->fields["products_attributes_weight"]; ?>&nbsp;</td>
01592             <td align="right" class="smallText">&nbsp;<?php echo $attributes_values->fields["products_options_sort_order"]; ?>&nbsp;</td>
01593 <?php
01594 // '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=set_flag_attributes_display_only' . '&attributes_id=' . $attributes_values->fields["products_attributes_id"] . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter) . '">' .
01595 // $marker = '&attributes_id=' . $attributes_values->fields["products_attributes_id"] . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter) . '">';
01596 if ($action == '') {
01597 ?>
01598 <td>
01599   <table border="0" align="center" cellpadding="2" cellspacing="2">
01600       <tr>
01601         <td class="smallText" align="center"><?php echo ($attributes_values->fields["attributes_display_only"] == '0' ? '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=set_flag_attributes_display_only' . '&attributes_id=' . $attributes_values->fields["products_attributes_id"] . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '" onClick="divertClick(this.href);return false;">' . zen_image(DIR_WS_IMAGES . 'icon_yellow_off.gif', LEGEND_ATTRIBUTES_DISPLAY_ONLY) . '</a>' : '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=set_flag_attributes_display_only' . '&attributes_id=' . $attributes_values->fields["products_attributes_id"] . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '" onClick="divertClick(this.href);return false;">' . zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', LEGEND_ATTRIBUTES_DISPLAY_ONLY)) . '</a>'; ?></td>
01602         <td class="smallText" align="center"><?php echo ($attributes_values->fields["product_attribute_is_free"] == '0' ? '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=set_flag_product_attribute_is_free' . '&attributes_id=' . $attributes_values->fields["products_attributes_id"] . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '" onClick="divertClick(this.href);return false;">' . zen_image(DIR_WS_IMAGES . 'icon_blue_off.gif', LEGEND_ATTRIBUTES_IS_FREE) . '</a>' : '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=set_flag_product_attribute_is_free' . '&attributes_id=' . $attributes_values->fields["products_attributes_id"] . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '" onClick="divertClick(this.href);return false;">' . zen_image(DIR_WS_IMAGES . 'icon_blue_on.gif', LEGEND_ATTRIBUTES_IS_FREE)) . '</a>'; ?></td>
01603         <td class="smallText" align="center"><?php echo ($attributes_values->fields["attributes_default"] == '0' ? '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=set_flag_attributes_default' . '&attributes_id=' . $attributes_values->fields["products_attributes_id"] . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '" onClick="divertClick(this.href);return false;">' . zen_image(DIR_WS_IMAGES . 'icon_orange_off.gif', LEGEND_ATTRIBUTES_DEFAULT) . '</a>' : '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=set_flag_attributes_default' . '&attributes_id=' . $attributes_values->fields["products_attributes_id"] . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '" onClick="divertClick(this.href);return false;">' . zen_image(DIR_WS_IMAGES . 'icon_orange_on.gif', LEGEND_ATTRIBUTES_DEFAULT)) . '</a>' ?></td>
01604         <td class="smallText" align="center"><?php echo ($attributes_values->fields["attributes_discounted"] == '0' ? '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=set_flag_attributes_discounted' . '&attributes_id=' . $attributes_values->fields["products_attributes_id"] . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '" onClick="divertClick(this.href);return false;">' . zen_image(DIR_WS_IMAGES . 'icon_pink_off.gif', LEGEND_ATTRIBUTE_IS_DISCOUNTED) . '</a>' : '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=set_flag_attributes_discounted' . '&attributes_id=' . $attributes_values->fields["products_attributes_id"] . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '" onClick="divertClick(this.href);return false;">' . zen_image(DIR_WS_IMAGES . 'icon_pink_on.gif', LEGEND_ATTRIBUTE_IS_DISCOUNTED)) . '</a>'; ?></td>
01605         <td class="smallText" align="center"><?php echo ($attributes_values->fields["attributes_price_base_included"] == '0' ? '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=set_flag_attributes_price_base_included' . '&attributes_id=' . $attributes_values->fields["products_attributes_id"] . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '" onClick="divertClick(this.href);return false;">' . zen_image(DIR_WS_IMAGES . 'icon_purple_off.gif', LEGEND_ATTRIBUTE_PRICE_BASE_INCLUDED) . '</a>' : '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=set_flag_attributes_price_base_included' . '&attributes_id=' . $attributes_values->fields["products_attributes_id"] . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '" onClick="divertClick(this.href);return false;">' . zen_image(DIR_WS_IMAGES . 'icon_purple_on.gif', LEGEND_ATTRIBUTE_PRICE_BASE_INCLUDED)) . '</a>'; ?></td>
01606         <td class="smallText" align="center"><?php echo ($attributes_values->fields["attributes_required"] == '0' ? '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=set_flag_attributes_required' . '&attributes_id=' . $attributes_values->fields["products_attributes_id"] . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '" onClick="divertClick(this.href);return false;">' . zen_image(DIR_WS_IMAGES . 'icon_red_off.gif', LEGEND_ATTRIBUTES_REQUIRED) . '</a>' : '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=set_flag_attributes_required' . '&attributes_id=' . $attributes_values->fields["products_attributes_id"] . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id) . '" onClick="divertClick(this.href);return false;">' . zen_image(DIR_WS_IMAGES . 'icon_red_on.gif', LEGEND_ATTRIBUTES_REQUIRED)) . '</a>'; ?></td>
01607       </tr>
01608     </table>
01609 </td>
01610 <?php } ?>
01611 <?php
01612   $new_attributes_price= '';
01613   if ($attributes_values->fields["attributes_discounted"]) {
01614     $new_attributes_price = zen_get_attributes_price_final($attributes_values->fields["products_attributes_id"], 1, '', 'false');
01615     $new_attributes_price = zen_get_discount_calc($products_filter, true, $new_attributes_price);
01616     if ($new_attributes_price != $attributes_price_final_value) {
01617       $new_attributes_price = '|' . $currencies->display_price($new_attributes_price, zen_get_tax_rate(1), 1);
01618     } else {
01619       $new_attributes_price = '';
01620     }
01621   }
01622 ?>
01623             <td align="right" class="smallText"><?php echo $attributes_price_final . $new_attributes_price . ' ' . $attributes_price_final_onetime; ?></td>
01624 <?php
01625   if ($action != '') {
01626 ?>
01627             <td width='120' align="center" class="smallText">&nbsp;</td>
01628 <?php
01629   } else {
01630 ?>
01631             <td align="center" class="smallText">&nbsp;<?php echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=update_attribute&attribute_id=' . $attributes_values->fields['products_attributes_id'] . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id ) . '">'; ?><?php echo zen_image_button('button_edit.gif', IMAGE_UPDATE); ?></a>&nbsp;&nbsp;<?php echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'action=delete_product_attribute&attribute_id=' . $attributes_values->fields['products_attributes_id'] . (isset($_GET['option_page']) ? '&option_page=' . $_GET['option_page'] . '&' : '') . (isset($_GET['value_page']) ? '&value_page=' . $_GET['value_page'] . '&' : '') . (isset($_GET['attribute_page']) ? '&attribute_page=' . $_GET['attribute_page'] : '') . '&products_filter=' . $products_filter . '&current_category_id=' . $current_category_id ) , '">'; ?><?php echo zen_image_button('button_delete.gif', IMAGE_DELETE); ?></a>&nbsp;</td>
01632 <?php
01633   }
01634 ?>
01635 <?php
01636 // bof: show filename if it exists
01637       if (DOWNLOAD_ENABLED == 'true') {
01638         $download_display_query_raw ="select products_attributes_filename, products_attributes_maxdays, products_attributes_maxcount
01639                               from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . "
01640                               where products_attributes_id='" . $attributes_values->fields['products_attributes_id'] . "'";
01641         $download_display = $db->Execute($download_display_query_raw);
01642         if ($download_display->RecordCount() > 0) {
01643 
01644 // Moved to /admin/includes/configure.php
01645   if (!defined('DIR_FS_DOWNLOAD')) define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
01646 
01647   $filename_is_missing='';
01648   if ( !file_exists(DIR_FS_DOWNLOAD . $download_display->fields['products_attributes_filename']) ) {
01649     $filename_is_missing = zen_image(DIR_WS_IMAGES . 'icon_status_red.gif');
01650   } else {
01651     $filename_is_missing = zen_image(DIR_WS_IMAGES . 'icon_status_green.gif');
01652   }
01653 ?>
01654           </tr>
01655 
01656           <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
01657             <td colspan="3" class="smallText">&nbsp;</td>
01658             <td colspan="4"><table>
01659               <tr>
01660                 <td class="smallText"><?php echo $filename_is_missing . '&nbsp;' . TABLE_TEXT_FILENAME; ?></td>
01661                 <td class="smallText">&nbsp;&nbsp;<?php echo $download_display->fields['products_attributes_filename']; ?>&nbsp;</td>
01662                 <td class="smallText">&nbsp;&nbsp;<?php echo TABLE_TEXT_MAX_DAYS_SHORT; ?></td>
01663                 <td class="smallText">&nbsp;&nbsp;<?php echo $download_display->fields['products_attributes_maxdays']; ?>&nbsp;</td>
01664                 <td class="smallText">&nbsp;&nbsp;<?php echo TABLE_TEXT_MAX_COUNT_SHORT; ?></td>
01665                 <td class="smallText">&nbsp;&nbsp;<?php echo $download_display->fields['products_attributes_maxcount']; ?>&nbsp;</td>
01666               </tr>
01667             </table></td>
01668 
01669 
01670 <?php
01671         } // show downloads
01672       }
01673 // eof: show filename if it exists
01674 ?>
01675 <?php
01676     }
01677     $max_attributes_id_values = $db->Execute("select max(products_attributes_id) + 1
01678                                               as next_id from " . TABLE_PRODUCTS_ATTRIBUTES);
01679 
01680     $next_id = $max_attributes_id_values->fields['next_id'];
01681 
01683 // BOF: Add dividers between Product Names and between Option Names
01684     $attributes_values->MoveNext();
01685     if (!$attributes_values->EOF) {
01686       if ($current_attributes_products_id != $attributes_values->fields['products_id']) {
01687 ?>
01688           <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
01689             <td colspan="10"><table width="100%"><td>
01690               <tr>
01691                 <td><?php echo zen_draw_separator('pixel_black.gif', '100%', '3'); ?></td>
01692               </tr>
01693             </table></td></tr>
01694 <?php
01695   } else {
01696     if ($current_attributes_options_id != $attributes_values->fields['options_id']) {
01697 ?>
01698           <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
01699             <td colspan="10"><table width="100%"><td>
01700               <tr>
01701                 <td><?php echo zen_draw_separator('pixel_black.gif', '100%', '1'); ?></td>
01702               </tr>
01703             </table></td></tr>
01704 <?php
01705     }
01706   }
01707 }
01708 // EOF: Add dividers between Product Names and between Option Names
01710 ?>
01711           </tr>
01712 
01713 <?php
01714   }
01715   if (($action != 'update_attribute' and $action != 'delete_product_attribute')) {
01716 ?>
01717           <tr>
01718             <td colspan="10"><?php echo zen_black_line(); ?></td>
01719           </tr>
01720 
01721 <!-- bof_adding -->
01722 <tr class="attributeBoxContent"><td colspan="10"><table border="0" width="100%">
01723 
01724   <tr class="attributeBoxContent">
01725     <td class="pageHeading">
01726       <table border="0" width="100%">
01727         <tr><td class="attributeBoxContent"><table border="0" cellpadding="4" cellspacing="2" width="100%">
01728 
01729           <tr class="attributeBoxContent">
01730             <td class="pageHeading">&nbsp;<?php echo PRODUCTS_ATTRIBUTES_ADDING; ?></td>
01731             <td class="main"><?php echo TEXT_ATTRIBUTES_INSERT_INFO; ?></td>
01732               <td align="center" class="attributeBoxContent" height="30" valign="bottom">&nbsp;
01733               <?php
01734                 if ($action == '') {
01735                   echo zen_image_submit('button_insert.gif', IMAGE_INSERT);
01736                 } else {
01737                   // hide button
01738                 }
01739               ?>
01740             &nbsp;
01741               </td>
01742 
01743           </tr>
01744 
01745         </table></td></tr>
01746       </table>
01747     </td>
01748   </tr>
01749 
01750 <!-- bof Option Names and Values -->
01751   <tr class="attributeBoxContent">
01752     <td class="pageHeading">
01753       <table border='0' width="100%">
01754         <tr><td class="attributeBoxContent"><table border="0" cellpadding="4" cellspacing="2">
01755           <tr class="attributeBoxContent"><td><table><tr>
01756             <td class="attributeBoxContent" width="40">&nbsp;<?php echo $next_id; ?>&nbsp;</td>
01757             <td class="pageHeading" valign="top">&nbsp;
01758               <input type="hidden" name="products_id" value="<?php echo $products_filter; ?>">
01759               <input type="hidden" name="current_category_id" value="<?php echo $current_category_id; ?>">
01760               <?php
01761                       $show_model = zen_get_products_model($products_filter);
01762                       if(!empty($show_model)) {
01763                         $show_model = " - (" . $show_model . ")";
01764                       }
01765                 echo zen_clean_html(zen_get_products_name($products_filter)) . $show_model;
01766               ?>
01767             </td>
01768           </tr></table></td></tr>
01769           <tr class="attributeBoxContent"><td><table><tr>
01770             <td class="attributeBoxContent" width="40">&nbsp;</td>
01771             <td class="attributeBoxContent">&nbsp;<?php echo TABLE_HEADING_OPT_NAME . '<br />'; ?>
01772               <select name="options_id" id="OptionName" onChange="update_option(this.form)" size="<?php echo ($action != 'delete_attribute' ? "15" : "1"); ?>">
01773 <?php
01774     $options_values = $db->Execute("select * from " . TABLE_PRODUCTS_OPTIONS . "
01775                                     where language_id = '" . (int)$_SESSION['languages_id'] . "'
01776                                     order by products_options_name");
01777 
01778     while (!$options_values->EOF) {
01779       echo '              <option name="' . $options_values->fields['products_options_name'] . '" value="' . $options_values->fields['products_options_id'] . '">' . $options_values->fields['products_options_name'] . '&nbsp;&nbsp;&nbsp;[' . translate_type_to_name($options_values->fields['products_options_type']) . ']' . ($show_name_numbers ? ' &nbsp; [ #' . $options_values->fields['products_options_id'] . ' ] ' : '' ) . '</option>' . "\n";
01780       $options_values->MoveNext();
01781     }
01782 ?>
01783             </select>&nbsp;</td>
01784             <td class="attributeBoxContent">&nbsp;<?php echo TABLE_HEADING_OPT_VALUE . '<br />'; ?>
01785             <select name="values_id[]" id="OptionValue" multiple="multiple" size="<?php echo ($action != 'delete_attribute' ? "15" : "1"); ?>">
01786   <option selected>&lt;-- Please select an Option Name from the list ... </option>
01787 </select>&nbsp;</td>
01788 
01789 <script language="javascript" type="text/javascript"><!--
01790   function update_option(theForm) {
01791     // if nothing to do, abort
01792     if (!theForm || !theForm.elements["options_id"] || !theForm.elements["values_id[]"]) return;
01793     if (!theForm.options_id.options[theForm.options_id.selectedIndex]) return;
01794 
01795     // enable hourglass
01796     document.body.style.cursor = "wait";
01797 
01798     // set initial values
01799     var SelectedOption = theForm.options_id.options[theForm.options_id.selectedIndex].value;
01800     var theField = document.getElementById("OptionValue");
01801 
01802     // reset the array of pulldown options so it can be repopulated
01803     var Opts = theField.options.length;
01804     while(Opts > 0) {
01805       Opts = Opts - 1;
01806       theField.options[Opts] = null;
01807     }
01808 
01809 <?php  echo zen_js_option_values_list('SelectedOption', 'theField'); ?>
01810 
01811     // turn off hourglass
01812     document.body.style.cursor = "default";
01813   }
01814 -->
01815 </script>
01816 <?php
01817 
01818 $chk_defaults = $db->Execute("select products_type from " . TABLE_PRODUCTS . " where products_id=" . $products_filter);
01819 // set defaults for adding attributes
01820 
01821 $on_product_attribute_is_free = (zen_get_show_product_switch($products_filter, 'ATTRIBUTE_IS_FREE', 'DEFAULT_', '') == 1 ? true : false);
01822 $off_product_attribute_is_free = ($on_product_attribute_is_free == 1 ? false : true);
01823 $on_attributes_display_only = (zen_get_show_product_switch($products_filter, 'ATTRIBUTES_DISPLAY_ONLY', 'DEFAULT_', '') == 1 ? true : false);
01824 $off_attributes_display_only = ($on_attributes_display_only == 1 ? false : true);
01825 $on_attributes_default = (zen_get_show_product_switch($products_filter, 'ATTRIBUTES_DEFAULT', 'DEFAULT_', '') == 1 ? true : false);
01826 $off_attributes_default = ($on_attributes_default == 1 ? false : true);
01827 $on_attributes_discounted = (zen_get_show_product_switch($products_filter, 'ATTRIBUTES_DISCOUNTED', 'DEFAULT_', '') == 1 ? true : false);
01828 $off_attributes_discounted = ($on_attributes_discounted == 1 ? false : true);
01829 $on_attributes_price_base_included = (zen_get_show_product_switch($products_filter, 'ATTRIBUTES_PRICE_BASE_INCLUDED', 'DEFAULT_', '') == 1 ? true : false);
01830 $off_attributes_price_base_included = ($on_attributes_price_base_included == 1 ? false : true);
01831 $on_attributes_required = (zen_get_show_product_switch($products_filter, 'ATTRIBUTES_REQUIRED', 'DEFAULT_', '') == 1 ? true : false);
01832 $off_attributes_required = ($on_attributes_required == 1 ? false : true);
01833 
01834 $default_price_prefix = zen_get_show_product_switch($products_filter, 'PRICE_PREFIX', 'DEFAULT_', '');
01835 $default_price_prefix = ($default_price_prefix == 1 ? '+' : ($default_price_prefix == 2 ? '-' : ''));
01836 $default_products_attributes_weight_prefix  = zen_get_show_product_switch($products_filter, 'PRODUCTS_ATTRIBUTES_WEIGHT_PREFIX', 'DEFAULT_', '');
01837 $default_products_attributes_weight_prefix  = ($default_products_attributes_weight_prefix  == 1 ? '+' : ($default_products_attributes_weight_prefix == 2 ? '-' : ''));
01838 
01839 // set defaults for copying
01840 $on_overwrite = true;
01841 $off_overwrite = false;
01842 ?>
01843             </select>&nbsp;</td>
01844           </tr></table></td></tr>
01845 
01846 <?php // split here ?>
01847         </table></td></tr>
01848       </table>
01849     </td>
01850   </tr>
01851 <!-- eof Option Name and Value -->
01852 
01853 <!-- bof Prices and Weight -->
01854   <tr><td class="attributeBoxContent"><table border="0" cellpadding="4" cellspacing="2">
01855     <tr>
01856       <td colspan="2" class="pageHeading"><?php echo TEXT_PRICES_AND_WEIGHTS; ?></td>
01857     </tr>
01858     <tr>
01859       <td class="attributeBoxContent">
01860         <table border="1" cellpadding="4" cellspacing="2">
01861           <tr>
01862             <td align="center" class="attributeBoxContent">&nbsp;<?php echo TABLE_HEADING_OPT_PRICE . '<br />'; ?><input type="text" name="price_prefix" size="2" value="<?php echo $default_price_prefix; ?>">&nbsp;<input type="text" name="value_price" size="6">&nbsp;</td>
01863             <td align="center" class="attributeBoxContent">&nbsp;<?php echo TABLE_HEADING_OPT_WEIGHT . '<br />'; ?><input type="text" name="products_attributes_weight_prefix" size="2" value="<?php echo $default_products_attributes_weight_prefix; ?>">&nbsp;<input type="text" name="products_attributes_weight" size="6">&nbsp;</td>
01864             <td align="center" class="attributeBoxContent">&nbsp;<?php echo TABLE_HEADING_OPT_SORT_ORDER; ?><br /><input type="text" name="products_options_sort_order" value="" size="4">&nbsp;</td>
01865             <td align="center" class="attributeBoxContent">&nbsp;<?php echo TABLE_HEADING_ATTRIBUTES_PRICE_ONETIME . '<br />'; ?><input type="text" name="attributes_price_onetime" size="6">&nbsp;</td>
01866           </tr>
01867         </table>
01868       </td>
01869 
01870 <?php if (ATTRIBUTES_ENABLED_PRICE_FACTOR == 'true') { ?>
01871       <td class="attributeBoxContent">
01872         <table border="1" cellpadding="4" cellspacing="2">
01873           <tr>
01874             <td align="center" class="attributeBoxContent" nowrap="nowrap">&nbsp;<?php echo TABLE_HEADING_ATTRIBUTES_PRICE_FACTOR . '&nbsp;&nbsp;' . TABLE_HEADING_ATTRIBUTES_PRICE_FACTOR_OFFSET . '<br />'; ?><input type="text" name="attributes_price_factor" size="6">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="attributes_price_factor_offset" size="6">&nbsp;</td>
01875             <td align="center" class="attributeBoxContent" nowrap="nowrap">&nbsp;<?php echo TABLE_HEADING_ATTRIBUTES_PRICE_FACTOR_ONETIME . '&nbsp;&nbsp;' . TABLE_HEADING_ATTRIBUTES_PRICE_FACTOR_OFFSET_ONETIME . '<br />'; ?><input type="text" name="attributes_price_factor_onetime" size="6">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="attributes_price_factor_onetime_offset" size="6">&nbsp;</td>
01876           </tr>
01877         </table>
01878       </td>
01879     </tr>
01880 <?php
01881     } // ATTRIBUTES_ENABLED_PRICE_FACTOR
01882 ?>
01883 
01884 <?php if (ATTRIBUTES_ENABLED_QTY_PRICES == 'true') { ?>
01885     <tr>
01886       <td colspan="2" class="attributeBoxContent">
01887         <table border="1" cellpadding="4" cellspacing="2">
01888           <tr>
01889             <td align="center" class="attributeBoxContent" nowrap="nowrap">&nbsp;<?php echo TABLE_HEADING_ATTRIBUTES_QTY_PRICES . '<br />'; ?><input type="text" name="attributes_qty_prices" size="60">&nbsp;</td>
01890             <td align="center" class="attributeBoxContent" nowrap="nowrap">&nbsp;<?php echo TABLE_HEADING_ATTRIBUTES_QTY_PRICES_ONETIME . '<br />'; ?><input type="text" name="attributes_qty_prices_onetime" size="60">&nbsp;</td>
01891           </tr>
01892         </table>
01893       </td>
01894     </tr>
01895 <?php } // ATTRIBUTES_ENABLED_QTY_PRICES ?>
01896 
01897 <?php if (ATTRIBUTES_ENABLED_TEXT_PRICES == 'true') { ?>
01898     <tr>
01899       <td colspan="2" class="attributeBoxContent">
01900         <table border="1" cellpadding="4" cellspacing="2">
01901           <tr>
01902             <td align="center" class="attributeBoxContent" nowrap="nowrap">&nbsp;<?php echo TABLE_HEADING_ATTRIBUTES_PRICE_WORDS . '&nbsp;&nbsp;' . TABLE_HEADING_ATTRIBUTES_PRICE_WORDS_FREE . '<br />'; ?><input type="text" name="attributes_price_words" size="6">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="attributes_price_words_free" size="6">&nbsp;</td>
01903             <td align="center" class="attributeBoxContent" nowrap="nowrap">&nbsp;<?php echo TABLE_HEADING_ATTRIBUTES_PRICE_LETTERS . '&nbsp;&nbsp;' . TABLE_HEADING_ATTRIBUTES_PRICE_LETTERS_FREE . '<br />'; ?><input type="text" name="attributes_price_letters" size="6">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="attributes_price_letters_free" size="6">&nbsp;</td>
01904           </tr>
01905         </table>
01906       </td>
01907     </tr>
01908 <?php } // ATTRIBUTES_ENABLED_TEXT_PRICES ?>
01909 
01910   </table></td></tr>
01911 
01912 <!-- eof Option Name and Value -->
01913 
01914 <!-- bof Attribute Flags -->
01915 <tr class="attributeBoxContent">
01916   <td class="pageHeading">
01917     <table border='0' width="100%">
01918       <tr><td class="attributeBoxContent"><table border="0" cellpadding="4" cellspacing="2">
01919 
01920             <tr><td class="attributeBoxContent"><table border="1" cellpadding="4" cellspacing="2">
01921 
01922               <tr >
01923                 <td class="smallText" align="center" width="50"><?php echo TEXT_ATTRIBUTES_FLAGS; ?></td>
01924                 <td class="smallText" align="center" width="150" bgcolor="#ffff00"><strong><?php echo TEXT_ATTRIBUTES_DISPLAY_ONLY . '</strong><br>' . zen_draw_radio_field('attributes_display_only', '0', $off_attributes_display_only) . '&nbsp;' . TABLE_HEADING_NO . ' ' . zen_draw_radio_field('attributes_display_only', '1', $on_attributes_display_only) . '&nbsp;' . TABLE_HEADING_YES; ?></td>
01925                 <td class="smallText" align="center" width="150" bgcolor="#2C54F5"><strong><?php echo TEXT_ATTRIBUTES_IS_FREE . '</strong><br>' . zen_draw_radio_field('product_attribute_is_free', '0', $off_product_attribute_is_free) . '&nbsp;' . TABLE_HEADING_NO . ' ' . zen_draw_radio_field('product_attribute_is_free', '1', $on_product_attribute_is_free) . '&nbsp;' . TABLE_HEADING_YES; ?></td>
01926                 <td class="smallText" align="center" width="150" bgcolor="#ffa346"><strong><?php echo TEXT_ATTRIBUTES_DEFAULT . '</strong><br>' . zen_draw_radio_field('attributes_default', '0', $off_attributes_default) . '&nbsp;' . TABLE_HEADING_NO . ' ' . zen_draw_radio_field('attributes_default', '1', $on_attributes_default) . '&nbsp;' . TABLE_HEADING_YES; ?></td>
01927                 <td class="smallText" align="center" width="150" bgcolor="#ff00ff"><strong><?php echo TEXT_ATTRIBUTE_IS_DISCOUNTED . '</strong><br>' . zen_draw_radio_field('attributes_discounted', '0', $off_attributes_discounted) . '&nbsp;' . TABLE_HEADING_NO . ' ' . zen_draw_radio_field('attributes_discounted', '1', $on_attributes_discounted) . '&nbsp;' . TABLE_HEADING_YES; ?></td>
01928                 <td class="smallText" align="center" width="150" bgcolor="#d200f0"><strong><?php echo TEXT_ATTRIBUTE_PRICE_BASE_INCLUDED . '</strong><br>' . zen_draw_radio_field('attributes_price_base_included', '0', $off_attributes_price_base_included) . '&nbsp;' . TABLE_HEADING_NO . ' ' . zen_draw_radio_field('attributes_price_base_included', '1', $on_attributes_price_base_included) . '&nbsp;' . TABLE_HEADING_YES; ?></td>
01929                 <td align="center" class="smallText" width="150" bgcolor="#FF0606"><strong><?php echo TEXT_ATTRIBUTES_REQUIRED . '</strong><br>' . zen_draw_radio_field('attributes_required', '0', $off_attributes_required) . '&nbsp;' . TABLE_HEADING_NO . ' ' . zen_draw_radio_field('attributes_required', '1', $on_attributes_required) . '&nbsp;' . TABLE_HEADING_YES; ?></td>
01930               </tr>
01931 
01932 </table></td></tr>
01933 
01934       </table></td></tr>
01935     </table>
01936   </td>
01937 </tr>
01938 <!-- eof Attribute Flags -->
01939 
01940 <?php if (ATTRIBUTES_ENABLED_IMAGES == 'true') { ?>
01941 <?php
01942 // add
01943 // attributes images
01944   $dir = @dir(DIR_FS_CATALOG_IMAGES);
01945   $dir_info[] = array('id' => '', 'text' => "Main Directory");
01946   while ($file = $dir->read()) {
01947     if (is_dir(DIR_FS_CATALOG_IMAGES . $file) && strtoupper($file) != 'CVS' && $file != "." && $file != "..") {
01948       $dir_info[] = array('id' => $file . '/', 'text' => $file);
01949     }
01950   }
01951   $dir->close();
01952   sort($dir_info);
01953 
01954   $default_directory = 'attributes/';
01955 ?>
01956 
01957 <!-- bof Attribute Images -->
01958 <tr class="attributeBoxContent">
01959   <td class="pageHeading">
01960     <table border='0' width="100%">
01961       <tr><td class="attributeBoxContent"><table border="0" cellpadding="4" cellspacing="2" width="100%">
01962 
01963         <tr><td class="attributeBoxContent"><table border="0" cellpadding="4" cellspacing="2">
01964           <tr class="attributeBoxContent">
01965             <td>&nbsp;</td>
01966             <td class="main" valign="top">&nbsp;</td>
01967 
01968 <!--
01969             <td class="main" valign="top">xxx<?php echo TEXT_ATTRIBUTES_IMAGE . '<br />' . zen_draw_file_field('attributes_image') . '<br />' . zen_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . $attributes_values->fields['attributes_image'] . zen_draw_hidden_field('attributes_image', $attributes_values->fields['attributes_image']); ?></td>
01970 -->
01971 
01972             <td class="main" valign="top"><?php echo TEXT_ATTRIBUTES_IMAGE . '<br />' . zen_draw_file_field('attributes_image'); ?></td>
01973 
01974             <td class="main" valign="top"><?php echo TEXT_ATTRIBUTES_IMAGE_DIR . '<br />' . zen_draw_pull_down_menu('img_dir', $dir_info, $default_directory); ?></td>
01975             <td class="main" valign="top"><?php echo TEXT_IMAGES_OVERWRITE . '<br />' . zen_draw_radio_field('overwrite', '0', $off_overwrite) . '&nbsp;' . TABLE_HEADING_NO . ' ' . zen_draw_radio_field('overwrite', '1', $on_overwrite) . '&nbsp;' . TABLE_HEADING_YES; ?></td>
01976           </tr>
01977         </table></td>
01978 
01979         <td width="200">
01980           <table align="right">
01981             <tr>
01982               <td align="center" class="attributeBoxContent" height="30" valign="bottom">&nbsp;
01983               <?php
01984                 if ($action == '') {
01985                   echo zen_image_submit('button_insert.gif', IMAGE_INSERT);
01986                 } else {
01987                   // hide button
01988                 }
01989               ?>
01990             &nbsp;
01991               </td>
01992             </tr>
01993           </table>
01994 
01995         </td></tr>
01996 
01997       </table></td></tr>
01998     </table>
01999   </td>
02000 </tr>
02001 <!-- eof Attribute Images -->
02002 <?php } // ATTRIBUTES_ENABLED_IMAGES ?>
02003 
02004 <?php
02005       if (DOWNLOAD_ENABLED == 'true') {
02006         $products_attributes_maxdays  = DOWNLOAD_MAX_DAYS;
02007         $products_attributes_maxcount = DOWNLOAD_MAX_COUNT;
02008 ?>
02009 <!-- bof Down loads ON -->
02010 <tr class="attributeBoxContent">
02011   <td class="pageHeading">
02012     <table border='0' width="100%">
02013       <tr><td class="attributeBoxContent"><table border="0" cellpadding="4" cellspacing="2">
02014 
02015         <tr><td class="attributeBoxContent"><table border="0" cellpadding="4" cellspacing="2">
02016           <tr class="attributeBoxContent">
02017             <td class="attributeBoxContent" valign="top"><?php echo TABLE_HEADING_DOWNLOAD; ?>&nbsp;</td>
02018             <td class="attributeBoxContent"><?php echo TABLE_TEXT_FILENAME . '<br />' . zen_draw_input_field('products_attributes_filename', $products_attributes_filename, zen_set_field_length(TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD, 'products_attributes_filename', 35)); ?>&nbsp;</td>
02019             <td class="attributeBoxContent"><?php echo TABLE_TEXT_MAX_DAYS . '<br />' . zen_draw_input_field('products_attributes_maxdays', $products_attributes_maxdays, 'size="5"'); ?>&nbsp;</td>
02020             <td class="attributeBoxContent"><?php echo TABLE_TEXT_MAX_COUNT . '<br />' . zen_draw_input_field('products_attributes_maxcount', $products_attributes_maxcount, 'size="5"'); ?>&nbsp;</td>
02021           </tr>
02022         </table></td></tr>
02023 
02024       </table></td></tr>
02025     </table>
02026   </td>
02027 </tr>
02028 <!-- eof Downloads ON -->
02029 
02030 <?php
02031       } else {
02032 ?>
02033 <!-- bof Down loads OFF -->
02034 <tr class="attributeBoxContent">
02035   <td class="pageHeading">
02036     <table border='0' width="100%">
02037       <tr><td class="attributeBoxContent"><table border="1" cellpadding="4" cellspacing="2">
02038 
02039         <tr><td class="attributeBoxContent"><table border="0" cellpadding="4" cellspacing="2">
02040           <tr class="attributeBoxContent">
02041             <td class="attributeBoxContent"><?php echo TEXT_DOWNLOADS_DISABLED; ?>&nbsp;</td>
02042           </tr>
02043         </table></td></tr>
02044 
02045       </table></td></tr>
02046     </table>
02047   </td>
02048 </tr>
02049 <!-- eof Downloads OFF -->
02050 <?php
02051       } // end of DOWNLOAD_ENABLED section
02052 ?>
02053 <?php
02054   }
02055 ?>
02056         </table></form></td>
02057 <?php
02058 } // EOF: attributes preview
02059 ?>
02060       </tr>
02061 <?php
02062 } // end of attributes
02063 ?>
02064     </table></td>
02065 
02066 </table></td></tr>
02067 <!-- eof_adding -->
02068 
02069 <!-- products_attributes_eof //-->
02070   </tr>
02071 </table>
02072 <!-- body_text_eof //-->
02073 <!-- footer //-->
02074 <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
02075 <!-- footer_eof //-->
02076 <form id="divertClickProto" action="#" method="post">
02077 <input type="hidden" name="divertClickProto" value="" />
02078 <input type="hidden" name="securityToken" value="<?php echo $_SESSION['securityToken']; ?>" />
02079 </form>
02080 <script type="text/javascript">
02081 function divertClick(href)
02082 {
02083    document.getElementById('divertClickProto').action = href;   
02084    document.getElementById('divertClickProto').submit();
02085    return false;
02086 }
02087 
02088 </script>
02089 
02090 </body>
02091 </html>
02092 <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
 All Data Structures Namespaces Files Functions Variables Enumerations