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