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

Zen Cart 源代码 attributes_controller.php




下载文件

文件名: attributes_controller.php
文件类型: PHP文件
文件大小: 137.17 KiB
MD5: b5d3c5ebea0b1c238a7991401bd05c7a

attributes_controller.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2014 Zen Cart Development Team
  5.  * @copyright Portions Copyright 2003 osCommerce
  6.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  7.  * @version GIT: $Id: Author: DrByte  Modified in v1.5.4 $
  8.  */
  9.   require('includes/application_top.php');
  10.  
  11.   // troubleshooting/debug of option name/value IDs:
  12.   $show_name_numbers = true;
  13.   $show_value_numbers = true;
  14.   // verify option names, values, products
  15.   $chk_option_names = $db->Execute("select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id='" . (int)$_SESSION['languages_id'] . "' limit 1");
  16.   if ($chk_option_names->RecordCount() < 1) {
  17.     $messageStack->add_session(ERROR_DEFINE_OPTION_NAMES, 'caution');
  18.     zen_redirect(zen_href_link(FILENAME_OPTIONS_NAME_MANAGER));
  19.   }
  20.   $chk_option_values = $db->Execute("select * from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where language_id='" . (int)$_SESSION['languages_id'] . "' and products_options_values_id != " . (int)PRODUCTS_OPTIONS_VALUES_TEXT_ID . " limit 1");
  21.   if ($chk_option_values->RecordCount() < 1) {
  22.     $messageStack->add_session(ERROR_DEFINE_OPTION_VALUES, 'caution');
  23.     zen_redirect(zen_href_link(FILENAME_OPTIONS_VALUES_MANAGER));
  24.   }
  25.   $chk_products = $db->Execute("select * from " . TABLE_PRODUCTS . " limit 1");
  26.   if ($chk_products->RecordCount() < 1) {
  27.     $messageStack->add_session(ERROR_DEFINE_PRODUCTS, 'caution');
  28.     zen_redirect(zen_href_link(FILENAME_CATEGORIES));
  29.   }
  30.   // check for damaged database, caused by users indiscriminately deleting table data
  31.   $ary = array();
  32.   $chk_option_values = $db->Execute("select * from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id=" . (int)PRODUCTS_OPTIONS_VALUES_TEXT_ID);
  33.   while (!$chk_option_values->EOF) {
  34.     $ary[] = $chk_option_values->fields['language_id'];
  35.     $chk_option_values->MoveNext();
  36.   }
  37.   $languages = zen_get_languages();
  38.   for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {
  39.     if ((int)$languages[$i]['id'] > 0 && !in_array((int)$languages[$i]['id'], $ary)) {
  40.       $db->Execute("INSERT INTO " . TABLE_PRODUCTS_OPTIONS_VALUES . " (products_options_values_id, language_id, products_options_values_name) VALUES (" . (int)PRODUCTS_OPTIONS_VALUES_TEXT_ID . ", " . (int)$languages[$i]['id'] . ", 'TEXT')");
  41.     }
  42.   }
  43.  
  44.   require(DIR_WS_CLASSES . 'currencies.php');
  45.   $currencies = new currencies();
  46.  
  47.   $action = (isset($_GET['action']) ? $_GET['action'] : '');
  48.  
  49.   $_GET['products_filter'] = $products_filter = (isset($_GET['products_filter']) ? (int)$_GET['products_filter'] : (int)$products_filter);
  50.   $_GET['attributes_id'] = (isset($_GET['attributes_id']) ? (int)$_GET['attributes_id'] : 0);
  51.  
  52.   $_GET['current_category_id'] = $current_category_id = (isset($_GET['current_category_id']) ? (int)$_GET['current_category_id'] : (int)$current_category_id);
  53.   if (isset($_POST['products_filter'])) $_POST['products_filter'] = (int)$_POST['products_filter'];
  54.   if (isset($_POST['current_category_id'])) $_POST['current_category_id'] = (int)$_POST['current_category_id'];
  55.   if (isset($_POST['products_options_id_all'])) $_POST['products_options_id_all'] = (int)$_POST['products_options_id_all'];
  56.   if (isset($_POST['current_category_id'])) $_POST['current_category_id'] = (int)$_POST['current_category_id'];
  57.   if (isset($_POST['categories_update_id'])) $_POST['categories_update_id'] = (int)$_POST['categories_update_id'];
  58.  
  59.   if ($action == 'new_cat') {
  60.     $sql =     "select ptc.*
  61.    from " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc
  62.    left join " . TABLE_PRODUCTS_DESCRIPTION . " pd
  63.    on ptc.products_id = pd.products_id
  64.    and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
  65.    where ptc.categories_id='" . $current_category_id . "'
  66.    order by pd.products_name";
  67.     $new_product_query = $db->Execute($sql);
  68.     $products_filter = $new_product_query->fields['products_id'];
  69.     zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
  70.   }
  71.  
  72. // set categories and products if not set
  73.   if ($products_filter == '' and $current_category_id != '') {
  74.     $sql =     "select ptc.*
  75.    from " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc
  76.    left join " . TABLE_PRODUCTS_DESCRIPTION . " pd
  77.    on ptc.products_id = pd.products_id
  78.    and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
  79.    where ptc.categories_id='" . $current_category_id . "'
  80.    order by pd.products_name";
  81.     $new_product_query = $db->Execute($sql);
  82.     $products_filter = $new_product_query->fields['products_id'];
  83.     if ($products_filter != '') {
  84.       zen_redirect(zen_href_link(FILENAME_PRODUCTS_PRICE_MANAGER, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id));
  85.     }
  86.   } else {
  87.     if ($products_filter == '' and $current_category_id == '') {
  88.       $reset_categories_id = zen_get_category_tree('', '', '0', '', '', true);
  89.       $current_category_id = $reset_categories_id[0]['id'];
  90.       $sql = "select ptc.*
  91.      from " . TABLE_PRODUCTS_TO_CATEGORIES . " ptc
  92.      left join " . TABLE_PRODUCTS_DESCRIPTION . " pd
  93.      on ptc.products_id = pd.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
  94.      where ptc.categories_id='" . $current_category_id . "'
  95.      order by pd.products_name";
  96.       $new_product_query = $db->Execute($sql);
  97.       $products_filter = $new_product_query->fields['products_id'];
  98.       $_GET['products_filter'] = $products_filter;
  99.     }
  100.   }
  101.  
  102.   require(DIR_WS_MODULES . FILENAME_PREV_NEXT);
  103.  
  104.   if (zen_not_null($action)) {
  105.     $_SESSION['page_info'] = '';
  106.     if (isset($_GET['option_page'])) $_SESSION['page_info'] .= 'option_page=' . $_GET['option_page'] . '&';
  107.     if (isset($_GET['value_page'])) $_SESSION['page_info'] .= 'value_page=' . $_GET['value_page'] . '&';
  108.     if (isset($_GET['attribute_page'])) $_SESSION['page_info'] .= 'attribute_page=' . $_GET['attribute_page'] . '&';
  109.     if (isset($_GET['products_filter'])) $_SESSION['page_info'] .= 'products_filter=' . $_GET['products_filter'] . '&';
  110.     if (isset($_GET['current_category_id'])) $_SESSION['page_info'] .= 'current_category_id=' . $_GET['current_category_id'] . '&';
  111.  
  112.     if (zen_not_null($_SESSION['page_info'])) {
  113.       $_SESSION['page_info'] = substr($_SESSION['page_info'], 0, -1);
  114.     }
  115.  
  116.     switch ($action) {
  117. /////////////////////////////////////////
  118. //// BOF OF FLAGS
  119.       case 'set_flag_attributes_display_only':
  120.         if (isset($_POST['divertClickProto']))
  121.         {
  122.           $action='';
  123.           $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'] . "'");
  124.           if ($new_flag->fields['attributes_display_only'] == '0') {
  125.             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . " set attributes_display_only='1' where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
  126.           } else {
  127.             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . " set attributes_display_only='0' where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
  128.           }
  129.         }
  130.         break;
  131.  
  132.       case 'set_flag_product_attribute_is_free':
  133.         if (isset($_POST['divertClickProto']))
  134.         {
  135.           $action='';
  136.           $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'] . "'");
  137.           if ($new_flag->fields['product_attribute_is_free'] == '0') {
  138.             $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'] . "'");
  139.           } else {
  140.             $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'] . "'");
  141.           }
  142.           zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, $_SESSION['page_info'] . '&products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $_GET['current_category_id']));
  143.         }
  144.         break;
  145.  
  146.       case 'set_flag_attributes_default':
  147.         if (isset($_POST['divertClickProto']))
  148.         {
  149.           $action='';
  150.           $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'] . "'");
  151.           if ($new_flag->fields['attributes_default'] == '0') {
  152.             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . " set attributes_default='1' where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
  153.           } else {
  154.             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . " set attributes_default='0' where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
  155.           }
  156.           zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, $_SESSION['page_info'] . '&products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $_GET['current_category_id']));
  157.         }
  158.         break;
  159.  
  160.       case 'set_flag_attributes_discounted':
  161.         if (isset($_POST['divertClickProto']))
  162.         {
  163.           $action='';
  164.           $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'] . "'");
  165.           if ($new_flag->fields['attributes_discounted'] == '0') {
  166.             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . " set attributes_discounted='1' where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
  167.           } else {
  168.             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . " set attributes_discounted='0' where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
  169.           }
  170.           // reset products_price_sorter for searches etc.
  171.           zen_update_products_price_sorter($_GET['products_filter']);
  172.           zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, $_SESSION['page_info'] . '&products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $_GET['current_category_id']));
  173.         }
  174.         break;
  175.  
  176.       case 'set_flag_attributes_price_base_included':
  177.         if (isset($_POST['divertClickProto']))
  178.         {
  179.           $action='';
  180.           $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'] . "'");
  181.           if ($new_flag->fields['attributes_price_base_included'] == '0') {
  182.             $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'] . "'");
  183.           } else {
  184.             $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'] . "'");
  185.           }
  186.  
  187.           // reset products_price_sorter for searches etc.
  188.           zen_update_products_price_sorter($_GET['products_filter']);
  189.  
  190.           zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, $_SESSION['page_info'] . '&products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $_GET['current_category_id']));
  191.         }
  192.         break;
  193.  
  194.       case 'set_flag_attributes_required':
  195.         if (isset($_POST['divertClickProto']))
  196.         {
  197.           $action='';
  198.           $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'] . "'");
  199.           if ($new_flag->fields['attributes_required'] == '0') {
  200.             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . " set attributes_required='1' where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
  201.           } else {
  202.             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . " set attributes_required='0' where products_id='" . $_GET['products_filter'] . "' and products_attributes_id='" . $_GET['attributes_id'] . "'");
  203.           }
  204.           zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, $_SESSION['page_info'] . '&products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $_GET['current_category_id']));
  205.         }
  206.         break;
  207.  
  208. //// EOF OF FLAGS
  209. /////////////////////////////////////////
  210.  
  211.       case 'set_products_filter':
  212.         $_GET['products_filter'] = (int)$_POST['products_filter'];
  213.         $_GET['current_category_id'] = (int)$_POST['current_category_id'];
  214.         $action='';
  215.         zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, $_SESSION['page_info'] . '&products_filter=' . $_GET['products_filter'] . '&current_category_id=' . $_GET['current_category_id']));
  216.         break;
  217. // update by product
  218.       case ('update_attribute_sort'):
  219.         if (isset($_POST['confirm']) && $_POST['confirm'] == 'y')
  220.         {
  221.           if (!zen_has_product_attributes($products_filter, 'false')) {
  222.             $messageStack->add_session(SUCCESS_PRODUCT_UPDATE_SORT_NONE . $products_filter . ' ' . zen_get_products_name($products_filter, $_SESSION['languages_id']), 'error');
  223.           } else {
  224.             zen_update_attributes_products_option_values_sort_order($products_filter);
  225.             $messageStack->add_session(SUCCESS_PRODUCT_UPDATE_SORT . $products_filter . ' ' . zen_get_products_name($products_filter, $_SESSION['languages_id']), 'success');
  226.           }
  227.           $action='';
  228.           zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $_GET['current_category_id']));
  229.         }
  230.         break;
  231.       case 'add_product_attributes':
  232.         $current_image_name = '';
  233.         for ($i=0; $i<sizeof($_POST['values_id']); $i++) {
  234.           if (isset($_POST['values_id'][$i])) $_POST['values_id'][$i] = (int)$_POST['values_id'][$i];
  235.           if (isset($_POST['options_id'])) $_POST['options_id'] = (int)$_POST['options_id'];
  236.           if (isset($_POST['products_id'])) $_POST['products_id'] = (int)$_POST['products_id'];
  237. // check for duplicate and block them
  238.           $check_duplicate = $db->Execute("select * from " . TABLE_PRODUCTS_ATTRIBUTES . "
  239.                                           where products_id ='" . (int)$_POST['products_id'] . "'
  240.                                           and options_id = '" . (int)$_POST['options_id'] . "'
  241.                                           and options_values_id = '" . (int)$_POST['values_id'][$i] . "'");
  242.           if ($check_duplicate->RecordCount() > 0) {
  243.             // do not add duplicates -- give a warning
  244.             $messageStack->add_session(ATTRIBUTE_WARNING_DUPLICATE . ' - ' . zen_options_name($_POST['options_id']) . ' : ' . zen_values_name($_POST['values_id'][$i]), 'error');
  245.           } else {
  246. // For TEXT and FILE option types, ignore option value entered by administrator and use PRODUCTS_OPTIONS_VALUES_TEXT instead.
  247.             $products_options_array = $db->Execute("select products_options_type from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . $_POST['options_id'] . "'");
  248.             $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]);
  249.  
  250.             $products_id = zen_db_prepare_input($_POST['products_id']);
  251.             $options_id = zen_db_prepare_input($_POST['options_id']);
  252. //            $values_id = zen_db_prepare_input($_POST['values_id'][$i]);
  253.             $value_price = zen_db_prepare_input($_POST['value_price']);
  254.             $price_prefix = zen_db_prepare_input($_POST['price_prefix']);
  255.  
  256.             $products_options_sort_order = zen_db_prepare_input($_POST['products_options_sort_order']);
  257.  
  258. // modified options sort order to use default if not otherwise set
  259.             if (zen_not_null($_POST['products_options_sort_order'])) {
  260.               $products_options_sort_order = zen_db_prepare_input($_POST['products_options_sort_order']);
  261.             } else {
  262.               $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] . "'");
  263.               $products_options_sort_order = $sort_order_query->fields['products_options_values_sort_order'];
  264.             } // end if (zen_not_null($_POST['products_options_sort_order'])
  265.  
  266. // end modification for sort order
  267.  
  268.             $product_attribute_is_free = zen_db_prepare_input($_POST['product_attribute_is_free']);
  269.             $products_attributes_weight = zen_db_prepare_input($_POST['products_attributes_weight']);
  270.             $products_attributes_weight_prefix = zen_db_prepare_input($_POST['products_attributes_weight_prefix']);
  271.             $attributes_display_only = zen_db_prepare_input($_POST['attributes_display_only']);
  272.             $attributes_default = zen_db_prepare_input($_POST['attributes_default']);
  273.             $attributes_discounted = zen_db_prepare_input($_POST['attributes_discounted']);
  274.             $attributes_price_base_included = zen_db_prepare_input($_POST['attributes_price_base_included']);
  275.  
  276.             $attributes_price_onetime = zen_db_prepare_input($_POST['attributes_price_onetime']);
  277.             $attributes_price_factor = zen_db_prepare_input($_POST['attributes_price_factor']);
  278.             $attributes_price_factor_offset = zen_db_prepare_input($_POST['attributes_price_factor_offset']);
  279.             $attributes_price_factor_onetime = zen_db_prepare_input($_POST['attributes_price_factor_onetime']);
  280.             $attributes_price_factor_onetime_offset = zen_db_prepare_input($_POST['attributes_price_factor_onetime_offset']);
  281.             $attributes_qty_prices = zen_db_prepare_input($_POST['attributes_qty_prices']);
  282.             $attributes_qty_prices_onetime = zen_db_prepare_input($_POST['attributes_qty_prices_onetime']);
  283.  
  284.             $attributes_price_words = zen_db_prepare_input($_POST['attributes_price_words']);
  285.             $attributes_price_words_free = zen_db_prepare_input($_POST['attributes_price_words_free']);
  286.             $attributes_price_letters = zen_db_prepare_input($_POST['attributes_price_letters']);
  287.             $attributes_price_letters_free = zen_db_prepare_input($_POST['attributes_price_letters_free']);
  288.             $attributes_required = zen_db_prepare_input($_POST['attributes_required']);
  289.  
  290. // add - update as record exists
  291. // attributes images
  292. // when set to none remove from database
  293. // only processes image once for multiple selection of options_values_id
  294.             if ($i == 0) {
  295.               if (isset($_POST['attributes_image']) && zen_not_null($_POST['attributes_image']) && ($_POST['attributes_image'] != 'none')) {
  296.                 $attributes_image = zen_db_prepare_input($_POST['attributes_image']);
  297.               } else {
  298.                 $attributes_image = '';
  299.               }
  300.  
  301.               $attributes_image = new upload('attributes_image');
  302.               $attributes_image->set_destination(DIR_FS_CATALOG_IMAGES . $_POST['img_dir']);
  303.               if ($attributes_image->parse() && $attributes_image->save($_POST['overwrite'])) {
  304.                 $attributes_image_name = $_POST['img_dir'] . $attributes_image->filename;
  305.               } else {
  306.                 $attributes_image_name = (isset($_POST['attributes_previous_image']) ? $_POST['attributes_previous_image'] : '');
  307.               }
  308.               $current_image_name = $attributes_image_name;
  309.             } else {
  310.               $attributes_image_name = $current_image_name;
  311.             }
  312.  
  313.             $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)
  314.                          values (0,
  315.                                  '" . (int)$products_id . "',
  316.                                  '" . (int)$options_id . "',
  317.                                  '" . (int)$values_id . "',
  318.                                  '" . (float)zen_db_input($value_price) . "',
  319.                                  '" . zen_db_input($price_prefix) . "',
  320.                                  '" . (int)zen_db_input($products_options_sort_order) . "',
  321.                                  '" . (int)zen_db_input($product_attribute_is_free) . "',
  322.                                  '" . (float)zen_db_input($products_attributes_weight) . "',
  323.                                  '" . zen_db_input($products_attributes_weight_prefix) . "',
  324.                                  '" . (int)zen_db_input($attributes_display_only) . "',
  325.                                  '" . (int)zen_db_input($attributes_default) . "',
  326.                                  '" . (int)zen_db_input($attributes_discounted) . "',
  327.                                  '" . zen_db_input($attributes_image_name) . "',
  328.                                  '" . (int)zen_db_input($attributes_price_base_included) . "',
  329.                                  '" . (float)zen_db_input($attributes_price_onetime) . "',
  330.                                  '" . (float)zen_db_input($attributes_price_factor) . "',
  331.                                  '" . (float)zen_db_input($attributes_price_factor_offset) . "',
  332.                                  '" . (float)zen_db_input($attributes_price_factor_onetime) . "',
  333.                                  '" . (float)zen_db_input($attributes_price_factor_onetime_offset) . "',
  334.                                  '" . zen_db_input($attributes_qty_prices) . "',
  335.                                  '" . zen_db_input($attributes_qty_prices_onetime) . "',
  336.                                  '" . (float)zen_db_input($attributes_price_words) . "',
  337.                                  '" . (int)zen_db_input($attributes_price_words_free) . "',
  338.                                  '" . (float)zen_db_input($attributes_price_letters) . "',
  339.                                  '" . (int)zen_db_input($attributes_price_letters_free) . "',
  340.                                  '" . (int)zen_db_input($attributes_required) . "')");
  341.  
  342.             if (DOWNLOAD_ENABLED == 'true') {
  343.               $products_attributes_id = $db->Insert_ID();
  344.  
  345.               $products_attributes_filename = zen_db_prepare_input($_POST['products_attributes_filename']);
  346.               $products_attributes_maxdays = (int)zen_db_prepare_input($_POST['products_attributes_maxdays']);
  347.               $products_attributes_maxcount = (int)zen_db_prepare_input($_POST['products_attributes_maxcount']);
  348.  
  349. //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)) );
  350.               if (zen_not_null($products_attributes_filename)) {
  351.                 $db->Execute("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . "
  352.                              (products_attributes_id, products_attributes_filename, products_attributes_maxdays, products_attributes_maxcount)
  353.                              values (" . (int)$products_attributes_id . ",
  354.                                      '" . zen_db_input($products_attributes_filename) . "',
  355.                                      '" . zen_db_input($products_attributes_maxdays) . "',
  356.                                      '" . zen_db_input($products_attributes_maxcount) . "')");
  357.               }
  358.             }
  359.           }
  360.         }
  361.  
  362.         // reset products_price_sorter for searches etc.
  363.         zen_update_products_price_sorter($_POST['products_id']);
  364.  
  365.         zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, $_SESSION['page_info'] . '&products_filter=' . $_POST['products_id'] . '&current_category_id=' . $_POST['current_category_id']));
  366.         break;
  367.       case 'update_product_attribute':
  368.         $check_duplicate = $db->Execute("select * from " . TABLE_PRODUCTS_ATTRIBUTES . "
  369.                                         where products_id ='" . (int)$_POST['products_id'] . "'
  370.                                         and options_id = '" . (int)$_POST['options_id'] . "'
  371.                                         and options_values_id = '" . (int)$_POST['values_id'] . "'
  372.                                         and products_attributes_id != '" . (int)$_POST['attribute_id'] . "'");
  373.  
  374.         if ($check_duplicate->RecordCount() > 0) {
  375.           // do not add duplicates give a warning
  376.           $messageStack->add_session(ATTRIBUTE_WARNING_DUPLICATE_UPDATE . ' - ' . zen_options_name($_POST['options_id']) . ' : ' . zen_values_name($_POST['values_id']), 'error');
  377.         } else {
  378.           // Validate options_id and options_value_id
  379.           if (!zen_validate_options_to_options_value($_POST['options_id'], $_POST['values_id'])) {
  380.             // do not add invalid match
  381.             $messageStack->add_session(ATTRIBUTE_WARNING_INVALID_MATCH_UPDATE . ' - ' . zen_options_name($_POST['options_id']) . ' : ' . zen_values_name($_POST['values_id']), 'error');
  382.           } else {
  383.             // add the new attribute
  384. // iii 030811 added:  Enforce rule that TEXT and FILE Options use value PRODUCTS_OPTIONS_VALUES_TEXT_ID
  385.         $products_options_query = $db->Execute("select products_options_type from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$_POST['options_id'] . "'");
  386.         switch ($products_options_array->fields['products_options_type']) {
  387.           case PRODUCTS_OPTIONS_TYPE_TEXT:
  388.           case PRODUCTS_OPTIONS_TYPE_FILE:
  389.             $values_id = PRODUCTS_OPTIONS_VALUES_TEXT_ID;
  390.             break;
  391.           default:
  392.           $values_id = zen_db_prepare_input($_POST['values_id']);
  393.         }
  394. // iii 030811 added END
  395.  
  396.             $products_id = zen_db_prepare_input($_POST['products_id']);
  397.             $options_id = zen_db_prepare_input($_POST['options_id']);
  398. //            $values_id = zen_db_prepare_input($_POST['values_id']);
  399.             $value_price = zen_db_prepare_input($_POST['value_price']);
  400.             $price_prefix = zen_db_prepare_input($_POST['price_prefix']);
  401.  
  402.             $products_options_sort_order = zen_db_prepare_input($_POST['products_options_sort_order']);
  403.             $product_attribute_is_free = zen_db_prepare_input($_POST['product_attribute_is_free']);
  404.             $products_attributes_weight = zen_db_prepare_input($_POST['products_attributes_weight']);
  405.             $products_attributes_weight_prefix = zen_db_prepare_input($_POST['products_attributes_weight_prefix']);
  406.             $attributes_display_only = zen_db_prepare_input($_POST['attributes_display_only']);
  407.             $attributes_default = zen_db_prepare_input($_POST['attributes_default']);
  408.             $attributes_discounted = zen_db_prepare_input($_POST['attributes_discounted']);
  409.             $attributes_price_base_included = zen_db_prepare_input($_POST['attributes_price_base_included']);
  410.  
  411.             $attributes_price_onetime = zen_db_prepare_input($_POST['attributes_price_onetime']);
  412.             $attributes_price_factor = zen_db_prepare_input($_POST['attributes_price_factor']);
  413.             $attributes_price_factor_offset = zen_db_prepare_input($_POST['attributes_price_factor_offset']);
  414.             $attributes_price_factor_onetime = zen_db_prepare_input($_POST['attributes_price_factor_onetime']);
  415.             $attributes_price_factor_onetime_offset = zen_db_prepare_input($_POST['attributes_price_factor_onetime_offset']);
  416.             $attributes_qty_prices = zen_db_prepare_input($_POST['attributes_qty_prices']);
  417.             $attributes_qty_prices_onetime = zen_db_prepare_input($_POST['attributes_qty_prices_onetime']);
  418.  
  419.             $attributes_price_words = zen_db_prepare_input($_POST['attributes_price_words']);
  420.             $attributes_price_words_free = zen_db_prepare_input($_POST['attributes_price_words_free']);
  421.             $attributes_price_letters = zen_db_prepare_input($_POST['attributes_price_letters']);
  422.             $attributes_price_letters_free = zen_db_prepare_input($_POST['attributes_price_letters_free']);
  423.             $attributes_required = zen_db_prepare_input($_POST['attributes_required']);
  424.  
  425.             $attribute_id = zen_db_prepare_input($_POST['attribute_id']);
  426.  
  427. // edit
  428. // attributes images
  429. // when set to none remove from database
  430.           if (isset($_POST['attributes_image']) && zen_not_null($_POST['attributes_image']) && ($_POST['attributes_image'] != 'none')) {
  431.             $attributes_image = zen_db_prepare_input($_POST['attributes_image']);
  432.             $attributes_image_none = false;
  433.           } else {
  434.             $attributes_image = '';
  435.             $attributes_image_none = true;
  436.           }
  437.  
  438.           $attributes_image = new upload('attributes_image');
  439.           $attributes_image->set_destination(DIR_FS_CATALOG_IMAGES . $_POST['img_dir']);
  440.           if ($attributes_image->parse() && $attributes_image->save($_POST['overwrite'])) {
  441.             $attributes_image_name = ($attributes_image->filename != 'none' ? ($_POST['img_dir'] . $attributes_image->filename) : '');
  442.           } else {
  443.             $attributes_image_name = ((isset($_POST['attributes_previous_image']) and $_POST['attributes_image'] != 'none') ? $_POST['attributes_previous_image'] : '');
  444.           }
  445.  
  446. if ($_POST['image_delete'] == 1) {
  447.   $attributes_image_name = '';
  448. }
  449. // turned off until working
  450.           $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . "
  451.                        set attributes_image = '" .  zen_db_input($attributes_image_name) . "'
  452.                        where products_attributes_id = '" . (int)$attribute_id . "'");
  453.  
  454.             $db->Execute("update " . TABLE_PRODUCTS_ATTRIBUTES . "
  455.                          set products_id = '" . (int)$products_id . "',
  456.                              options_id = '" . (int)$options_id . "',
  457.                              options_values_id = '" . (int)$values_id . "',
  458.                              options_values_price = '" . zen_db_input($value_price) . "',
  459.                              price_prefix = '" . zen_db_input($price_prefix) . "',
  460.                              products_options_sort_order = '" . zen_db_input($products_options_sort_order) . "',
  461.                              product_attribute_is_free = '" . zen_db_input($product_attribute_is_free) . "',
  462.                              products_attributes_weight = '" . zen_db_input($products_attributes_weight) . "',
  463.                              products_attributes_weight_prefix = '" . zen_db_input($products_attributes_weight_prefix) . "',
  464.                              attributes_display_only = '" . zen_db_input($attributes_display_only) . "',
  465.                              attributes_default = '" . zen_db_input($attributes_default) . "',
  466.                              attributes_discounted = '" . zen_db_input($attributes_discounted) . "',
  467.                              attributes_price_base_included = '" . zen_db_input($attributes_price_base_included) . "',
  468.                              attributes_price_onetime = '" . zen_db_input($attributes_price_onetime) . "',
  469.                              attributes_price_factor = '" . zen_db_input($attributes_price_factor) . "',
  470.                              attributes_price_factor_offset = '" . zen_db_input($attributes_price_factor_offset) . "',
  471.                              attributes_price_factor_onetime = '" . zen_db_input($attributes_price_factor_onetime) . "',
  472.                              attributes_price_factor_onetime_offset = '" . zen_db_input($attributes_price_factor_onetime_offset) . "',
  473.                              attributes_qty_prices = '" . zen_db_input($attributes_qty_prices) . "',
  474.                              attributes_qty_prices_onetime = '" . zen_db_input($attributes_qty_prices_onetime) . "',
  475.                              attributes_price_words = '" . zen_db_input($attributes_price_words) . "',
  476.                              attributes_price_words_free = '" . zen_db_input($attributes_price_words_free) . "',
  477.                              attributes_price_letters = '" . zen_db_input($attributes_price_letters) . "',
  478.                              attributes_price_letters_free = '" . zen_db_input($attributes_price_letters_free) . "',
  479.                              attributes_required = '" . zen_db_input($attributes_required) . "'
  480.                          where products_attributes_id = '" . (int)$attribute_id . "'");
  481.  
  482.             if (DOWNLOAD_ENABLED == 'true') {
  483.               $products_attributes_filename = zen_db_prepare_input($_POST['products_attributes_filename']);
  484.               $products_attributes_maxdays = zen_db_prepare_input($_POST['products_attributes_maxdays']);
  485.               $products_attributes_maxcount = zen_db_prepare_input($_POST['products_attributes_maxcount']);
  486.  
  487.               if (zen_not_null($products_attributes_filename)) {
  488.                 $db->Execute("replace into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . "
  489.                              set products_attributes_id = '" . (int)$attribute_id . "',
  490.                                  products_attributes_filename = '" . zen_db_input($products_attributes_filename) . "',
  491.                                  products_attributes_maxdays = '" . zen_db_input($products_attributes_maxdays) . "',
  492.                                  products_attributes_maxcount = '" . zen_db_input($products_attributes_maxcount) . "'");
  493.               }
  494.             }
  495.           }
  496.         }
  497.  
  498.         // reset products_price_sorter for searches etc.
  499.         zen_update_products_price_sorter($_POST['products_id']);
  500.  
  501.         zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, $_SESSION['page_info'] . '&current_category_id=' . $_POST['current_category_id']));
  502.         break;
  503.       case 'delete_attribute':
  504.         // demo active test
  505.         if (zen_admin_demo()) {
  506.           $_GET['action']= '';
  507.           $messageStack->add_session(ERROR_ADMIN_DEMO, 'caution');
  508.           zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, $_SESSION['page_info'] . '&current_category_id=' . $_POST['current_category_id']));
  509.         }
  510.         if (isset($_POST['delete_attribute_id']))
  511.         {
  512.           $attribute_id = zen_db_prepare_input($_POST['delete_attribute_id']);
  513.  
  514.           $db->Execute("delete from " . TABLE_PRODUCTS_ATTRIBUTES . "
  515.                      where products_attributes_id = '" . (int)$attribute_id . "'");
  516.  
  517. // added for DOWNLOAD_ENABLED. Always try to remove attributes, even if downloads are no longer enabled
  518.           $db->Execute("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . "
  519.                      where products_attributes_id = '" . (int)$attribute_id . "'");
  520.  
  521.         // reset products_price_sorter for searches etc.
  522.           zen_update_products_price_sorter($products_filter);
  523.  
  524.           zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, $_SESSION['page_info'] . '&current_category_id=' . $_POST['current_category_id']));
  525.         }
  526.         break;
  527. // delete all attributes
  528.       case 'delete_all_attributes':
  529.         zen_delete_products_attributes($_POST['products_filter']);
  530.         $messageStack->add_session(SUCCESS_ATTRIBUTES_DELETED . ' ID#' . $products_filter, 'success');
  531.         $action='';
  532.         $products_filter = (int)$_POST['products_filter'];
  533.  
  534.         // reset products_price_sorter for searches etc.
  535.         zen_update_products_price_sorter($products_filter);
  536.  
  537.         zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $_POST['current_category_id']));
  538.         break;
  539.  
  540.       case 'delete_option_name_values':
  541.         $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'] . "'");
  542.         while (!$delete_attributes_options_id->EOF) {
  543. // remove any attached downloads
  544.           $remove_downloads = $db->Execute("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " where products_attributes_id= '" . $delete_attributes_options_id->fields['products_attributes_id'] . "'");
  545. // remove all option values
  546.           $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'] . "'");
  547.           $delete_attributes_options_id->MoveNext();
  548.         }
  549.  
  550.         $action='';
  551.         $products_filter = $_POST['products_filter'];
  552.         $messageStack->add_session(SUCCESS_ATTRIBUTES_DELETED_OPTION_NAME_VALUES. ' ID#' . zen_options_name($_POST['products_options_id_all']), 'success');
  553.  
  554.         // reset products_price_sorter for searches etc.
  555.         zen_update_products_price_sorter($products_filter);
  556.  
  557.         zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $_POST['current_category_id']));
  558.         break;
  559.  
  560.  
  561. // attributes copy to product
  562.     case 'update_attributes_copy_to_product':
  563.       $copy_attributes_delete_first = ($_POST['copy_attributes'] == 'copy_attributes_delete' ? '1' : '0');
  564.       $copy_attributes_duplicates_skipped = ($_POST['copy_attributes'] == 'copy_attributes_ignore' ? '1' : '0');
  565.       $copy_attributes_duplicates_overwrite = ($_POST['copy_attributes'] == 'copy_attributes_update' ? '1' : '0');
  566.       zen_copy_products_attributes($_POST['products_filter'], $_POST['products_update_id']);
  567.       $_GET['action']= '';
  568.       $products_filter = $_POST['products_update_id'];
  569.       zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $_POST['current_category_id']));
  570.       break;
  571.  
  572. // attributes copy to category
  573.     case 'update_attributes_copy_to_category':
  574.       $copy_attributes_delete_first = ($_POST['copy_attributes'] == 'copy_attributes_delete' ? '1' : '0');
  575.       $copy_attributes_duplicates_skipped = ($_POST['copy_attributes'] == 'copy_attributes_ignore' ? '1' : '0');
  576.       $copy_attributes_duplicates_overwrite = ($_POST['copy_attributes'] == 'copy_attributes_update' ? '1' : '0');
  577.       if ($_POST['categories_update_id'] == '') {
  578.         $messageStack->add_session(WARNING_PRODUCT_COPY_TO_CATEGORY_NONE . ' ID#' . $_POST['products_filter'], 'warning');
  579.       } else {
  580.         $copy_to_category = $db->Execute("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id='" . $_POST['categories_update_id'] . "'");
  581.         while (!$copy_to_category->EOF) {
  582.           zen_copy_products_attributes($_POST['products_filter'], $copy_to_category->fields['products_id']);
  583.           $copy_to_category->MoveNext();
  584.         }
  585.       }
  586.       $_GET['action']= '';
  587.       $products_filter = $_POST['products_filter'];
  588.       zen_redirect(zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $_POST['current_category_id']));
  589.       break;
  590.  
  591.     }
  592.   }
  593.  
  594. //iii 031103 added to get results from database option type query
  595.   $products_options_types_list = array();
  596. //  $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");
  597.   $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");
  598.   while (!$products_options_type_array->EOF) {
  599.     $products_options_types_list[$products_options_type_array->fields['products_options_types_id']] = $products_options_type_array->fields['products_options_types_name'];
  600.     $products_options_type_array->MoveNext();
  601.   }
  602.  
  603. //CLR 030312 add function to draw pulldown list of option types
  604. // Draw a pulldown for Option Types
  605. //iii 031103 modified to use results of database option type query from above
  606. function draw_optiontype_pulldown($name, $default = '') {
  607.   global $products_options_types_list;
  608.   $values = array();
  609.   foreach ($products_options_types_list as $id => $text) {
  610.     $values[] = array('id' => $id, 'text' => $text);
  611.   }
  612.   return zen_draw_pull_down_menu($name, $values, $default);
  613. }
  614.  
  615. //CLR 030312 add function to translate type_id to name
  616. // Translate option_type_values to english string
  617. //iii 031103 modified to use results of database option type query from above
  618. function translate_type_to_name($opt_type) {
  619.   global $products_options_types_list;
  620.   return $products_options_types_list[$opt_type];
  621. }
  622.  
  623.   function zen_js_option_values_list($selectedName, $fieldName) {
  624.     global $db, $show_value_numbers;
  625.     $attributes_sql = "SELECT povpo.products_options_id, povpo.products_options_values_id, po.products_options_name, po.products_options_sort_order,
  626.                       pov.products_options_values_name, pov.products_options_values_sort_order
  627.                       FROM " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " povpo, " . TABLE_PRODUCTS_OPTIONS . " po, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov
  628.                       WHERE povpo.products_options_id = po.products_options_id
  629.                       AND povpo.products_options_values_id = pov.products_options_values_id
  630.                       AND pov.language_id = po.language_id
  631.                       AND po.language_id = " . (int)$_SESSION['languages_id'] . "
  632.                       ORDER BY po.products_options_id, po.products_options_name, pov.products_options_values_name";
  633.  
  634. //           "
  635. //           ORDER BY po.products_options_name, pov.products_options_values_sort_order";
  636.  
  637.     $attributes = $db->Execute($attributes_sql);
  638.  
  639.     $counter = 1;
  640.     $val_count = 0;
  641.     $value_string = '  // Build conditional Option Values Lists' . "\n";
  642.     $last_option_processed = null;
  643.     while (!$attributes->EOF) {
  644.       $products_options_values_name = str_replace('-', '\-', $attributes->fields['products_options_values_name']);
  645.       $products_options_values_name = str_replace('(', '\(', $products_options_values_name);
  646.       $products_options_values_name = str_replace(')', '\)', $products_options_values_name);
  647.       $products_options_values_name = str_replace('"', '\"', $products_options_values_name);
  648.       $products_options_values_name = str_replace('&quot;', '\"', $products_options_values_name);
  649.       $products_options_values_name = str_replace('&frac12;', '1/2', $products_options_values_name);
  650.  
  651.       if ($counter == 1) {
  652.         $value_string .= '  if (' . $selectedName . ' == "' . $attributes->fields['products_options_id'] . '") {' . "\n";
  653.       } elseif ($last_option_processed != $attributes->fields['products_options_id']) {
  654.         $value_string .= '  } else if (' . $selectedName . ' == "' . $attributes->fields['products_options_id'] . '") {' . "\n";
  655.         $val_count = 0;
  656.       }
  657.  
  658.       $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";
  659.  
  660.       $last_option_processed = $attributes->fields['products_options_id'];
  661.       $val_count++;
  662.       $counter++;
  663.       $attributes->MoveNext();
  664.     }
  665.     if ($counter > 1) {
  666.       $value_string .= '  }' . "\n";
  667.     }
  668.     return $value_string;
  669.   }
  670.  
  671. ?>
  672. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  673. <html <?php echo HTML_PARAMS; ?>>
  674. <head>
  675. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  676. <title><?php echo TITLE; ?></title>
  677. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  678. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  679. <script language="javascript" src="includes/menu.js"></script>
  680. <script language="javascript" src="includes/general.js"></script>
  681. <script language="javascript"><!--
  682. function go_option() {
  683.   if (document.option_order_by.selected.options[document.option_order_by.selected.selectedIndex].value != "none") {
  684.     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;
  685.   }
  686. }
  687. function popupWindow(url) {
  688.   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')
  689. }
  690. //--></script>
  691. <script type="text/javascript">
  692.   <!--
  693.   function init()
  694.   {
  695.     cssjsmenu('navbar');
  696.     if (document.getElementById)
  697.     {
  698.       var kill = document.getElementById('hoverJS');
  699.       kill.disabled = true;
  700.     }
  701.   }
  702.   // -->
  703. </script>
  704. </head>
  705. <!-- <body onload="init()"> -->
  706. <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="init()">
  707. <!-- header //-->
  708. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  709. <!-- header_eof //-->
  710.  
  711. <!-- body //-->
  712. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  713.   <tr>
  714. <!-- body_text //-->
  715.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  716.               <tr>
  717.                 <td class="smallText" align="right">
  718. <?php
  719.     echo zen_draw_form('search', FILENAME_CATEGORIES, '', 'get');
  720. // show reset search
  721.     if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
  722.       echo '<a href="' . zen_href_link(FILENAME_CATEGORIES) . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a>&nbsp;&nbsp;';
  723.     }
  724.     echo HEADING_TITLE_SEARCH_DETAIL . ' ' . zen_draw_input_field('search') . zen_hide_session_id();
  725.     if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
  726.       $keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
  727.       echo '<br/ >' . TEXT_INFO_SEARCH_DETAIL_FILTER . $keywords;
  728.     }
  729.     echo '</form>';
  730. ?>
  731.                 </td>
  732.               </tr>
  733.  
  734.       <tr>
  735.         <td width="100%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  736. <!-- products_attributes //-->
  737.       <tr>
  738.         <td width="100%"><table border="0" cellspacing="2" cellpadding="2">
  739.           <tr>
  740.             <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>
  741.             <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>
  742.           </tr>
  743.         </table></td>
  744.       </tr>
  745.       <tr>
  746.         <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  747.           <tr>
  748.             <td class="pageHeading">&nbsp;<?php echo HEADING_TITLE_ATRIB; ?>&nbsp;</td>
  749.           </tr>
  750.         </table></td>
  751.       </tr>
  752.  
  753. <?php
  754. if ($action == 'attributes_preview') {
  755.   // don't show anything from here down
  756. ?>
  757.  
  758. <tr><td><table align="center"><tr>
  759.             <td class="pageHeading" align="center"><?php echo TEXT_ATTRIBUTES_PREVIEW_DISPLAY . $products_filter . '<br />' . zen_get_products_name($products_filter); ?></td>
  760. </tr></table></td></tr>
  761.  
  762. <?php
  763. } else {
  764.   // show the attributes
  765. ?>
  766. <?php
  767.   if ($products_filter != '' and $action != 'attribute_features_copy_to_product' and $action != 'attribute_features_copy_to_category' and $action != 'delete_all_attributes_confirm') {
  768. ?>
  769.       <tr>
  770.         <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  771.       </tr>
  772.  
  773.       <tr>
  774.         <td colspan="2"><table border="1" cellspacing="2" cellpadding="4" align="left">
  775.           <tr>
  776.             <td colspan="7" class="main" align="center">
  777.               <?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); ?>
  778.             </td>
  779.           </tr>
  780.           <tr>
  781.             <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>
  782.             <td class="smallText" align="center">
  783.               <?php
  784.                 if ($zc_products->get_allow_add_to_cart($products_filter) == "Y") {
  785.                   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>';
  786.                 } else {
  787.                   echo TEXT_INFO_ALLOW_ADD_TO_CART_NO;
  788.                 }
  789.               ?>
  790.             </td>
  791. <?php
  792.   if (zen_has_product_attributes($products_filter, 'false')) {
  793. ?>
  794.             <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>
  795.             <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>
  796.             <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>
  797.             <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>
  798.             <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>
  799. <?php
  800. } else {
  801. ?>
  802.             <td class="main" align="center" width="200"><?php echo TEXT_NO_ATTRIBUTES_DEFINED . $products_filter; ?></td>
  803. <?php
  804. }
  805. ?>
  806.           </tr>
  807.           <tr>
  808.             <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>
  809.           </tr>
  810.         </table></td>
  811.       </form></tr>
  812.       <tr>
  813.         <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  814.       </tr>
  815. <?php
  816. }
  817. ?>
  818. <?php
  819. } // eof: attributes_preview
  820. ?>
  821.  
  822. <?php
  823. // remove all attributes from the product
  824.   if ($action == 'delete_all_attributes_confirm') {
  825. ?>
  826.       <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']); ?>
  827.         <td colspan="2"><table border="2" cellspacing="2" cellpadding="4">
  828.           <tr>
  829.             <td><table border="0" cellspacing="2" cellpadding="2">
  830.               <tr>
  831.                 <td class="alert" align="center"><?php echo TEXT_DELETE_ALL_ATTRIBUTES . $products_filter . '<br />' . zen_get_products_name($products_filter); ?></td>
  832.                 <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>
  833.               </tr>
  834.             </table></td>
  835.           </table></td>
  836.         </tr>
  837.       </form></tr>
  838. <?php
  839. }
  840. ?>
  841.  
  842. <?php
  843. // remove option name and all values from the product
  844.   if ($action == 'delete_option_name_values_confirm') {
  845. ?>
  846.       <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']); ?>
  847.         <?php echo zen_draw_hidden_field('products_filter', $_GET['products_filter']); ?>
  848.         <?php echo zen_draw_hidden_field('current_category_id', $_GET['current_category_id']); ?>
  849.         <?php echo zen_draw_hidden_field('products_options_id_all', $_GET['products_options_id_all']); ?>
  850.         <td colspan="2"><table border="2" cellspacing="2" cellpadding="4">
  851.           <tr>
  852.             <td><table border="0" cellspacing="2" cellpadding="2">
  853.               <tr class="pageHeading">
  854.                 <td class="alert" align="center" colspan="2"><?php echo TEXT_DELETE_ATTRIBUTES_OPTION_NAME_VALUES; ?></td>
  855.               </tr>
  856.               <tr>
  857.                 <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>
  858.                 <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>
  859.               </tr>
  860.             </table></td>
  861.           </table></td>
  862.         </tr>
  863.       </form></tr>
  864. <?php
  865. }
  866. ?>
  867.  
  868. <?php
  869.   if ($action == 'attribute_features_copy_to_product') {
  870.     $_GET['products_update_id'] = '';
  871.     // excluded current product from the pull down menu of products
  872.     $products_exclude_array = array();
  873.     $products_exclude_array[] = $products_filter;
  874. ?>
  875.       <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']); ?>
  876.         <td colspan="2"><table border="2" cellspacing="0" cellpadding="2">
  877.           <tr>
  878.             <td><table border="0" cellspacing="2" cellpadding="4">
  879.               <tr>
  880.                 <td class="main" align="center"><?php echo TEXT_INFO_ATTRIBUTES_FEATURES_COPY_TO_PRODUCT . $products_filter . '<br />' . zen_get_products_name($products_filter); ?></td>
  881.                 <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>
  882.               </tr>
  883.               <tr>
  884.                 <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>
  885.                 <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>
  886.               </tr>
  887.             </table></td>
  888.           </table></td>
  889.         </tr>
  890.       </form></tr>
  891. <?php
  892. }
  893. ?>
  894.  
  895. <?php
  896.   if ($action == 'attribute_features_copy_to_category') {
  897. ?>
  898.       <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']); ?>
  899.         <td colspan="2"><table border="2" cellspacing="0" cellpadding="2">
  900.           <tr>
  901.             <td><table border="0" cellspacing="2" cellpadding="4">
  902.               <tr>
  903.                 <td class="main" align="center"><?php echo TEXT_INFO_ATTRIBUTES_FEATURES_COPY_TO_CATEGORY . $products_filter . '<br />' . zen_get_products_name($products_filter); ?></td>
  904.                 <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>
  905.               </tr>
  906.               <tr>
  907.                 <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>
  908.                 <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>
  909.               </tr>
  910.             </table></td>
  911.           </table></td>
  912.         </tr>
  913.       </form></tr>
  914.  
  915. <?php
  916. }
  917. ?>
  918.  
  919. <?php
  920. // fix here
  921. // preview shot of attributes
  922. if ($action == 'attributes_preview') {
  923.   $_GET['products_id'] = $products_filter;
  924.   $pInfo = new stdClass();
  925.   $pInfo->products_id = $products_filter;
  926.  
  927.   include(DIR_WS_INCLUDES . 'attributes_preview.php');
  928. ?>
  929.       <tr>
  930.         <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>
  931.       </tr>
  932.       <tr>
  933.         <td colspan="2"><table border="1" cellspacing="0" cellpadding="2" align="center" class="main_page">
  934.           <tr>
  935.             <td class="main">
  936. <?php
  937. //            where    patrib.products_id='" . $pInfo->products_id . "'
  938. //            where    patrib.products_id='" . (int)$_GET['products_id'] . "'
  939.   $check_template = $db->Execute("select template_dir from " . TABLE_TEMPLATE_SELECT);
  940.   echo '<link rel="stylesheet" type="text/css" href="' . str_replace('index.php?main_page=NONE', 'includes/templates/' . $check_template->fields['template_dir'] . '/css/stylesheet.css', zen_catalog_href_link('NONE', '', 'SSL')) . '" />';
  941. ?>
  942.  
  943.   <tr>
  944.     <td colspan="2" class="main" align="center">
  945. <?php
  946.   if ($pr_attr->fields['total'] > 0) {
  947. ?>
  948.       <table border="0" width="90%" cellspacing="0" cellpadding="2">
  949.         <tr>
  950.           <td colspan="2" class="main" align="left"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
  951.         </tr>
  952. <?php
  953.     for($i=0;$i<sizeof($options_name);$i++) {
  954. ?>
  955. <?php
  956.   if ($options_comment[$i] != '' and $options_comment_position[$i] == '0') {
  957. ?>
  958.         <tr>
  959.           <td colspan="2" class="ProductInfoComments" align="left" valign="bottom"><?php echo $options_comment[$i]; ?></td>
  960.         </tr>
  961. <?php
  962.   }
  963. ?>
  964.         <tr>
  965.           <td class="main" align="left" valign="top"><?php echo $options_name[$i] . ':'; ?></td>
  966.           <td class="main" align="left" valign="top" width="75%"><?php echo $options_menu[$i]; ?></td>
  967.         </tr>
  968. <?php if ($options_comment[$i] != '' and $options_comment_position[$i] == '1') { ?>
  969.         <tr>
  970.           <td colspan="2" class="ProductInfoComments" align="left" valign="top"><?php echo $options_comment[$i]; ?></td>
  971.         </tr>
  972. <?php } ?>
  973.  
  974. <?php
  975. if ($options_attributes_image[$i] != '') {
  976. ?>
  977.         <tr><td colspan="2"><table border= "0" align="center" valign="top" cellpadding="2" cellspacing="2"><tr>
  978.           <?php echo $options_attributes_image[$i]; ?>
  979.         </tr></table></td></tr>
  980. <?php
  981. }
  982. ?>
  983. <?php
  984.     }
  985. ?>
  986.       </table>
  987. <?php
  988.   }
  989. ?>
  990.     </td>
  991.   </tr>
  992.             </td>
  993.           </tr>
  994.         </table></td>
  995.       </tr>
  996.  
  997.       <tr>
  998.         <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>
  999.       </tr>
  1000. <?php
  1001. } // eof: attributes preview
  1002. ?>
  1003.  
  1004.       <tr>
  1005.         <td colspan="3" class="main" height="20" align="center"><?php echo zen_draw_separator('pixel_black.gif', '90%', '2'); ?></td>
  1006.       </tr>
  1007.  
  1008. <?php
  1009. if ($action == 'attributes_preview') {
  1010.   // don't show anything from here down
  1011. } else {
  1012.   // show the attributes
  1013. ?>
  1014. <?php
  1015.   if ($action == '') {
  1016. ?>
  1017.       <tr>
  1018.         <td colspan="2"><table>
  1019.           <?php require(DIR_WS_MODULES . FILENAME_PREV_NEXT_DISPLAY); ?>
  1020.         </table></td>
  1021.       </tr>
  1022.  
  1023.       <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']); ?>
  1024.         <td colspan="2"><table border="0" cellspacing="0" cellpadding="2">
  1025.  
  1026. <?php
  1027.     if ($_GET['products_filter'] != '') {
  1028. ?>
  1029.           <tr>
  1030.             <td class="main" width="200" align="left" valign="top">&nbsp;</td>
  1031.             <td colspan="2" class="main"><?php echo TEXT_PRODUCT_TO_VIEW; ?></td>
  1032.           </tr>
  1033.           <tr>
  1034.             <td class="main" width="200" align="center" valign="top">
  1035. <?php
  1036.   $display_priced_by_attributes = zen_get_products_price_is_priced_by_attributes($_GET['products_filter']);
  1037.   echo ($display_priced_by_attributes ? '<span class="alert">' . TEXT_PRICED_BY_ATTRIBUTES . '</span>' . '<br />' : '');
  1038.   echo zen_get_products_display_price($_GET['products_filter']) . '<br /><br />';
  1039.   echo zen_get_products_quantity_min_units_display($_GET['products_filter'], $include_break = true);
  1040. ?>
  1041.             </td>
  1042.             <td class="attributes-even" align="center"><?php echo zen_draw_products_pull_down('products_filter', 'size="10"', '', true, $_GET['products_filter'], true, true); ?></td>
  1043.             <td class="main" align="right" valign="top"><?php echo zen_image_submit('button_display.gif', IMAGE_DISPLAY); ?></td>
  1044.           </tr>
  1045.         </table></td>
  1046.       </form></tr>
  1047.  
  1048. <?php
  1049.     } // product dropdown
  1050. ?>
  1051. <?php
  1052.   } // $action == ''
  1053. ?>
  1054. <?php
  1055. // start of attributes display
  1056. if ($_GET['products_filter'] == '') {
  1057. ?>
  1058.       <tr>
  1059.         <td colspan="2" class="pageHeading" align="center" valign="middle" height="200"><?php echo HEADING_TITLE_ATRIB_SELECT; ?></td>
  1060.       </tr>
  1061. <?php
  1062. } else {
  1063. ////
  1064. // attribute listings and add
  1065.  
  1066.   if ($action == 'update_attribute') {
  1067.     $form_action = 'update_product_attribute';
  1068.   } elseif ($action == 'delete_product_attribute') {
  1069.     $form_action = 'delete_attribute';
  1070.   } else {
  1071.     $form_action = 'add_product_attributes';
  1072.   }
  1073.  
  1074.   if (!isset($_GET['attribute_page'])) {
  1075.     $_GET['attribute_page'] = 1;
  1076.   }
  1077.   $prev_attribute_page = $_GET['attribute_page'] - 1;
  1078.   $next_attribute_page = $_GET['attribute_page'] + 1;
  1079. ?>
  1080.  
  1081. <?php
  1082. if ($action == '') {
  1083. ?>
  1084. <tr>
  1085.   <td>
  1086.     <table border="2" align="left" cellpadding="2" cellspacing="2">
  1087.       <tr>
  1088.         <td class="smallText" align="right"><?php echo LEGEND_BOX; ?></td>
  1089.         <td class="smallText" align="center"><?php echo LEGEND_ATTRIBUTES_DISPLAY_ONLY; ?></td>
  1090.         <td class="smallText" align="center"><?php echo LEGEND_ATTRIBUTES_IS_FREE; ?></td>
  1091.         <td class="smallText" align="center"><?php echo LEGEND_ATTRIBUTES_DEFAULT; ?></td>
  1092.         <td class="smallText" align="center"><?php echo LEGEND_ATTRIBUTE_IS_DISCOUNTED; ?></td>
  1093.         <td class="smallText" align="center"><?php echo LEGEND_ATTRIBUTE_PRICE_BASE_INCLUDED; ?></td>
  1094.         <td class="smallText" align="center"><?php echo LEGEND_ATTRIBUTES_REQUIRED; ?></td>
  1095.         <td class="smallText" align="center"><?php echo LEGEND_ATTRIBUTES_IMAGES ?></td>
  1096.         <td class="smallText" align="center"><?php echo LEGEND_ATTRIBUTES_DOWNLOAD ?></td>
  1097.       </tr>
  1098.       <tr>
  1099.         <td class="smallText" align="right"><?php echo LEGEND_KEYS; ?></td>
  1100.         <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>
  1101.         <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>
  1102.         <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>
  1103.         <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>
  1104.         <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>
  1105.         <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>
  1106.         <td class="smallText" align="center"><?php echo zen_image(DIR_WS_IMAGES . 'icon_status_yellow.gif'); ?></td>
  1107.         <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>
  1108.       </tr>
  1109.     </table>
  1110.   </td>
  1111. <?php } ?>
  1112. <?php
  1113. // fix here border width
  1114. ?>
  1115.       <tr>
  1116.         <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">
  1117.           <tr>
  1118.             <td colspan="10" class="smallText">
  1119. <?php
  1120.   $per_page = (defined('MAX_ROW_LISTS_ATTRIBUTES_CONTROLLER') && (int)MAX_ROW_LISTS_ATTRIBUTES_CONTROLLER > 3) ? (int)MAX_ROW_LISTS_ATTRIBUTES_CONTROLLER : 40;
  1121.   $attributes = "select pa.*
  1122.  from (" . TABLE_PRODUCTS_ATTRIBUTES . " pa
  1123.  left join " . TABLE_PRODUCTS_DESCRIPTION . " pd
  1124.  on pa.products_id = pd.products_id
  1125.  and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
  1126.  left join " . TABLE_PRODUCTS_OPTIONS . " po
  1127.  on pa.options_id = po.products_options_id
  1128.  and po.language_id = '" . (int)$_SESSION['languages_id'] . "'" . ")
  1129.  where pa.products_id ='" . $products_filter . "'
  1130.  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')";
  1131.   $attribute_query = $db->Execute($attributes);
  1132.  
  1133.   $attribute_page_start = ($per_page * $_GET['attribute_page']) - $per_page;
  1134.   $num_rows = $attribute_query->RecordCount();
  1135.  
  1136.   if ($num_rows <= $per_page) {
  1137.      $num_pages = 1;
  1138.   } else if (($num_rows % $per_page) == 0) {
  1139.      $num_pages = ($num_rows / $per_page);
  1140.   } else {
  1141.      $num_pages = ($num_rows / $per_page) + 1;
  1142.   }
  1143.   $num_pages = (int) $num_pages;
  1144.  
  1145. // fix limit error on some versions
  1146.     if ($attribute_page_start < 0) { $attribute_page_start = 0; }
  1147.  
  1148.   $attributes = $attributes . " LIMIT $attribute_page_start, $per_page";
  1149.  
  1150.   // Previous
  1151.   if ($prev_attribute_page) {
  1152.     echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'attribute_page=' . $prev_attribute_page . '&products_filter=' . $products_filter) . '"> &lt;&lt; </a> | ';
  1153.   }
  1154.  
  1155.   for ($i = 1; $i <= $num_pages; $i++) {
  1156.     if ($i != $_GET['attribute_page']) {
  1157.       echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'attribute_page=' . $i  . '&products_filter=' . $products_filter) . '">' . $i . '</a> | ';
  1158.     } else {
  1159.       echo '<b><font color="red">' . $i . '</font></b> | ';
  1160.     }
  1161.   }
  1162.  
  1163.   // Next
  1164.   if ($_GET['attribute_page'] != $num_pages) {
  1165.     echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'attribute_page=' . $next_attribute_page . '&products_filter=' . $products_filter) . '"> &gt;&gt; </a>';
  1166.   }
  1167. ?>
  1168.             </td>
  1169.           </tr>
  1170.           <tr>
  1171.             <td colspan="10"><?php echo zen_black_line(); ?></td>
  1172.           </tr>
  1173.           <tr class="dataTableHeadingRow">
  1174.             <td class="dataTableHeadingContent">&nbsp;<?php echo TABLE_HEADING_ID; ?>&nbsp;</td>
  1175.             <td class="dataTableHeadingContent">&nbsp;<?php // echo TABLE_HEADING_PRODUCT; ?>&nbsp;</td>
  1176.             <td class="dataTableHeadingContent">&nbsp;<?php echo TABLE_HEADING_OPT_NAME; ?>&nbsp;</td>
  1177.             <td class="dataTableHeadingContent">&nbsp;<?php echo TABLE_HEADING_OPT_VALUE; ?>&nbsp;</td>
  1178.             <td class="dataTableHeadingContent" align="right">&nbsp;<?php echo TABLE_HEADING_OPT_PRICE_PREFIX; ?>&nbsp;<?php echo TABLE_HEADING_OPT_PRICE; ?>&nbsp;</td>
  1179.             <td class="dataTableHeadingContent" align="right">&nbsp;<?php echo TABLE_HEADING_OPT_WEIGHT_PREFIX; ?>&nbsp;<?php echo TABLE_HEADING_OPT_WEIGHT; ?>&nbsp;</td>
  1180.             <td class="dataTableHeadingContent" align="right">&nbsp;<?php echo TABLE_HEADING_OPT_SORT_ORDER; ?>&nbsp;</td>
  1181.             <td class="dataTableHeadingContent" align="center"><?php echo LEGEND_BOX; ?></td>
  1182.             <td class="dataTableHeadingContent" align="right">&nbsp;<?php echo TABLE_HEADING_PRICE_TOTAL; ?>&nbsp;</td>
  1183.             <td class="dataTableHeadingContent" align="center">&nbsp;<?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  1184.           </tr>
  1185.           <tr>
  1186.             <td colspan="10"><?php echo zen_black_line(); ?></td>
  1187.           </tr>
  1188.  
  1189. <?php
  1190.   $next_id = 1;
  1191.   $attributes_values = $db->Execute($attributes);
  1192.  
  1193.   if ($attributes_values->RecordCount() == 0) {
  1194. ?>
  1195.           <tr class="attributeBoxContent">
  1196.             <td colspan="10" class="dataTableHeadingContent">&nbsp;</td>
  1197.           </tr>
  1198.           <tr class="attributes-even">
  1199.             <td colspan="10" class="pageHeading" align="center">
  1200.               <?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)); ?>
  1201.             </td>
  1202.           </tr>
  1203.           <tr class="dataTableHeadingRow">
  1204.             <td colspan="10" class="dataTableHeadingContent">&nbsp;</td>
  1205.           </tr>
  1206.  
  1207. <?php
  1208. } else {
  1209. ?>
  1210.           <tr class="attributeBoxContent">
  1211.             <td colspan="10" class="dataTableHeadingContent">&nbsp;</td>
  1212.           </tr>
  1213.           <tr class="attributes-even">
  1214.             <td colspan="10" class="pageHeading" align="center">
  1215.               <?php echo TEXT_INFO_ID . $products_filter . ' ' . zen_get_products_model($products_filter) . ' - ' . zen_get_products_name($products_filter); ?>
  1216.             </td>
  1217.           </tr>
  1218.           <tr class="attributeBoxContent">
  1219.             <td colspan="10" class="dataTableHeadingContent">&nbsp;</td>
  1220.           </tr>
  1221. <?php } ?>
  1222. <?php
  1223.   $current_options_name = '';
  1224.   // get products tax id
  1225.   $product_check = $db->Execute("select products_tax_class_id from " . TABLE_PRODUCTS . " where products_id = '" . $products_filter . "'" . " limit 1");
  1226. //  echo '$products_filter: ' . $products_filter . ' tax id: ' . $product_check->fields['products_tax_class_id'] . '<br>';
  1227.   while (!$attributes_values->EOF) {
  1228.     $current_attributes_products_id = $attributes_values->fields['products_id'];
  1229.     $current_attributes_options_id = $attributes_values->fields['options_id'];
  1230.  
  1231.     $products_name_only = zen_get_products_name($attributes_values->fields['products_id']);
  1232.     $options_name = zen_options_name($attributes_values->fields['options_id']);
  1233.     $values_name = zen_values_name($attributes_values->fields['options_values_id']);
  1234.     $rows++;
  1235.  
  1236. // delete all option name values
  1237.     if ($current_options_name != $options_name) {
  1238.       $current_options_name = $options_name;
  1239. ?>
  1240.           <tr>
  1241.             <td>
  1242.               <?php
  1243.               if ($action == '') {
  1244.                 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 ) , '">' .
  1245.                 zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>';
  1246.               }
  1247.               ?>
  1248.               </td>
  1249.             <td class="pageHeading"><?php echo $current_options_name; ?></td>
  1250.           </tr>
  1251. <?php } // option name delete ?>
  1252.           <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
  1253. <?php
  1254.     if (($action == 'update_attribute') && ($_GET['attribute_id'] == $attributes_values->fields['products_attributes_id'])) {
  1255. ?>
  1256.           <tr>
  1257.             <td colspan="10"><?php echo zen_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  1258.           </tr>
  1259.           <tr>
  1260.             <td colspan="10"><?php echo zen_black_line(); ?></td>
  1261.           </tr>
  1262.  
  1263. <tr><td colspan="10" class="attributeBoxContent"><table border="0" width="100%">
  1264.  
  1265. <tr><td class="pageHeading"><?php echo PRODUCTS_ATTRIBUTES_EDITING; ?>
  1266.  
  1267. <?php // fix here edit ?>
  1268. <tr><td class="attributeBoxContent">
  1269. <table border="0" cellpadding="4" cellspacing="2">
  1270.  
  1271. <tr>
  1272.             <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>
  1273.             <td class="smallText" valign="top">
  1274.             <td class="pageHeading" valign="top">&nbsp;
  1275.               <input type="hidden" name="products_id" value="<?php echo $products_filter; ?>">
  1276.               <input type="hidden" name="current_category_id" value="<?php echo $current_category_id; ?>">
  1277.               <?php
  1278.                 $show_model = zen_get_products_model($products_filter);
  1279.                 if(!empty($show_model)) {
  1280.                   $show_model = " - (" . $show_model . ")";
  1281.                 }
  1282.                 echo zen_clean_html(zen_get_products_name($products_filter)) . $show_model;
  1283.               ?>
  1284.             </td>
  1285.  
  1286.           </tr></table></td></tr>
  1287.           <tr class="attributeBoxContent"><td><table><tr>
  1288.             <td class="smallText" valign="top" width="40">&nbsp;</td>
  1289.             <td class="pageHeading">&nbsp;
  1290.               <input type="hidden" name="options_id" value="<?php echo $attributes_values->fields['options_id']; ?>">
  1291.               <?php echo zen_get_option_name_language($attributes_values->fields['options_id'], $_SESSION['languages_id']); ?>:
  1292.             </td>
  1293.             <td class="smallText">&nbsp;<?php echo TABLE_HEADING_OPT_VALUE . '<br />'; ?><select name="values_id" size="10">
  1294. <?php
  1295. // FIX HERE 2 - editing
  1296.       $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
  1297.                                     where pov.language_id ='" . (int)$_SESSION['languages_id'] . "'
  1298.                                     and povtpo.products_options_id='" . $attributes_values->fields['options_id'] . "'
  1299.                                     order by pov.products_options_values_name");
  1300.  
  1301.       while(!$values_values->EOF) {
  1302.         // BOM by zen-cart.cn
  1303.         if ($show_value_numbers == false) {
  1304.           $show_option_name= '&nbsp;&nbsp;&nbsp;[' . GBcase(zen_get_products_options_name_from_value($values_values->fields['products_options_values_id']),"upper") . ' ]';
  1305.         } else {
  1306.           $show_option_name= ' [ #' . $values_values->fields['products_options_values_id'] . ' ] ' . '&nbsp;&nbsp;&nbsp;[' . GBcase(zen_get_products_options_name_from_value($values_values->fields['products_options_values_id']),"upper") . ' ]';
  1307.         }
  1308.         // EOM by zen-cart.cn
  1309.         if ($attributes_values->fields['options_values_id'] == $values_values->fields['products_options_values_id']) {
  1310.           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>';
  1311.         } else {
  1312.           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>';
  1313.         }
  1314.         $values_values->MoveNext();
  1315.       }
  1316. ?>
  1317. <?php
  1318. // set radio values attributes_display_only
  1319.     switch ($attributes_values->fields['attributes_display_only']) {
  1320.       case '0': $on_attributes_display_only = false; $off_attributes_display_only = true; break;
  1321.       case '1': $on_attributes_display_only = true; $off_attributes_display_only = false; break;
  1322.       default: $on_attributes_display_only = false; $off_attributes_display_only = true;
  1323.     }
  1324. // set radio values attributes_default
  1325.     switch ($attributes_values->fields['product_attribute_is_free']) {
  1326.       case '0': $on_product_attribute_is_free = false; $off_product_attribute_is_free = true; break;
  1327.       case '1': $on_product_attribute_is_free = true; $off_product_attribute_is_free = false; break;
  1328.       default: $on_product_attribute_is_free = false; $off_product_attribute_is_free = true;
  1329.     }
  1330. // set radio values attributes_default
  1331.     switch ($attributes_values->fields['attributes_default']) {
  1332.       case '0': $on_attributes_default = false; $off_attributes_default = true; break;
  1333.       case '1': $on_attributes_default = true; $off_attributes_default = false; break;
  1334.       default: $on_attributes_default = false; $off_attributes_default = true;
  1335.     }
  1336. // set radio values attributes_discounted
  1337.     switch ($attributes_values->fields['attributes_discounted']) {
  1338.       case '0': $on_attributes_discounted = false; $off_attributes_discounted = true; break;
  1339.       case '1': $on_attributes_discounted = true; $off_attributes_discounted = false; break;
  1340.       default: $on_attributes_discounted = false; $off_attributes_discounted = true;
  1341.     }
  1342. // set radio values attributes_price_base_included
  1343.     switch ($attributes_values->fields['attributes_price_base_included']) {
  1344.       case '0': $on_attributes_price_base_included = false; $off_attributes_price_base_included = true; break;
  1345.       case '1': $on_attributes_price_base_included = true; $off_attributes_price_base_included = false; break;
  1346.       default: $on_attributes_price_base_included = false; $off_attributes_price_base_included = true;
  1347.     }
  1348. // set radio values attributes_required
  1349.     switch ($attributes_values->fields['attributes_required']) {
  1350.       case '0': $on_attributes_required = false; $off_attributes_required = true; break;
  1351.       case '1': $on_attributes_required = true; $off_attributes_required = false; break;
  1352.       default: $on_attributes_required = false; $off_attributes_required = true;
  1353.     }
  1354. // set image overwrite
  1355.   $on_overwrite = true;
  1356.   $off_overwrite = false;
  1357. // set image delete
  1358.   $on_image_delete = false;
  1359.   $off_image_delete = true;
  1360.  
  1361. ?>
  1362.             </select>&nbsp;</td>
  1363.  
  1364. </table></td></tr>
  1365.  
  1366. <!-- bof: Edit Prices -->
  1367. <tr>
  1368.   <td class="attributeBoxContent">
  1369.     <table border="1" cellpadding="4" cellspacing="2" align="left" width="100%">
  1370.       <tr>
  1371.         <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>
  1372.       </tr>
  1373.     </table>
  1374.   </td>
  1375. </tr>
  1376.  
  1377. <tr><td>
  1378.   <table border="0">
  1379.     <tr>
  1380.       <td colspan="3" class="pageHeading"><?php echo TEXT_PRICES_AND_WEIGHTS; ?></td>
  1381.     </tr>
  1382.     <tr>
  1383.       <td class="attributeBoxContent">
  1384.         <table border="1" cellpadding="4" cellspacing="2" align="left">
  1385.           <tr>
  1386.             <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>
  1387.             <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>
  1388.             <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>
  1389.             <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>
  1390.           </tr>
  1391.         </table>
  1392.       </td>
  1393.  
  1394. <?php if (ATTRIBUTES_ENABLED_PRICE_FACTOR == 'true') { ?>
  1395.       <td class="attributeBoxContent">
  1396.         <table border="1" cellpadding="4" cellspacing="2" align="left">
  1397.           <tr>
  1398.             <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>
  1399.             <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>
  1400.           </tr>
  1401.         </table>
  1402.       </td>
  1403. <?php
  1404.     } else {
  1405.       echo zen_draw_hidden_field('attributes_price_factor', $attributes_values->fields['attributes_price_factor']);
  1406.       echo zen_draw_hidden_field('attributes_price_factor_offset', $attributes_values->fields['attributes_price_factor_offset']);
  1407.       echo zen_draw_hidden_field('attributes_price_factor_onetime', $attributes_values->fields['attributes_price_factor_onetime']);
  1408.       echo zen_draw_hidden_field('attributes_price_factor_onetime_offset', $attributes_values->fields['attributes_price_factor_onetime_offset']);
  1409.     } // ATTRIBUTES_ENABLED_PRICE_FACTOR
  1410. ?>
  1411.  
  1412.     </tr>
  1413.   </table>
  1414. </td></tr>
  1415.  
  1416. <?php if (ATTRIBUTES_ENABLED_QTY_PRICES == 'true') { ?>
  1417.     <tr>
  1418.       <td class="attributeBoxContent">
  1419.         <table border="1" cellpadding="4" cellspacing="2" align="left">
  1420.           <tr>
  1421.             <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>
  1422.             <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>
  1423.           </tr>
  1424.         </table>
  1425.       </td>
  1426.     </tr>
  1427. <?php
  1428.     } else {
  1429.       echo zen_draw_hidden_field('attributes_qty_prices', $attributes_values->fields['attributes_qty_prices']);
  1430.       echo zen_draw_hidden_field('attributes_qty_prices_onetime', $attributes_values->fields['attributes_qty_prices_onetime']);
  1431.     } // ATTRIBUTES_ENABLED_QTY_PRICES
  1432. ?>
  1433.  
  1434. <?php if (ATTRIBUTES_ENABLED_TEXT_PRICES == 'true') { ?>
  1435.     <tr>
  1436.       <td class="attributeBoxContent">
  1437.         <table border="1" cellpadding="4" cellspacing="2" align="left">
  1438.           <tr>
  1439.             <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>
  1440.             <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>
  1441.           </tr>
  1442.         </table>
  1443.       </td>
  1444.     </tr>
  1445. <?php
  1446.     } else {
  1447.       echo zen_draw_hidden_field('attributes_price_words', $attributes_values->fields['attributes_price_words']);
  1448.       echo zen_draw_hidden_field('attributes_price_words_free', $attributes_values->fields['attributes_price_words_free']);
  1449.       echo zen_draw_hidden_field('attributes_price_letters', $attributes_values->fields['attributes_price_letters']);
  1450.       echo zen_draw_hidden_field('attributes_price_letters_free', $attributes_values->fields['attributes_price_letters_free']);
  1451.     } // ATTRIBUTES_ENABLED_TEXT_PRICES
  1452. ?>
  1453.  
  1454. <!-- eof: Edit Prices -->
  1455.  
  1456. <tr><td class="attributeBoxContent">
  1457. <table border="1" cellpadding="4" cellspacing="2">
  1458.  
  1459.               <tr >
  1460.                 <td class="attributeBoxContent" align="center" width="50"><?php echo TEXT_ATTRIBUTES_FLAGS; ?></td>
  1461.                 <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>
  1462.                 <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>
  1463.                 <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>
  1464.                 <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>
  1465.                 <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>
  1466.                 <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>
  1467.               </tr>
  1468.  
  1469. </table></td></tr>
  1470.  
  1471. <?php if (ATTRIBUTES_ENABLED_IMAGES == 'true') { ?>
  1472.  
  1473. <?php
  1474. // edit
  1475. // attributes images
  1476.   $dir = @dir(DIR_FS_CATALOG_IMAGES);
  1477.   $dir_info[] = array('id' => '', 'text' => "Main Directory");
  1478.   while ($file = $dir->read()) {
  1479.     if (is_dir(DIR_FS_CATALOG_IMAGES . $file) && strtoupper($file) != 'CVS' && $file != "." && $file != "..") {
  1480.       $dir_info[] = array('id' => $file . '/', 'text' => $file);
  1481.     }
  1482.   }
  1483.   $dir->close();
  1484.  
  1485.   sort($dir_info);
  1486.  
  1487.   if ($attributes_values->fields['attributes_image'] != '') {
  1488.     $default_directory = substr( $attributes_values->fields['attributes_image'], 0,strpos( $attributes_values->fields['attributes_image'], '/')+1);
  1489.   } else {
  1490.     $default_directory = 'attributes/';
  1491.   }
  1492. ?>
  1493. <tr><td class="attributeBoxContent">
  1494. <table border="0" cellpadding="4" cellspacing="2">
  1495.  
  1496.           <tr class="attributeBoxContent">
  1497.             <td>&nbsp;</td>
  1498.             <td colspan="5">
  1499.               <table>
  1500.                 <tr class="attributeBoxContent">
  1501.                   <td class="main" valign="top">&nbsp;</td>
  1502.                   <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>
  1503.                   <td class="main" valign="top"><?php echo TEXT_ATTRIBUTES_IMAGE_DIR . '<br />' . zen_draw_pull_down_menu('img_dir', $dir_info, $default_directory); ?></td>
  1504.                   <td class="main" valign="middle"><?php echo ($attributes_values->fields['attributes_image'] != '' ? zen_image(DIR_WS_CATALOG_IMAGES . $attributes_values->fields['attributes_image']) : ''); ?></td>
  1505.                   <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>
  1506.                   <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>
  1507.                 </tr>
  1508.               </table>
  1509.             </td>
  1510.             <td>&nbsp;</td>
  1511.           </tr>
  1512.  
  1513. </table></td></tr>
  1514. <?php
  1515.     } else {
  1516.       echo zen_draw_hidden_field('attributes_previous_image', $attributes_values->fields['attributes_image']);
  1517.       echo zen_draw_hidden_field('attributes_image', $attributes_values->fields['attributes_image']);
  1518.     } // ATTRIBUTES_ENABLED_IMAGES
  1519. ?>
  1520.  
  1521. <?php
  1522.       if (DOWNLOAD_ENABLED == 'true') {
  1523.         $download_query_raw ="select products_attributes_filename, products_attributes_maxdays, products_attributes_maxcount
  1524.                              from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . "
  1525.                              where products_attributes_id='" . $attributes_values->fields['products_attributes_id'] . "'";
  1526.         $download = $db->Execute($download_query_raw);
  1527.         if ($download->RecordCount() > 0) {
  1528.           $products_attributes_filename = $download->fields['products_attributes_filename'];
  1529.           $products_attributes_maxdays  = $download->fields['products_attributes_maxdays'];
  1530.           $products_attributes_maxcount = $download->fields['products_attributes_maxcount'];
  1531.         }
  1532. ?>
  1533. <tr><td class="attributeBoxContent">
  1534. <table border="0" cellpadding="4" cellspacing="2">
  1535.           <tr class="attributeBoxContent">
  1536.             <td colspan="5">
  1537.                 <tr class="attributeBoxContent">
  1538.                   <td class="attributeBoxContent" valign="top"><?php echo TABLE_HEADING_DOWNLOAD; ?>&nbsp;</td>
  1539.                   <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>
  1540.                   <td class="attributeBoxContent"><?php echo TABLE_TEXT_MAX_DAYS . '<br />' . zen_draw_input_field('products_attributes_maxdays', $products_attributes_maxdays, 'size="5"'); ?>&nbsp;</td>
  1541.                   <td class="attributeBoxContent"><?php echo TABLE_TEXT_MAX_COUNT . '<br />' . zen_draw_input_field('products_attributes_maxcount', $products_attributes_maxcount, 'size="5"'); ?>&nbsp;</td>
  1542.                 </tr>
  1543.  
  1544. </table></td></tr>
  1545. </td></tr>
  1546.  
  1547. <?php
  1548.       }
  1549. ?>
  1550.  
  1551. </td></tr>
  1552. </table></td></tr>
  1553.  
  1554.           <tr>
  1555.             <td colspan="10"><?php echo zen_black_line(); ?></td>
  1556.           </tr>
  1557.           <tr>
  1558.             <td colspan="10"><?php echo zen_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  1559.           </tr>
  1560.  
  1561. <?php
  1562.     } elseif (($action == 'delete_product_attribute') && ($_GET['attribute_id'] == $attributes_values->fields['products_attributes_id'])) {
  1563.         echo zen_draw_hidden_field('products_filter', $_GET['products_filter']);
  1564.         echo zen_draw_hidden_field('current_category_id', $_GET['current_category_id']);
  1565.         echo zen_draw_hidden_field('delete_attribute_id', $_GET['attribute_id']);
  1566.         ?>
  1567.           <tr>
  1568.             <td colspan="10"><?php echo zen_black_line(); ?></td>
  1569.           </tr>
  1570.           <tr class="attributeBoxContent">
  1571.             <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>
  1572.             <td colspan="3" align="center" class="attributeBoxContent">&nbsp;</td>
  1573.           </tr>
  1574.           <tr>
  1575.             <td class="attributeBoxContent">&nbsp;<b><?php echo $attributes_values->fields["products_attributes_id"]; ?></b>&nbsp;</td>
  1576.             <td class="attributeBoxContent">&nbsp;<b><?php echo $products_name_only; ?></b>&nbsp;</td>
  1577.             <td class="attributeBoxContent">&nbsp;<b><?php echo $options_name; ?></b>&nbsp;</td>
  1578.             <td class="attributeBoxContent">&nbsp;<b><?php echo $values_name; ?></b>&nbsp;</td>
  1579.             <td align="right" class="attributeBoxContent">&nbsp;<b><?php echo $attributes_values->fields["options_values_price"]; ?></b>&nbsp;</td>
  1580.             <td align="center" class="attributeBoxContent">&nbsp;<b><?php echo $attributes_values->fields["price_prefix"]; ?></b>&nbsp;</td>
  1581.             <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>
  1582.             <td colspan="3" align="center" class="attributeBoxContent">&nbsp;</td>
  1583.           </tr>
  1584.           <tr class="attributeBoxContent">
  1585.             <td colspan="10" class="attributeBoxContent">&nbsp;</td>
  1586.           </tr>
  1587.           <tr>
  1588.             <td colspan="10"><?php echo zen_black_line(); ?></td>
  1589.           </tr>
  1590.           <tr>
  1591. <?php
  1592.     } else {
  1593. // attributes display listing
  1594.  
  1595. // calculate current total attribute price
  1596. // $attributes_values
  1597. $attributes_price_final = zen_get_attributes_price_final($attributes_values->fields["products_attributes_id"], 1, $attributes_values, 'false');
  1598. $attributes_price_final_value = $attributes_price_final;
  1599. $attributes_price_final = $currencies->display_price($attributes_price_final, zen_get_tax_rate($product_check->fields['products_tax_class_id']), 1);
  1600. $attributes_price_final_onetime = zen_get_attributes_price_final_onetime($attributes_values->fields["products_attributes_id"], 1, $attributes_values);
  1601. $attributes_price_final_onetime = $currencies->display_price($attributes_price_final_onetime, zen_get_tax_rate($product_check->fields['products_tax_class_id']), 1);
  1602. ?>
  1603.             <td class="smallText">&nbsp;<?php echo $attributes_values->fields["products_attributes_id"]; ?>&nbsp;</td>
  1604.             <td class="smallText">&nbsp;<?php // echo $products_name_only; ?>&nbsp;</td>
  1605.             <td class="smallText">&nbsp;<?php echo $options_name; ?>&nbsp;</td>
  1606.             <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>
  1607.             <td align="right" class="smallText">&nbsp;<?php echo $attributes_values->fields["price_prefix"]; ?>&nbsp;<?php echo $attributes_values->fields["options_values_price"]; ?>&nbsp;</td>
  1608.             <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>
  1609.             <td align="right" class="smallText">&nbsp;<?php echo $attributes_values->fields["products_options_sort_order"]; ?>&nbsp;</td>
  1610. <?php
  1611. // '<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) . '">' .
  1612. // $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) . '">';
  1613. if ($action == '') {
  1614. ?>
  1615. <td>
  1616.   <table border="0" align="center" cellpadding="2" cellspacing="2">
  1617.       <tr>
  1618.         <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>
  1619.         <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>
  1620.         <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>
  1621.         <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>
  1622.         <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>
  1623.         <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>
  1624.       </tr>
  1625.     </table>
  1626. </td>
  1627. <?php } ?>
  1628. <?php
  1629.   $new_attributes_price= '';
  1630.   if ($attributes_values->fields["attributes_discounted"]) {
  1631.     $new_attributes_price = zen_get_attributes_price_final($attributes_values->fields["products_attributes_id"], 1, '', 'false');
  1632.     $new_attributes_price = zen_get_discount_calc($products_filter, true, $new_attributes_price);
  1633.     if ($new_attributes_price != $attributes_price_final_value) {
  1634.       $new_attributes_price = '|' . $currencies->display_price($new_attributes_price, zen_get_tax_rate($product_check->fields['products_tax_class_id']), 1);
  1635.     } else {
  1636.       $new_attributes_price = '';
  1637.     }
  1638.   }
  1639. ?>
  1640.             <td align="right" class="smallText"><?php echo $attributes_price_final . $new_attributes_price . ' ' . $attributes_price_final_onetime; ?></td>
  1641. <?php
  1642.   if ($action != '') {
  1643. ?>
  1644.             <td width='120' align="center" class="smallText">&nbsp;</td>
  1645. <?php
  1646.   } else {
  1647. ?>
  1648.             <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>
  1649. <?php
  1650.   }
  1651. ?>
  1652. <?php
  1653. // bof: show filename if it exists
  1654.       if (DOWNLOAD_ENABLED == 'true') {
  1655.         $download_display_query_raw ="select products_attributes_filename, products_attributes_maxdays, products_attributes_maxcount
  1656.                              from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . "
  1657.                              where products_attributes_id='" . $attributes_values->fields['products_attributes_id'] . "'";
  1658.         $download_display = $db->Execute($download_display_query_raw);
  1659.         if ($download_display->RecordCount() > 0) {
  1660.  
  1661. // Moved to /admin/includes/configure.php
  1662.   if (!defined('DIR_FS_DOWNLOAD')) define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
  1663.  
  1664.   $filename_is_missing='';
  1665.   if ( !file_exists(DIR_FS_DOWNLOAD . $download_display->fields['products_attributes_filename']) ) {
  1666.     $filename_is_missing = zen_image(DIR_WS_IMAGES . 'icon_status_red.gif');
  1667.   } else {
  1668.     $filename_is_missing = zen_image(DIR_WS_IMAGES . 'icon_status_green.gif');
  1669.   }
  1670. ?>
  1671.           </tr>
  1672.  
  1673.           <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
  1674.             <td colspan="3" class="smallText">&nbsp;</td>
  1675.             <td colspan="4"><table>
  1676.               <tr>
  1677.                 <td class="smallText"><?php echo $filename_is_missing . '&nbsp;' . TABLE_TEXT_FILENAME; ?></td>
  1678.                 <td class="smallText">&nbsp;&nbsp;<?php echo $download_display->fields['products_attributes_filename']; ?>&nbsp;</td>
  1679.                 <td class="smallText">&nbsp;&nbsp;<?php echo TABLE_TEXT_MAX_DAYS_SHORT; ?></td>
  1680.                 <td class="smallText">&nbsp;&nbsp;<?php echo $download_display->fields['products_attributes_maxdays']; ?>&nbsp;</td>
  1681.                 <td class="smallText">&nbsp;&nbsp;<?php echo TABLE_TEXT_MAX_COUNT_SHORT; ?></td>
  1682.                 <td class="smallText">&nbsp;&nbsp;<?php echo $download_display->fields['products_attributes_maxcount']; ?>&nbsp;</td>
  1683.               </tr>
  1684.             </table></td>
  1685.  
  1686.  
  1687. <?php
  1688.         } // show downloads
  1689.       }
  1690. // eof: show filename if it exists
  1691. ?>
  1692. <?php
  1693.     }
  1694.     $max_attributes_id_values = $db->Execute("select max(products_attributes_id) + 1
  1695.                                              as next_id from " . TABLE_PRODUCTS_ATTRIBUTES);
  1696.  
  1697.     $next_id = $max_attributes_id_values->fields['next_id'];
  1698.  
  1699. //////////////////////////////////////////////////////////////
  1700. // BOF: Add dividers between Product Names and between Option Names
  1701.     $attributes_values->MoveNext();
  1702.     if (!$attributes_values->EOF) {
  1703.       if ($current_attributes_products_id != $attributes_values->fields['products_id']) {
  1704. ?>
  1705.           <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
  1706.             <td colspan="10"><table width="100%"><td>
  1707.               <tr>
  1708.                 <td><?php echo zen_draw_separator('pixel_black.gif', '100%', '3'); ?></td>
  1709.               </tr>
  1710.             </table></td></tr>
  1711. <?php
  1712.   } else {
  1713.     if ($current_attributes_options_id != $attributes_values->fields['options_id']) {
  1714. ?>
  1715.           <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
  1716.             <td colspan="10"><table width="100%"><td>
  1717.               <tr>
  1718.                 <td><?php echo zen_draw_separator('pixel_black.gif', '100%', '1'); ?></td>
  1719.               </tr>
  1720.             </table></td></tr>
  1721. <?php
  1722.     }
  1723.   }
  1724. }
  1725. // EOF: Add dividers between Product Names and between Option Names
  1726. //////////////////////////////////////////////////////////////
  1727. ?>
  1728.           </tr>
  1729.  
  1730. <?php
  1731.   }
  1732.   if (($action != 'update_attribute' and $action != 'delete_product_attribute')) {
  1733. ?>
  1734.           <tr>
  1735.             <td colspan="10"><?php echo zen_black_line(); ?></td>
  1736.           </tr>
  1737.  
  1738. <!-- bof_adding -->
  1739. <tr class="attributeBoxContent"><td colspan="10"><table border="0" width="100%">
  1740.  
  1741.   <tr class="attributeBoxContent">
  1742.     <td class="pageHeading">
  1743.       <table border="0" width="100%">
  1744.         <tr><td class="attributeBoxContent"><table border="0" cellpadding="4" cellspacing="2" width="100%">
  1745.  
  1746.           <tr class="attributeBoxContent">
  1747.             <td class="pageHeading">&nbsp;<?php echo PRODUCTS_ATTRIBUTES_ADDING; ?></td>
  1748.             <td class="main"><?php echo TEXT_ATTRIBUTES_INSERT_INFO; ?></td>
  1749.               <td align="center" class="attributeBoxContent" height="30" valign="bottom">&nbsp;
  1750.               <?php
  1751.                 if ($action == '') {
  1752.                   echo zen_image_submit('button_insert.gif', IMAGE_INSERT);
  1753.                 } else {
  1754.                   // hide button
  1755.                 }
  1756.               ?>
  1757.             &nbsp;
  1758.               </td>
  1759.  
  1760.           </tr>
  1761.  
  1762.         </table></td></tr>
  1763.       </table>
  1764.     </td>
  1765.   </tr>
  1766.  
  1767. <!-- bof Option Names and Values -->
  1768.   <tr class="attributeBoxContent">
  1769.     <td class="pageHeading">
  1770.       <table border='0' width="100%">
  1771.         <tr><td class="attributeBoxContent"><table border="0" cellpadding="4" cellspacing="2">
  1772.           <tr class="attributeBoxContent"><td><table><tr>
  1773.             <td class="attributeBoxContent" width="40">&nbsp;<?php echo $next_id; ?>&nbsp;</td>
  1774.             <td class="pageHeading" valign="top">&nbsp;
  1775.               <input type="hidden" name="products_id" value="<?php echo $products_filter; ?>">
  1776.               <input type="hidden" name="current_category_id" value="<?php echo $current_category_id; ?>">
  1777.               <?php
  1778.                   $show_model = zen_get_products_model($products_filter);
  1779.                   if(!empty($show_model)) {
  1780.                     $show_model = " - (" . $show_model . ")";
  1781.                   }
  1782.                 echo zen_clean_html(zen_get_products_name($products_filter)) . $show_model;
  1783.               ?>
  1784.             </td>
  1785.           </tr></table></td></tr>
  1786.           <tr class="attributeBoxContent"><td><table><tr>
  1787.             <td class="attributeBoxContent" width="40">&nbsp;</td>
  1788.             <td class="attributeBoxContent">&nbsp;<?php echo TABLE_HEADING_OPT_NAME . '<br />'; ?>
  1789.               <select name="options_id" id="OptionName" onChange="update_option(this.form)" size="<?php echo ($action != 'delete_attribute' ? "15" : "1"); ?>">
  1790. <?php
  1791.     $options_values = $db->Execute("select * from " . TABLE_PRODUCTS_OPTIONS . "
  1792.                                    where language_id = '" . (int)$_SESSION['languages_id'] . "'
  1793.                                    order by products_options_name");
  1794.  
  1795.     while (!$options_values->EOF) {
  1796.       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";
  1797.       $options_values->MoveNext();
  1798.     }
  1799. ?>
  1800.             </select>&nbsp;</td>
  1801.             <td class="attributeBoxContent">&nbsp;<?php echo TABLE_HEADING_OPT_VALUE . '<br />'; ?>
  1802.             <select name="values_id[]" id="OptionValue" multiple="multiple" size="<?php echo ($action != 'delete_attribute' ? "15" : "1"); ?>">
  1803.   <option selected>&lt;-- Please select an Option Name from the list ... </option>
  1804. </select>&nbsp;</td>
  1805.  
  1806. <script language="javascript" type="text/javascript"><!--
  1807.   function update_option(theForm) {
  1808.     // if nothing to do, abort
  1809.     if (!theForm || !theForm.elements["options_id"] || !theForm.elements["values_id[]"]) return;
  1810.     if (!theForm.options_id.options[theForm.options_id.selectedIndex]) return;
  1811.  
  1812.     // enable hourglass
  1813.     document.body.style.cursor = "wait";
  1814.  
  1815.     // set initial values
  1816.     var SelectedOption = theForm.options_id.options[theForm.options_id.selectedIndex].value;
  1817.     var theField = document.getElementById("OptionValue");
  1818.  
  1819.     // reset the array of pulldown options so it can be repopulated
  1820.     var Opts = theField.options.length;
  1821.     while(Opts > 0) {
  1822.       Opts = Opts - 1;
  1823.       theField.options[Opts] = null;
  1824.     }
  1825.  
  1826. <?php  echo zen_js_option_values_list('SelectedOption', 'theField'); ?>
  1827.  
  1828.     // turn off hourglass
  1829.     document.body.style.cursor = "default";
  1830.   }
  1831. -->
  1832. </script>
  1833. <?php
  1834.  
  1835. $chk_defaults = $db->Execute("select products_type from " . TABLE_PRODUCTS . " where products_id=" . $products_filter);
  1836. // set defaults for adding attributes
  1837.  
  1838. $on_product_attribute_is_free = (zen_get_show_product_switch($products_filter, 'ATTRIBUTE_IS_FREE', 'DEFAULT_', '') == 1 ? true : false);
  1839. $off_product_attribute_is_free = ($on_product_attribute_is_free == 1 ? false : true);
  1840. $on_attributes_display_only = (zen_get_show_product_switch($products_filter, 'ATTRIBUTES_DISPLAY_ONLY', 'DEFAULT_', '') == 1 ? true : false);
  1841. $off_attributes_display_only = ($on_attributes_display_only == 1 ? false : true);
  1842. $on_attributes_default = (zen_get_show_product_switch($products_filter, 'ATTRIBUTES_DEFAULT', 'DEFAULT_', '') == 1 ? true : false);
  1843. $off_attributes_default = ($on_attributes_default == 1 ? false : true);
  1844. $on_attributes_discounted = (zen_get_show_product_switch($products_filter, 'ATTRIBUTES_DISCOUNTED', 'DEFAULT_', '') == 1 ? true : false);
  1845. $off_attributes_discounted = ($on_attributes_discounted == 1 ? false : true);
  1846. $on_attributes_price_base_included = (zen_get_show_product_switch($products_filter, 'ATTRIBUTES_PRICE_BASE_INCLUDED', 'DEFAULT_', '') == 1 ? true : false);
  1847. $off_attributes_price_base_included = ($on_attributes_price_base_included == 1 ? false : true);
  1848. $on_attributes_required = (zen_get_show_product_switch($products_filter, 'ATTRIBUTES_REQUIRED', 'DEFAULT_', '') == 1 ? true : false);
  1849. $off_attributes_required = ($on_attributes_required == 1 ? false : true);
  1850.  
  1851. $default_price_prefix = zen_get_show_product_switch($products_filter, 'PRICE_PREFIX', 'DEFAULT_', '');
  1852. $default_price_prefix = ($default_price_prefix == 1 ? '+' : ($default_price_prefix == 2 ? '-' : ''));
  1853. $default_products_attributes_weight_prefix  = zen_get_show_product_switch($products_filter, 'PRODUCTS_ATTRIBUTES_WEIGHT_PREFIX', 'DEFAULT_', '');
  1854. $default_products_attributes_weight_prefix  = ($default_products_attributes_weight_prefix  == 1 ? '+' : ($default_products_attributes_weight_prefix == 2 ? '-' : ''));
  1855.  
  1856. // set defaults for copying
  1857. $on_overwrite = true;
  1858. $off_overwrite = false;
  1859. ?>
  1860.             </select>&nbsp;</td>
  1861.           </tr></table></td></tr>
  1862.  
  1863. <?php // split here ?>
  1864.         </table></td></tr>
  1865.       </table>
  1866.     </td>
  1867.   </tr>
  1868. <!-- eof Option Name and Value -->
  1869.  
  1870. <!-- bof Prices and Weight -->
  1871.   <tr><td class="attributeBoxContent"><table border="0" cellpadding="4" cellspacing="2">
  1872.     <tr>
  1873.       <td colspan="2" class="pageHeading"><?php echo TEXT_PRICES_AND_WEIGHTS; ?></td>
  1874.     </tr>
  1875.     <tr>
  1876.       <td class="attributeBoxContent">
  1877.         <table border="1" cellpadding="4" cellspacing="2">
  1878.           <tr>
  1879.             <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>
  1880.             <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>
  1881.             <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>
  1882.             <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>
  1883.           </tr>
  1884.         </table>
  1885.       </td>
  1886.  
  1887. <?php if (ATTRIBUTES_ENABLED_PRICE_FACTOR == 'true') { ?>
  1888.       <td class="attributeBoxContent">
  1889.         <table border="1" cellpadding="4" cellspacing="2">
  1890.           <tr>
  1891.             <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>
  1892.             <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>
  1893.           </tr>
  1894.         </table>
  1895.       </td>
  1896.     </tr>
  1897. <?php
  1898.     } // ATTRIBUTES_ENABLED_PRICE_FACTOR
  1899. ?>
  1900.  
  1901. <?php if (ATTRIBUTES_ENABLED_QTY_PRICES == 'true') { ?>
  1902.     <tr>
  1903.       <td colspan="2" class="attributeBoxContent">
  1904.         <table border="1" cellpadding="4" cellspacing="2">
  1905.           <tr>
  1906.             <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>
  1907.             <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>
  1908.           </tr>
  1909.         </table>
  1910.       </td>
  1911.     </tr>
  1912. <?php } // ATTRIBUTES_ENABLED_QTY_PRICES ?>
  1913.  
  1914. <?php if (ATTRIBUTES_ENABLED_TEXT_PRICES == 'true') { ?>
  1915.     <tr>
  1916.       <td colspan="2" class="attributeBoxContent">
  1917.         <table border="1" cellpadding="4" cellspacing="2">
  1918.           <tr>
  1919.             <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>
  1920.             <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>
  1921.           </tr>
  1922.         </table>
  1923.       </td>
  1924.     </tr>
  1925. <?php } // ATTRIBUTES_ENABLED_TEXT_PRICES ?>
  1926.  
  1927.   </table></td></tr>
  1928.  
  1929. <!-- eof Option Name and Value -->
  1930.  
  1931. <!-- bof Attribute Flags -->
  1932. <tr class="attributeBoxContent">
  1933.   <td class="pageHeading">
  1934.     <table border='0' width="100%">
  1935.       <tr><td class="attributeBoxContent"><table border="0" cellpadding="4" cellspacing="2">
  1936.  
  1937.             <tr><td class="attributeBoxContent"><table border="1" cellpadding="4" cellspacing="2">
  1938.  
  1939.               <tr >
  1940.                 <td class="smallText" align="center" width="50"><?php echo TEXT_ATTRIBUTES_FLAGS; ?></td>
  1941.                 <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>
  1942.                 <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>
  1943.                 <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>
  1944.                 <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>
  1945.                 <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>
  1946.                 <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>
  1947.               </tr>
  1948.  
  1949. </table></td></tr>
  1950.  
  1951.       </table></td></tr>
  1952.     </table>
  1953.   </td>
  1954. </tr>
  1955. <!-- eof Attribute Flags -->
  1956.  
  1957. <?php if (ATTRIBUTES_ENABLED_IMAGES == 'true') { ?>
  1958. <?php
  1959. // add
  1960. // attributes images
  1961.   $dir = @dir(DIR_FS_CATALOG_IMAGES);
  1962.   $dir_info[] = array('id' => '', 'text' => "Main Directory");
  1963.   while ($file = $dir->read()) {
  1964.     if (is_dir(DIR_FS_CATALOG_IMAGES . $file) && strtoupper($file) != 'CVS' && $file != "." && $file != "..") {
  1965.       $dir_info[] = array('id' => $file . '/', 'text' => $file);
  1966.     }
  1967.   }
  1968.   $dir->close();
  1969.   sort($dir_info);
  1970.  
  1971.   $default_directory = 'attributes/';
  1972. ?>
  1973.  
  1974. <!-- bof Attribute Images -->
  1975. <tr class="attributeBoxContent">
  1976.   <td class="pageHeading">
  1977.     <table border='0' width="100%">
  1978.       <tr><td class="attributeBoxContent"><table border="0" cellpadding="4" cellspacing="2" width="100%">
  1979.  
  1980.         <tr><td class="attributeBoxContent"><table border="0" cellpadding="4" cellspacing="2">
  1981.           <tr class="attributeBoxContent">
  1982.             <td>&nbsp;</td>
  1983.             <td class="main" valign="top">&nbsp;</td>
  1984.  
  1985. <!--
  1986.             <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>
  1987. -->
  1988.  
  1989.             <td class="main" valign="top"><?php echo TEXT_ATTRIBUTES_IMAGE . '<br />' . zen_draw_file_field('attributes_image'); ?></td>
  1990.  
  1991.             <td class="main" valign="top"><?php echo TEXT_ATTRIBUTES_IMAGE_DIR . '<br />' . zen_draw_pull_down_menu('img_dir', $dir_info, $default_directory); ?></td>
  1992.             <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>
  1993.           </tr>
  1994.         </table></td>
  1995.  
  1996.         <td width="200">
  1997.           <table align="right">
  1998.             <tr>
  1999.               <td align="center" class="attributeBoxContent" height="30" valign="bottom">&nbsp;
  2000.               <?php
  2001.                 if ($action == '') {
  2002.                   echo zen_image_submit('button_insert.gif', IMAGE_INSERT);
  2003.                 } else {
  2004.                   // hide button
  2005.                 }
  2006.               ?>
  2007.             &nbsp;
  2008.               </td>
  2009.             </tr>
  2010.           </table>
  2011.  
  2012.         </td></tr>
  2013.  
  2014.       </table></td></tr>
  2015.     </table>
  2016.   </td>
  2017. </tr>
  2018. <!-- eof Attribute Images -->
  2019. <?php } // ATTRIBUTES_ENABLED_IMAGES ?>
  2020.  
  2021. <?php
  2022.       if (DOWNLOAD_ENABLED == 'true') {
  2023.         $products_attributes_maxdays  = DOWNLOAD_MAX_DAYS;
  2024.         $products_attributes_maxcount = DOWNLOAD_MAX_COUNT;
  2025. ?>
  2026. <!-- bof Down loads ON -->
  2027. <tr class="attributeBoxContent">
  2028.   <td class="pageHeading">
  2029.     <table border='0' width="100%">
  2030.       <tr><td class="attributeBoxContent"><table border="0" cellpadding="4" cellspacing="2">
  2031.  
  2032.         <tr><td class="attributeBoxContent"><table border="0" cellpadding="4" cellspacing="2">
  2033.           <tr class="attributeBoxContent">
  2034.             <td class="attributeBoxContent" valign="top"><?php echo TABLE_HEADING_DOWNLOAD; ?>&nbsp;</td>
  2035.             <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>
  2036.             <td class="attributeBoxContent"><?php echo TABLE_TEXT_MAX_DAYS . '<br />' . zen_draw_input_field('products_attributes_maxdays', $products_attributes_maxdays, 'size="5"'); ?>&nbsp;</td>
  2037.             <td class="attributeBoxContent"><?php echo TABLE_TEXT_MAX_COUNT . '<br />' . zen_draw_input_field('products_attributes_maxcount', $products_attributes_maxcount, 'size="5"'); ?>&nbsp;</td>
  2038.           </tr>
  2039.         </table></td></tr>
  2040.  
  2041.       </table></td></tr>
  2042.     </table>
  2043.   </td>
  2044. </tr>
  2045. <!-- eof Downloads ON -->
  2046.  
  2047. <?php
  2048.       } else {
  2049. ?>
  2050. <!-- bof Down loads OFF -->
  2051. <tr class="attributeBoxContent">
  2052.   <td class="pageHeading">
  2053.     <table border='0' width="100%">
  2054.       <tr><td class="attributeBoxContent"><table border="1" cellpadding="4" cellspacing="2">
  2055.  
  2056.         <tr><td class="attributeBoxContent"><table border="0" cellpadding="4" cellspacing="2">
  2057.           <tr class="attributeBoxContent">
  2058.             <td class="attributeBoxContent"><?php echo TEXT_DOWNLOADS_DISABLED; ?>&nbsp;</td>
  2059.           </tr>
  2060.         </table></td></tr>
  2061.  
  2062.       </table></td></tr>
  2063.     </table>
  2064.   </td>
  2065. </tr>
  2066. <!-- eof Downloads OFF -->
  2067. <?php
  2068.       } // end of DOWNLOAD_ENABLED section
  2069. ?>
  2070. <?php
  2071.   }
  2072. ?>
  2073.         </table></form></td>
  2074. <?php
  2075. } // EOF: attributes preview
  2076. ?>
  2077.       </tr>
  2078. <?php
  2079. } // end of attributes
  2080. ?>
  2081.     </table></td>
  2082.  
  2083. </table></td></tr>
  2084. <!-- eof_adding -->
  2085.  
  2086. <!-- products_attributes_eof //-->
  2087.   </tr>
  2088. </table>
  2089. <!-- body_text_eof //-->
  2090. <!-- footer //-->
  2091. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  2092. <!-- footer_eof //-->
  2093. <form id="divertClickProto" action="#" method="post">
  2094. <input type="hidden" name="divertClickProto" value="" />
  2095. <input type="hidden" name="securityToken" value="<?php echo $_SESSION['securityToken']; ?>" />
  2096. </form>
  2097. <script type="text/javascript">
  2098. function divertClick(href)
  2099. {
  2100.    document.getElementById('divertClickProto').action = href;
  2101.    document.getElementById('divertClickProto').submit();
  2102.    return false;
  2103. }
  2104.  
  2105. </script>
  2106.  
  2107. </body>
  2108. </html>
  2109. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  2110.  


cron