Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Attributes Option Values page 2 not working!


lindsayanng

Recommended Posts

I am almost there.. I was added all of my product attributes that I need to make my products purchasable.. Well, i got through all of the first page of Attributes Option Values and it clearly went on to page two (page 1 and 2 shows, page 1 is always red)

 

When i click on 2, nothing happens, but the url bar the top goes from this

http://www.bscphoto.com/catalog/****/products_attributes.php?option_order_by=products_options_id&value_page=1

 

to this:

http://www.bscphoto.com/catalog/****/products_attributes.php?option_order_by=products_options_id&value_page=2

 

(i took out the admin folder name because of hack attempts.. But its there.. This is just REALLY weird.. I have added attributes SETS attribute QTY and download store.

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

Oh geeze.. I also can not delete Product Options.. it goes BLANK!!!

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

heres the code for admin/product_attributes.php

<?php
/*
 $Id: products_attributes.php 1776 2008-01-09 20:41:00Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2008 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');
 $languages = tep_get_languages();

 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

if (tep_not_null($action)) {
$page_info = '';
if (isset($HTTP_GET_VARS['option_page'])) $page_info .= 'option_page=' . $HTTP_GET_VARS['option_page'] . '&';
if (isset($HTTP_GET_VARS['value_page'])) $page_info .= 'value_page=' . $HTTP_GET_VARS['value_page'] . '&';
if (isset($HTTP_GET_VARS['attribute_page'])) $page_info .= 'attribute_page=' . $HTTP_GET_VARS['attribute_page'] . '&';
// BOF Super Download Shop v1.0 mod
if (isset($HTTP_GET_VARS['file_group_page'])) $page_info .= 'file_group_page=' . $HTTP_GET_VARS['file_group_page'] . '&';
if (isset($HTTP_GET_VARS['group_file_page'])) $page_info .= 'group_file_page=' . $HTTP_GET_VARS['group_file_page'] . '&';
// EOF Super Download Shop v1.0 mod
if (tep_not_null($page_info)) {
  $page_info = substr($page_info, 0, -1);
}

switch ($action) {
  case 'add_product_options':
	$products_options_id = tep_db_prepare_input($HTTP_POST_VARS['products_options_id']);
	$option_name_array = $HTTP_POST_VARS['option_name'];

	for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {
	  $option_name = tep_db_prepare_input($option_name_array[$languages[$i]['id']]);

	  tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS . " (products_options_id, products_options_name, language_id) values ('" . (int)$products_options_id . "', '" . tep_db_input($option_name) . "', '" . (int)$languages[$i]['id'] . "')");
	}
	tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
	break;
  case 'add_product_option_values':
	$value_name_array = $HTTP_POST_VARS['value_name'];
	$value_id = tep_db_prepare_input($HTTP_POST_VARS['value_id']);
	$option_id = tep_db_prepare_input($HTTP_POST_VARS['option_id']);

	for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {
	  $value_name = tep_db_prepare_input($value_name_array[$languages[$i]['id']]);

	  tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS_VALUES . " (products_options_values_id, language_id, products_options_values_name) values ('" . (int)$value_id . "', '" . (int)$languages[$i]['id'] . "', '" . tep_db_input($value_name) . "')");
	}

	tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " (products_options_id, products_options_values_id) values ('" . (int)$option_id . "', '" . (int)$value_id . "')");

	tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
	break;
  case 'add_product_attributes':
	$products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
	$options_id = tep_db_prepare_input($HTTP_POST_VARS['options_id']);
	$values_id = tep_db_prepare_input($HTTP_POST_VARS['values_id']);
	$value_price = tep_db_prepare_input($HTTP_POST_VARS['value_price']);
	$price_prefix = tep_db_prepare_input($HTTP_POST_VARS['price_prefix']);

	tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values (' ' ,  '" . (int)$products_id . "', '" . (int)$options_id . "', '" . (int)$values_id . "', '" . (float)tep_db_input($value_price) . "', '" . tep_db_input($price_prefix) . "')");

	if (DOWNLOAD_ENABLED == 'true') {
	  $products_attributes_id = tep_db_insert_id();

	  $products_attributes_filename = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_filename']);
	  $products_attributes_maxdays = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_maxdays']);
	  $products_attributes_maxcount = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_maxcount']);
// BOF Super Download Shop v1.0 mod
	  if (DOWNLOADS_CONTROLLER_FILEGROUP_STATUS == 'Yes') {
		$product_attribute_filegroup_id = tep_db_prepare_input($HTTP_POST_VARS['filegroup_id']);
		if ($product_attribute_filegroup_id > 0) {
		  $products_attributes_filename = 'Group_Files-' . $product_attribute_filegroup_id;
		} else {
		  if (strstr($products_attributes_filename, 'Group_Files-')) $products_attributes_filename = 'File_Not_Assigned';
		}
		if (tep_not_null($products_attributes_filename)) tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " values (" . (int)$products_attributes_id . ", '" . tep_db_input($products_attributes_filename) . "', '" . tep_db_input($product_attribute_filegroup_id) . "', '" . tep_db_input($products_attributes_maxdays) . "', '" . tep_db_input($products_attributes_maxcount) . "')");
	  } else if (tep_not_null($products_attributes_filename)) {
		tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " values (" . (int)$products_attributes_id . ", '" . tep_db_input($products_attributes_filename) . "', '', '" . tep_db_input($products_attributes_maxdays) . "', '" . tep_db_input($products_attributes_maxcount) . "')");
	  }
// EOF Super Download Shop v1.0 mod
	}

	tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
	break;
// BOF Super Download Shop v1.0 mod
  case 'add_filegroups':
	$filegroup_id = tep_db_prepare_input($HTTP_POST_VARS['filegroup_id']);
	$file_group_array = $HTTP_POST_VARS['file_group_name'];
	// check if any name given
	$name_check = 0;
	for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {
	  if (!empty($file_group_array[$languages[$i]['id']])) $name_check = 1;
	}

	if (is_numeric($filegroup_id) && $name_check == 1) {
	  for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {
		$file_group_name = tep_db_prepare_input($file_group_array[$languages[$i]['id']]);

		tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS . " (download_group_id, download_group_name, language_id) values ('" . (int)$filegroup_id . "', '" . tep_db_input($file_group_name) . "', '" . (int)$languages[$i]['id'] . "')");
	  }
	}
	tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
	break;
  case 'add_group_file':
	$filegroup_id = tep_db_prepare_input($HTTP_POST_VARS['filegroup_id']);
	$file_desc_array = $HTTP_POST_VARS['file_desc'];
	$file_name = '';
	if (isset($HTTP_POST_VARS['input_filename']) && !empty($HTTP_POST_VARS['input_filename'])) {
	  $file_name = tep_db_prepare_input($HTTP_POST_VARS['input_filename']);
	}
	if (tep_not_null($file_name) && file_exists(DIR_FS_CATALOG_DOWNLOAD . $file_name)) {
	  // check existing file and descriptions
	  $file_query = tep_db_query("select download_groups_file_id from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " where download_group_filename = '" . $file_name . "'");
	  if (tep_db_num_rows($file_query) > 0) {
		$file_array = tep_db_fetch_array($file_query);
		tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " (download_groups_file_id, download_group_id, download_group_filename) values ('" . (int)$file_array['download_groups_file_id'] . "', '" . (int)$filegroup_id . "', '" . tep_db_input($file_name) . "')");
	  } else {
		tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " (download_group_id, download_group_filename) values ('" . (int)$filegroup_id . "', '" . tep_db_input($file_name) . "')");
		$download_groups_file_id = tep_db_insert_id();

		for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {
		  $file_desc = tep_db_prepare_input($file_desc_array[$languages[$i]['id']]);
		  if (empty($file_desc)) $file_desc = tep_db_prepare_input(TEXT_TEMP_DESC . ' ' . $download_groups_file_id);

		  tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_TO_FILES . " (download_groups_file_id, language_id, download_group_file_description) values ('" . (int)$download_groups_file_id . "', '" . (int)$languages[$i]['id'] . "', '" . tep_db_input($file_desc) . "')");
		}
	  }
	} else {
	  if (!tep_not_null($file_name)) $messageStack->add_session(ERROR_NO_FILENAME, 'error');
	  else $messageStack->add_session(sprintf(ERROR_FILE_DOES_NOT_EXIST, $file_name), 'error');
	}
	tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
	break;
  case 'add_mass_files':
	$filegroup_id = tep_db_prepare_input($HTTP_POST_VARS['filegroup_id']);
	$file_selected = $HTTP_POST_VARS['file_selected'];
	foreach($file_selected as $k => $file_name) {
	  if (tep_not_null($file_name)) {
		$file_name = tep_db_prepare_input($file_name);
		// check if file already in group
		$file_check_query = tep_db_query("select * from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " where download_group_id = '" . (int)$filegroup_id . "' and download_group_filename = '" . $file_name . "'");
		if (tep_db_num_rows($file_check_query) == 0) {
		  // check existing file and descriptions
		  $file_query = tep_db_query("select download_groups_file_id from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " where download_group_filename = '" . $file_name . "'");
		  if (tep_db_num_rows($file_query) > 0) {
			$file_array = tep_db_fetch_array($file_query);
			tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " (download_groups_file_id, download_group_id, download_group_filename) values ('" . (int)$file_array['download_groups_file_id'] . "', '" . (int)$filegroup_id . "', '" . tep_db_input($file_name) . "')");
		  } else {
			tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " (download_group_id, download_group_filename) values ('" . (int)$filegroup_id . "', '" . tep_db_input($file_name) . "')");
			$download_groups_file_id = tep_db_insert_id();

			for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {
			  $file_desc = tep_db_prepare_input(TEXT_TEMP_DESC . ' ' . $download_groups_file_id);

			  tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_TO_FILES . " (download_groups_file_id, language_id, download_group_file_description) values ('" . (int)$download_groups_file_id . "', '" . (int)$languages[$i]['id'] . "', '" . tep_db_input($file_desc) . "')");
			}
		  }
		}
	  }
	}
	tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
	break;
  case 'update_filegroup_name':
	$file_group_name_array = $HTTP_POST_VARS['file_group_name'];
	$filegroup_id = tep_db_prepare_input($HTTP_POST_VARS['filegroup_id']);

	for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {
	  $file_group_name = tep_db_prepare_input($file_group_name_array[$languages[$i]['id']]);

	  tep_db_query("update " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS . " set download_group_name = '" . tep_db_input($file_group_name) . "' where download_group_id = '" . (int)$filegroup_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'");
	}

	tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
	break;
  case 'update_file_desc':
	$file_desc_array = $HTTP_POST_VARS['file_desc'];
	$file_id = tep_db_prepare_input($HTTP_POST_VARS['file_id']);

	for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {
	  $file_desc = tep_db_prepare_input($file_desc_array[$languages[$i]['id']]);

	  tep_db_query("update " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_TO_FILES . " set download_group_file_description = '" . tep_db_input($file_desc) . "' where download_groups_file_id = '" . (int)$file_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'");
	}

	tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
	break;
  case 'delete_download_group':
	$filegroup_id = tep_db_prepare_input($HTTP_GET_VARS['filegroup_id']);

	tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS . " where download_group_id = '" . (int)$filegroup_id . "'");
	// check files in other group
	$files_query = tep_db_query("select download_groups_file_id from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " where download_group_id = '" . (int)$filegroup_id . "'");
	while ($file_array = tep_db_fetch_array($files_query)) {
	  $file_check = tep_db_query("select download_groups_file_id from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " where download_group_id != '" . (int)$filegroup_id . "' and download_groups_file_id = '" . $file_array['download_groups_file_id'] . "'");
	  if (tep_db_num_rows($file_check) === 0) {
		tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_TO_FILES . " where download_groups_file_id = '" . $file_array['download_groups_file_id'] . "'");
	  }
	}
	tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . " where download_group_id = '" . (int)$filegroup_id . "'");

	tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
	break;
  case 'delete_file_from_group':
	$filegroup_id = tep_db_prepare_input($HTTP_GET_VARS['filegroup_id']);
	$file_id = tep_db_prepare_input($HTTP_GET_VARS['group_file_id']);

	tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . "
				  where download_group_id = '" . (int)$filegroup_id . "'
				  and download_groups_file_id = '" . (int)$file_id . "'");
	// check files in other group
	$file_check = tep_db_query("select download_groups_file_id from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . "
								where download_group_id != '" . (int)$filegroup_id . "'
								and download_groups_file_id = '" . (int)$file_id . "'");
	if (tep_db_num_rows($file_check) === 0) {
	  tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_TO_FILES . " where download_groups_file_id = '" . (int)$file_id . "'");
	}

	tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
	break;
  case 'delete_file_all_groups':
	$file_id = tep_db_prepare_input($HTTP_GET_VARS['group_file_id']);

	tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_FILES . "
				  where download_groups_file_id = '" . (int)$file_id . "'");
	tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS_TO_FILES . " where download_groups_file_id = '" . (int)$file_id . "'");

	tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
	break;
// EOF Super Download Shop v1.0 mod

  case 'update_option_name':
	$option_name_array = $HTTP_POST_VARS['option_name'];
	$option_id = tep_db_prepare_input($HTTP_POST_VARS['option_id']);

	for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {
	  $option_name = tep_db_prepare_input($option_name_array[$languages[$i]['id']]);

	  tep_db_query("update " . TABLE_PRODUCTS_OPTIONS . " set products_options_name = '" . tep_db_input($option_name) . "' where products_options_id = '" . (int)$option_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'");
	}

	tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
	break;
  case 'update_value':
	$value_name_array = $HTTP_POST_VARS['value_name'];
	$value_id = tep_db_prepare_input($HTTP_POST_VARS['value_id']);
	$option_id = tep_db_prepare_input($HTTP_POST_VARS['option_id']);

	for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {
	  $value_name = tep_db_prepare_input($value_name_array[$languages[$i]['id']]);

	  tep_db_query("update " . TABLE_PRODUCTS_OPTIONS_VALUES . " set products_options_values_name = '" . tep_db_input($value_name) . "' where products_options_values_id = '" . tep_db_input($value_id) . "' and language_id = '" . (int)$languages[$i]['id'] . "'");
	}

	tep_db_query("update " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " set products_options_id = '" . (int)$option_id . "'  where products_options_values_id = '" . (int)$value_id . "'");

	tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
	break;
  case 'update_product_attribute':
	$products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);
	$options_id = tep_db_prepare_input($HTTP_POST_VARS['options_id']);
	$values_id = tep_db_prepare_input($HTTP_POST_VARS['values_id']);
	$value_price = tep_db_prepare_input($HTTP_POST_VARS['value_price']);
	$price_prefix = tep_db_prepare_input($HTTP_POST_VARS['price_prefix']);
	$attribute_id = tep_db_prepare_input($HTTP_POST_VARS['attribute_id']);

	 tep_db_query("update " . TABLE_PRODUCTS_ATTRIBUTES . " set products_id = '" . (int)$products_id . "', options_id = '" . (int)$options_id . "', options_values_id = '" . (int)$values_id . "', options_values_price = '" . tep_db_input($value_price) . "', price_prefix = '" . tep_db_input($price_prefix) . "' where products_attributes_id = '" . (int)$attribute_id . "'");

	if (DOWNLOAD_ENABLED == 'true') {
	  $products_attributes_filename = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_filename']);
	  $products_attributes_maxdays = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_maxdays']);
	  $products_attributes_maxcount = tep_db_prepare_input($HTTP_POST_VARS['products_attributes_maxcount']);
// BOF Super Download Shop v1.0 mod
	  if (DOWNLOADS_CONTROLLER_FILEGROUP_STATUS == 'Yes') {
		$product_attribute_filegroup_id = tep_db_prepare_input($HTTP_POST_VARS['filegroup_id']);
		if ($product_attribute_filegroup_id > 0) {
		  $products_attributes_filename = 'Group_Files-' . $product_attribute_filegroup_id;
		} else {
		  if (strstr($products_attributes_filename, 'Group_Files-')) $products_attributes_filename = 'File_Not_Assigned';
		}
		tep_db_query("replace into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " set products_attributes_id = '" . (int)$attribute_id . "', products_attributes_filename = '" . tep_db_input($products_attributes_filename) . "', products_attributes_filegroup_id = '" . tep_db_input($product_attribute_filegroup_id) . "', products_attributes_maxdays = '" . tep_db_input($products_attributes_maxdays) . "', products_attributes_maxcount = '" . tep_db_input($products_attributes_maxcount) . "'");
	  } else if (tep_not_null($products_attributes_filename)) {
		tep_db_query("replace into " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " set products_attributes_id = '" . (int)$attribute_id . "', products_attributes_filename = '" . tep_db_input($products_attributes_filename) . "', products_attributes_maxdays = '" . tep_db_input($products_attributes_maxdays) . "', products_attributes_maxcount = '" . tep_db_input($products_attributes_maxcount) . "'");
	  }
// EOF Super Download Shop v1.0 mod
	}

	tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
	break;
  case 'delete_option':
	$option_id = tep_db_prepare_input($HTTP_GET_VARS['option_id']);

	tep_db_query("delete from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$option_id . "'");

	tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
	break;
  case 'delete_value':
	$value_id = tep_db_prepare_input($HTTP_GET_VARS['value_id']);

	tep_db_query("delete from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int)$value_id . "'");
	tep_db_query("delete from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int)$value_id . "'");
	tep_db_query("delete from " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_values_id = '" . (int)$value_id . "'");

	tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
	break;
  case 'delete_attribute':
	$attribute_id = tep_db_prepare_input($HTTP_GET_VARS['attribute_id']);

	tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_attributes_id = '" . (int)$attribute_id . "'");

// added for DOWNLOAD_ENABLED. Always try to remove attributes, even if downloads are no longer enabled
	tep_db_query("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " where products_attributes_id = '" . (int)$attribute_id . "'");

	tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
	break;
}
 }
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script language="javascript"><!--
function go_option() {
 if (document.option_order_by.selected.options[document.option_order_by.selected.selectedIndex].value != "none") {
location = "<?php echo tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'option_page=' . ($HTTP_GET_VARS['option_page'] ? $HTTP_GET_VARS['option_page'] : 1)); ?>&option_order_by="+document.option_order_by.selected.options[document.option_order_by.selected.selectedIndex].value;
 }
}
//--></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
<!-- options and values//-->
  <tr>
	<td width="100%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
	  <tr>
		<td valign="top" width="50%"><table width="100%" border="0" cellspacing="0" cellpadding="2">
<!-- options //-->
<?php
 if ($action == 'delete_product_option') { // delete product option
$options = tep_db_query("select products_options_id, products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$HTTP_GET_VARS['option_id'] . "' and language_id = '" . (int)$languages_id . "'");
$options_values = tep_db_fetch_array($options);
?>
		  <tr>
			<td class="pageHeading"> <?php echo $options_values['products_options_name']; ?> </td>
			<td> <?php echo tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', '', '1', '53'); ?> </td>
		  </tr>
		  <tr>
			<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
			  <tr>
				<td colspan="3"><?php echo tep_black_line(); ?></td>
			  </tr>
<?php
$products = tep_db_query("select p.products_id, pd.products_name, pov.products_options_values_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pov.language_id = '" . (int)$languages_id . "' and pd.language_id = '" . (int)$languages_id . "' and pa.products_id = p.products_id and pa.options_id='" . (int)$HTTP_GET_VARS['option_id'] . "' and pov.products_options_values_id = pa.options_values_id order by pd.products_name");
if (tep_db_num_rows($products)) {
?>
			  <tr class="dataTableHeadingRow">
				<td class="dataTableHeadingContent" align="center"> <?php echo TABLE_HEADING_ID; ?> </td>
				<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_PRODUCT; ?> </td>
				<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_VALUE; ?> </td>
			  </tr>
			  <tr>
				<td colspan="3"><?php echo tep_black_line(); ?></td>
			  </tr>
<?php
  $rows = 0;
  while ($products_values = tep_db_fetch_array($products)) {
	$rows++;
?>
			  <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
				<td align="center" class="smallText"> <?php echo $products_values['products_id']; ?> </td>
				<td class="smallText"> <?php echo $products_values['products_name']; ?> </td>
				<td class="smallText"> <?php echo $products_values['products_options_values_name']; ?> </td>
			  </tr>
<?php
  }
?>
			  <tr>
				<td colspan="3"><?php echo tep_black_line(); ?></td>
			  </tr>
			  <tr>
				<td colspan="3" class="main"><br><?php echo TEXT_WARNING_OF_DELETE; ?></td>
			  </tr>
			  <tr>
				<td align="right" colspan="3" class="main"><br><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, (isset($HTTP_GET_VARS['value_page']) ? 'value_page=' . $HTTP_GET_VARS['value_page'] . '&' : '') . (isset($HTTP_GET_VARS['attribute_page']) ? 'attribute_page=' . $HTTP_GET_VARS['attribute_page'] : ''), 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', ' cancel '); ?></a> </td>
		 </tr>
			  <tr>
				<td class="main" colspan="2"><br><?php echo TEXT_OK_TO_DELETE; ?></td>
			<td align="right"><br><form name="option_order_by" action="<?php echo FILENAME_PRODUCTS_ATTRIBUTES; ?>"><select name="selected" onChange="go_option()"><option value="products_options_id"<?php if ($option_order_by == 'products_options_id') { echo ' SELECTED'; } ?>><?php echo TEXT_OPTION_ID; ?></option><option value="products_options_name"<?php if ($option_order_by == 'products_options_name') { echo ' SELECTED'; } ?>><?php echo TEXT_OPTION_NAME; ?></option></select></form></td>
			 </tr>
			  <tr>
				<td class="main" align="right" colspan="3"><br><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=delete_option&option_id=' . $HTTP_GET_VARS['option_id'], 'NONSSL') . '">'; ?><?php echo tep_image_button('button_delete.gif', ' delete '); ?></a>   <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, (isset($HTTP_GET_VARS['order_by']) ? 'order_by=' . $HTTP_GET_VARS['order_by'] . '&' : '') . (isset($HTTP_GET_VARS['page']) ? 'page=' . $HTTP_GET_VARS['page'] : ''), 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', ' cancel '); ?></a> </td>
			  </tr>
<?php
}
?>
			</table></td>
		  </tr>
<?php
 } else {
?>
		  <tr>
			<td colspan="3" class="pageHeading"> <?php echo HEADING_TITLE_OPT; ?> </td>
		  </tr>
		  <tr>
			<td colspan="3" class="smallText">
<?php
if (isset($HTTP_GET_VARS['option_order_by'])) {
  $option_order_by = $HTTP_GET_VARS['option_order_by'];
} else {
  $option_order_by = 'products_options_id';
}
?>
<?php
 $per_page = MAX_ROW_LISTS_OPTIONS;
$options = "select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . (int)$languages_id . "' order by " . $option_order_by;
if (!isset($option_page)) {
  $option_page = 1;
}
$prev_option_page = $option_page - 1;
$next_option_page = $option_page + 1;

$option_query = tep_db_query($options);

$option_page_start = ($per_page * $option_page) - $per_page;
$num_rows = tep_db_num_rows($option_query);

if ($num_rows <= $per_page) {
  $num_pages = 1;
} else if (($num_rows % $per_page) == 0) {
  $num_pages = ($num_rows / $per_page);
} else {
  $num_pages = ($num_rows / $per_page) + 1;
}
$num_pages = (int) $num_pages;

$options = $options . " LIMIT $option_page_start, $per_page";

// Previous
if ($prev_option_page)  {
  echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'option_page=' . $prev_option_page) . '"> << </a> | ';
}

for ($i = 1; $i <= $num_pages; $i++) {
  if ($i != $option_page) {
	echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'option_page=' . $i) . '">' . $i . '</a> | ';
  } else {
	echo '<b><font color=red>' . $i . '</font></b> | ';
  }
}

// Next
if ($option_page != $num_pages) {
  echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'option_page=' . $next_option_page) . '"> >> </a>';
}?>
			</td>
		  </tr>
		  <tr>
			<td colspan="3"><?php echo tep_black_line(); ?></td>
		  </tr>
		  <tr class="dataTableHeadingRow">
			<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_ID; ?> </td>
			<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_NAME; ?> </td>
			<td class="dataTableHeadingContent" align="center"> <?php echo TABLE_HEADING_ACTION; ?> </td>
		  </tr>
		  <tr>
			<td colspan="3"><?php echo tep_black_line(); ?></td>
		  </tr>
<?php
$next_id = 1;
$rows = 0;
$options = tep_db_query($options);
while ($options_values = tep_db_fetch_array($options)) {
  $rows++;
?>
		  <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
<?php
  if (($action == 'update_option') && ($HTTP_GET_VARS['option_id'] == $options_values['products_options_id'])) {
	echo '<form name="option" action="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=update_option_name', 'NONSSL') . '" method="post">';
	$inputs = '';
	for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {
	  $option_name = tep_db_query("select products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . $options_values['products_options_id'] . "' and language_id = '" . $languages[$i]['id'] . "'");
	  $option_name = tep_db_fetch_array($option_name);
	  $inputs .= $languages[$i]['code'] . ': <input type="text" name="option_name[' . $languages[$i]['id'] . ']" size="20" value="' . $option_name['products_options_name'] . '"> <br>';
	}
?>
			<td align="center" class="smallText"> <?php echo $options_values['products_options_id']; ?><input type="hidden" name="option_id" value="<?php echo $options_values['products_options_id']; ?>"> </td>
			<td class="smallText"><?php echo $inputs; ?></td>
			<td align="center" class="smallText"> <?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE); ?> <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, '', 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', IMAGE_CANCEL); ?></a> </td>
<?php
	echo '</form>' . "\n";
  } else {
?>
			<td align="center" class="smallText"> <?php echo $options_values["products_options_id"]; ?> </td>
			<td class="smallText"> <?php echo $options_values["products_options_name"]; ?> </td>
			<td align="center" class="smallText"> <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=update_option&option_id=' . $options_values['products_options_id'] . '&option_order_by=' . $option_order_by . '&option_page=' . $option_page, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_edit.gif', IMAGE_UPDATE); ?></a>  <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=delete_product_option&option_id=' . $options_values['products_options_id'], 'NONSSL') , '">'; ?><?php echo tep_image_button('button_delete.gif', IMAGE_DELETE); ?></a> </td>
<?php
  }
?>
		  </tr>
<?php
  $max_options_id_query = tep_db_query("select max(products_options_id) + 1 as next_id from " . TABLE_PRODUCTS_OPTIONS);
  $max_options_id_values = tep_db_fetch_array($max_options_id_query);
  $next_id = $max_options_id_values['next_id'];
}
?>
		  <tr>
			<td colspan="3"><?php echo tep_black_line(); ?></td>
		  </tr>
<?php
if ($action != 'update_option') {
?>
		  <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
<?php
  echo '<form name="options" action="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=add_product_options&option_page=' . $option_page, 'NONSSL') . '" method="post"><input type="hidden" name="products_options_id" value="' . $next_id . '">';
  $inputs = '';
  for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {
	$inputs .= $languages[$i]['code'] . ': <input type="text" name="option_name[' . $languages[$i]['id'] . ']" size="20"> <br>';
  }
?>
			<td align="center" class="smallText"> <?php echo $next_id; ?> </td>
			<td class="smallText"><?php echo $inputs; ?></td>
			<td align="center" class="smallText"> <?php echo tep_image_submit('button_insert.gif', IMAGE_INSERT); ?> </td>
<?php
  echo '</form>';
?>
		  </tr>
		  <tr>
			<td colspan="3"><?php echo tep_black_line(); ?></td>
		  </tr>
<?php
}
 }
?>
		</table></td>
<!-- options eof //-->
		<td valign="top" width="50%"><table width="100%" border="0" cellspacing="0" cellpadding="2">
<!-- value //-->
<?php
 if ($action == 'delete_option_value') { // delete product option value
$values = tep_db_query("select products_options_values_id, products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int)$HTTP_GET_VARS['value_id'] . "' and language_id = '" . (int)$languages_id . "'");
$values_values = tep_db_fetch_array($values);
?>
		  <tr>
			<td colspan="3" class="pageHeading"> <?php echo $values_values['products_options_values_name']; ?> </td>
			<td> <?php echo tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', '', '1', '53'); ?> </td>
		  </tr>
		  <tr>
			<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
			  <tr>
				<td colspan="3"><?php echo tep_black_line(); ?></td>
			  </tr>
<?php
$products = tep_db_query("select p.products_id, pd.products_name, po.products_options_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS . " po, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and po.language_id = '" . (int)$languages_id . "' and pa.products_id = p.products_id and pa.options_values_id='" . (int)$HTTP_GET_VARS['value_id'] . "' and po.products_options_id = pa.options_id order by pd.products_name");
if (tep_db_num_rows($products)) {
?>
			  <tr class="dataTableHeadingRow">
				<td class="dataTableHeadingContent" align="center"> <?php echo TABLE_HEADING_ID; ?> </td>
				<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_PRODUCT; ?> </td>
				<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_NAME; ?> </td>
			  </tr>
			  <tr>
				<td colspan="3"><?php echo tep_black_line(); ?></td>
			  </tr>
<?php
  while ($products_values = tep_db_fetch_array($products)) {
	$rows++;
?>
			  <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
				<td align="center" class="smallText"> <?php echo $products_values['products_id']; ?> </td>
				<td class="smallText"> <?php echo $products_values['products_name']; ?> </td>
				<td class="smallText"> <?php echo $products_values['products_options_name']; ?> </td>
			  </tr>
<?php
  }
?>
			  <tr>
				<td colspan="3"><?php echo tep_black_line(); ?></td>
			  </tr>
			  <tr>
				<td class="main" colspan="3"><br><?php echo TEXT_WARNING_OF_DELETE; ?></td>
			  </tr>
			  <tr>
				<td class="main" align="right" colspan="3"><br><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, (isset($HTTP_GET_VARS['value_page']) ? 'value_page=' . $HTTP_GET_VARS['value_page'] . '&' : '') . (isset($HTTP_GET_VARS['attribute_page']) ? 'attribute_page=' . $attribute_page : ''), 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', ' cancel '); ?></a> </td>
			  </tr>
<?php
} else {
?>
			  <tr>
				<td class="main" colspan="3"><br><?php echo TEXT_OK_TO_DELETE; ?></td>
			  </tr>
			  <tr>
				<td class="main" align="right" colspan="3"><br><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=delete_value&value_id=' . $HTTP_GET_VARS['value_id'], 'NONSSL') . '">'; ?><?php echo tep_image_button('button_delete.gif', ' delete '); ?></a>   <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, '&option_page=' . $option_page . (isset($HTTP_GET_VARS['value_page']) ? '&value_page=' . $value_page : '') . (isset($HTTP_GET_VARS['attribute_page']) ? '&attribute_page=' . $attribute_page : ''), 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', ' cancel '); ?></a> </td>
			  </tr>
<?php
}
?>
			  </table></td>
		  </tr>
<?php
 } else {
?>
		  <tr>
			<td colspan="3" class="pageHeading"> <?php echo HEADING_TITLE_VAL; ?> </td>
			<td> <?php echo tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', '', '1', '53'); ?> </td>
		  </tr>
		  <tr>
			<td colspan="4" class="smallText" align="right">
<?php
$per_page = MAX_ROW_LISTS_OPTIONS;
$values = "select pov.products_options_values_id, pov.products_options_values_name, pov2po.products_options_id from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov left join " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " pov2po on pov.products_options_values_id = pov2po.products_options_values_id where pov.language_id = '" . (int)$languages_id . "' order by pov.products_options_values_id";
if (!isset($value_page)) {
  $value_page = 1;
}
$prev_value_page = $value_page - 1;
$next_value_page = $value_page + 1;

$value_query = tep_db_query($values);

$value_page_start = ($per_page * $value_page) - $per_page;
$num_rows = tep_db_num_rows($value_query);

if ($num_rows <= $per_page) {
  $num_pages = 1;
} else if (($num_rows % $per_page) == 0) {
  $num_pages = ($num_rows / $per_page);
} else {
  $num_pages = ($num_rows / $per_page) + 1;
}
$num_pages = (int) $num_pages;

$values = $values . " LIMIT $value_page_start, $per_page";

// Previous
if ($prev_value_page)  {
  echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'option_order_by=' . $option_order_by . '&value_page=' . $prev_value_page) . '"> << </a> | ';
}

for ($i = 1; $i <= $num_pages; $i++) {
  if ($i != $value_page) {
	 echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, (isset($option_order_by) ? 'option_order_by=' . $option_order_by . '&' : '') . 'value_page=' . $i) . '">' . $i . '</a> | ';
  } else {
	 echo '<b><font color=red>' . $i . '</font></b> | ';
  }
}

// Next
if ($value_page != $num_pages) {
  echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, (isset($option_order_by) ? 'option_order_by=' . $option_order_by . '&' : '') . 'value_page=' . $next_value_page) . '"> >></a> ';
}

?>
			</td>
		  </tr>
		  <tr>
			<td colspan="4"><?php echo tep_black_line(); ?></td>
		  </tr>
		  <tr class="dataTableHeadingRow">
			<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_ID; ?> </td>
			<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_NAME; ?> </td>
			<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_VALUE; ?> </td>
			<td class="dataTableHeadingContent" align="center"> <?php echo TABLE_HEADING_ACTION; ?> </td>
		  </tr>
		  <tr>
			<td colspan="4"><?php echo tep_black_line(); ?></td>
		  </tr>
<?php
$next_id = 1;
$rows = 0;
$values = tep_db_query($values);
while ($values_values = tep_db_fetch_array($values)) {
  $options_name = tep_options_name($values_values['products_options_id']);
  $values_name = $values_values['products_options_values_name'];
  $rows++;
?>
		  <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
<?php
  if (($action == 'update_option_value') && ($HTTP_GET_VARS['value_id'] == $values_values['products_options_values_id'])) {
	echo '<form name="values" action="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=update_value', 'NONSSL') . '" method="post">';
	$inputs = '';
	for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {
	  $value_name = tep_db_query("select products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int)$values_values['products_options_values_id'] . "' and language_id = '" . (int)$languages[$i]['id'] . "'");
	  $value_name = tep_db_fetch_array($value_name);
	  $inputs .= $languages[$i]['code'] . ': <input type="text" name="value_name[' . $languages[$i]['id'] . ']" size="15" value="' . $value_name['products_options_values_name'] . '"> <br>';
	}
?>
			<td align="center" class="smallText"> <?php echo $values_values['products_options_values_id']; ?><input type="hidden" name="value_id" value="<?php echo $values_values['products_options_values_id']; ?>"> </td>
			<td align="center" class="smallText"> <?php echo "\n"; ?><select name="option_id">
<?php
	$options = tep_db_query("select products_options_id, products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . (int)$languages_id . "' order by products_options_name");
	while ($options_values = tep_db_fetch_array($options)) {
	  echo "\n" . '<option name="' . $options_values['products_options_name'] . '" value="' . $options_values['products_options_id'] . '"';
	  if ($values_values['products_options_id'] == $options_values['products_options_id']) { 
		echo ' selected';
	  }
	  echo '>' . $options_values['products_options_name'] . '</option>';
	} 
?>
			</select> </td>
			<td class="smallText"><?php echo $inputs; ?></td>
			<td align="center" class="smallText"> <?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE); ?> <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, '', 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', IMAGE_CANCEL); ?></a> </td>
<?php
	echo '</form>';
  } else {
?>
			<td align="center" class="smallText"> <?php echo $values_values["products_options_values_id"]; ?> </td>
			<td align="center" class="smallText"> <?php echo $options_name; ?> </td>
			<td class="smallText"> <?php echo $values_name; ?> </td>
			<td align="center" class="smallText"> <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=update_option_value&value_id=' . $values_values['products_options_values_id'] . (isset($HTTP_GET_VARS['value_page']) ? '&value_page=' . $HTTP_GET_VARS['value_page'] : ''), 'NONSSL') . '">'; ?><?php echo tep_image_button('button_edit.gif', IMAGE_UPDATE); ?></a>  <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=delete_option_value&value_id=' . $values_values['products_options_values_id'], 'NONSSL') , '">'; ?><?php echo tep_image_button('button_delete.gif', IMAGE_DELETE); ?></a> </td>
<?php
  }
  $max_values_id_query = tep_db_query("select max(products_options_values_id) + 1 as next_id from " . TABLE_PRODUCTS_OPTIONS_VALUES);
  $max_values_id_values = tep_db_fetch_array($max_values_id_query);
  $next_id = $max_values_id_values['next_id'];
}
?>
		  </tr>
		  <tr>
			<td colspan="4"><?php echo tep_black_line(); ?></td>
		  </tr>
<?php
if ($action != 'update_option_value') {
?>
		  <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
<?php
   echo '<form name="values" action="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=add_product_option_values&value_page=' . $value_page, 'NONSSL') . '" method="post">';
?>
			<td align="center" class="smallText"> <?php echo $next_id; ?> </td>
			<td align="center" class="smallText"> <select name="option_id">
<?php
  $options = tep_db_query("select products_options_id, products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . $languages_id . "' order by products_options_name");
  while ($options_values = tep_db_fetch_array($options)) {
	echo '<option name="' . $options_values['products_options_name'] . '" value="' . $options_values['products_options_id'] . '">' . $options_values['products_options_name'] . '</option>';
  }

  $inputs = '';
  for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {
	$inputs .= $languages[$i]['code'] . ': <input type="text" name="value_name[' . $languages[$i]['id'] . ']" size="15"> <br>';
  }
?>
			</select> </td>
			<td class="smallText"><input type="hidden" name="value_id" value="<?php echo $next_id; ?>"><?php echo $inputs; ?></td>
			<td align="center" class="smallText"> <?php echo tep_image_submit('button_insert.gif', IMAGE_INSERT); ?> </td>
<?php
  echo '</form>';
?>
		  </tr>
		  <tr>
			<td colspan="4"><?php echo tep_black_line(); ?></td>
		  </tr>
<?php
}
 }
?>
		</table></td>
	  </tr>
	</table></td>
<!-- option value eof //-->
  </tr> 
<?php
// BOF Super Download Shop v1.0 mod
 if (DOWNLOAD_ENABLED == 'true' && DOWNLOADS_CONTROLLER_FILEGROUP_STATUS == 'Yes') {
require('includes/group_download.php');
 }
// EOF Super Download Shop v1.0 mod
?>
<!-- products_attributes //-->  
  <tr>
	<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"> <?php echo HEADING_TITLE_ATRIB; ?> </td>
		<td> <?php echo tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', '', '1', '53'); ?> </td>
	  </tr>
	</table></td>
  </tr>
  <tr>
<?php
 if ($action == 'update_attribute') {
$form_action = 'update_product_attribute';
 } else {
$form_action = 'add_product_attributes';
 }
 if (!isset($attribute_page)) {
$attribute_page = 1;
 }
 $prev_attribute_page = $attribute_page - 1;
 $next_attribute_page = $attribute_page + 1;
?>
	<td><form name="attributes" action="<?php echo tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=' . $form_action . '&option_page=' . $option_page . '&value_page=' . $value_page . '&attribute_page=' . $attribute_page); ?>" method="post"><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td colspan="7" class="smallText">
<?php
 $per_page = MAX_ROW_LISTS_OPTIONS;
 $attributes = "select pa.* from " . TABLE_PRODUCTS_ATTRIBUTES . " pa left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on pa.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by pd.products_name";
 $attribute_query = tep_db_query($attributes);

 $attribute_page_start = ($per_page * $attribute_page) - $per_page;
 $num_rows = tep_db_num_rows($attribute_query);

 if ($num_rows <= $per_page) {
 $num_pages = 1;
 } else if (($num_rows % $per_page) == 0) {
 $num_pages = ($num_rows / $per_page);
 } else {
 $num_pages = ($num_rows / $per_page) + 1;
 }
 $num_pages = (int) $num_pages;

 $attributes = $attributes . " LIMIT $attribute_page_start, $per_page";

 // Previous
 if ($prev_attribute_page) {
echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'attribute_page=' . $prev_attribute_page) . '"> << </a> | ';
 }

 for ($i = 1; $i <= $num_pages; $i++) {
if ($i != $attribute_page) {
  echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'attribute_page=' . $i) . '">' . $i . '</a> | ';
} else {
  echo '<b><font color="red">' . $i . '</font></b> | ';
}
 }

 // Next
 if ($attribute_page != $num_pages) {
echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'attribute_page=' . $next_attribute_page) . '"> >> </a>';
 }
?>
		</td>
	  </tr>
	</table>
	<form name="attributes" action="<?php echo tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=' . $form_action . '&' . $page_info); ?>" method="post"><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td colspan="7"><?php echo tep_black_line(); ?></td>
	  </tr>
	  <tr class="dataTableHeadingRow">
		<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_ID; ?> </td>
		<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_PRODUCT; ?> </td>
		<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_NAME; ?> </td>
		<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_VALUE; ?> </td>
		<td class="dataTableHeadingContent" align="right"> <?php echo TABLE_HEADING_OPT_PRICE; ?> </td>
		<td class="dataTableHeadingContent" align="center"> <?php echo TABLE_HEADING_OPT_PRICE_PREFIX; ?> </td>

<?php // >>>> BOF Linkmatics attributes plus edit - added next line to add sort order column ?>
		 <td class="dataTableHeadingContent" align="center"> <?php echo TABLE_HEADING_OPT_SORT_ORDER; ?> </td>
		<td class="dataTableHeadingContent" align="center"> <?php echo TABLE_HEADING_ACTION; ?> </td>
	  </tr>
	  <tr>
<?php // >>>> EOF Linkmatics attributes plus edit ?>

		<td class="dataTableHeadingContent" align="center"> <?php echo TABLE_HEADING_ACTION; ?> </td>
	  </tr>
	  <tr>
		<td colspan="8"><?php echo tep_black_line(); ?></td>
	  </tr>
<?php
 $next_id = 1;
 $attributes = tep_db_query($attributes);
 while ($attributes_values = tep_db_fetch_array($attributes)) {
$products_name_only = tep_get_products_name($attributes_values['products_id']);
$options_name = tep_options_name($attributes_values['options_id']);
$values_name = tep_values_name($attributes_values['options_values_id']);
$rows++;
?>
	  <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
<?php
if (($action == 'update_attribute') && ($HTTP_GET_VARS['attribute_id'] == $attributes_values['products_attributes_id'])) {
?>
		<td class="smallText"> <?php echo $attributes_values['products_attributes_id']; ?><input type="hidden" name="attribute_id" value="<?php echo $attributes_values['products_attributes_id']; ?>"> </td>
		<td class="smallText"> <select name="products_id">
<?php
  $products = tep_db_query("select p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "' order by pd.products_name");
  while($products_values = tep_db_fetch_array($products)) {
	if ($attributes_values['products_id'] == $products_values['products_id']) {
	  echo "\n" . '<option name="' . $products_values['products_name'] . '" value="' . $products_values['products_id'] . '" SELECTED>' . $products_values['products_name'] . '</option>';
	} else {
	  echo "\n" . '<option name="' . $products_values['products_name'] . '" value="' . $products_values['products_id'] . '">' . $products_values['products_name'] . '</option>';
	}
  } 
?>
		</select> </td>
		<td class="smallText"> <select name="options_id">
<?php
  $options = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . $languages_id . "' order by products_options_name");
  while($options_values = tep_db_fetch_array($options)) {
	if ($attributes_values['options_id'] == $options_values['products_options_id']) {
	  echo "\n" . '<option name="' . $options_values['products_options_name'] . '" value="' . $options_values['products_options_id'] . '" SELECTED>' . $options_values['products_options_name'] . '</option>';
	} else {
	  echo "\n" . '<option name="' . $options_values['products_options_name'] . '" value="' . $options_values['products_options_id'] . '">' . $options_values['products_options_name'] . '</option>';
	}
  } 
?>
		</select> </td>
		<td class="smallText"> <select name="values_id">
<?php
  $values = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where language_id ='" . $languages_id . "' order by products_options_values_name");
  while($values_values = tep_db_fetch_array($values)) {
	if ($attributes_values['options_values_id'] == $values_values['products_options_values_id']) {
	  echo "\n" . '<option name="' . $values_values['products_options_values_name'] . '" value="' . $values_values['products_options_values_id'] . '" SELECTED>' . $values_values['products_options_values_name'] . '</option>';
	} else {
	  echo "\n" . '<option name="' . $values_values['products_options_values_name'] . '" value="' . $values_values['products_options_values_id'] . '">' . $values_values['products_options_values_name'] . '</option>';
	}
  } 
?>		
		</select> </td>
		<td align="right" class="smallText"> <input type="text" name="value_price" value="<?php echo $attributes_values['options_values_price']; ?>" size="6"> </td>
		<td align="center" class="smallText"> <input type="text" name="price_prefix" value="<?php echo $attributes_values['price_prefix']; ?>" size="2"> </td>
		<td align="center" class="smallText"> <?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE); ?> <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', IMAGE_CANCEL); ?></a> </td>
<?php
  if (DOWNLOAD_ENABLED == 'true') {
// BOF Super Download Shop v1.0 mod
	if (DOWNLOADS_CONTROLLER_FILEGROUP_STATUS == 'Yes') {
	  $download_query_raw ="select products_attributes_filename, products_attributes_filegroup_id, products_attributes_maxdays, products_attributes_maxcount 
							from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " 
							where products_attributes_id='" . $attributes_values['products_attributes_id'] . "'";
	  $download_query = tep_db_query($download_query_raw);
	  if (tep_db_num_rows($download_query) > 0) {
		$download = tep_db_fetch_array($download_query);
		$products_attributes_filename = $download['products_attributes_filename'];
		$products_attributes_filegroup_id = $download['products_attributes_filegroup_id'];
		$products_attributes_maxdays  = $download['products_attributes_maxdays'];
		$products_attributes_maxcount = $download['products_attributes_maxcount'];
	  }
	} else {
// EOF Super Download Shop v1.0 mod
	$download_query_raw ="select products_attributes_filename, products_attributes_maxdays, products_attributes_maxcount 
						  from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " 
						  where products_attributes_id='" . $attributes_values['products_attributes_id'] . "'";
	$download_query = tep_db_query($download_query_raw);
	if (tep_db_num_rows($download_query) > 0) {
	  $download = tep_db_fetch_array($download_query);
	  $products_attributes_filename = $download['products_attributes_filename'];
	  $products_attributes_maxdays  = $download['products_attributes_maxdays'];
	  $products_attributes_maxcount = $download['products_attributes_maxcount'];
	}
// BOF Super Download Shop v1.0 mod
	}
// EOF Super Download Shop v1.0 mod
?>
	  <tr class="<?php echo (!($rows % 2)? 'attributes-even' : 'attributes-odd');?>">
		<td> </td>
		<td colspan="5">
		  <table>
			<tr class="<?php echo (!($rows % 2)? 'attributes-even' : 'attributes-odd');?>">
<?php
// BOF AlexStusio mod
?>
			  <td class="smallText"><b><?php echo TABLE_HEADING_DOWNLOAD; ?> </b></td>
			  <td class="smallText"><?php echo TABLE_TEXT_FILENAME; ?></td>
			  <td class="smallText"><?php echo tep_draw_input_field('products_attributes_filename', $products_attributes_filename, 'size="15"'); ?> </td>
			  <td class="smallText"><?php echo TABLE_TEXT_MAX_DAYS; ?></td>
			  <td class="smallText"><?php echo tep_draw_input_field('products_attributes_maxdays', $products_attributes_maxdays, 'size="5"'); ?> </td>
			  <td class="smallText"><?php echo TABLE_TEXT_MAX_COUNT; ?></td>
			  <td class="smallText"><?php echo tep_draw_input_field('products_attributes_maxcount', $products_attributes_maxcount, 'size="5"'); ?> </td>
			</tr>
<?php
	if ( DOWNLOADS_CONTROLLER_FILEGROUP_STATUS == 'Yes' ) {
?>
			<tr class="<?php echo (!($rows % 2)? 'attributes-even' : 'attributes-odd');?>">
			  <td class="smallText"></td>
			  <td class="smallText"><?php echo TABLE_TEXT_FILEGROUP; ?></td>
			  <td class="smallText"> <select name="filegroup_id">
<?php
	  $file_groups_query = tep_db_query("select * from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS . " where language_id = '" . $languages_id . "' order by download_group_id");
	  while ($file_groups = tep_db_fetch_array($file_groups_query)) {
		if ($file_groups['download_group_id'] == $products_attributes_filegroup_id) {
		  echo "\n" . '<option name="' . TEXT_OPTION_FILEGROUP . '" value="' . $file_groups['download_group_id'] . '" SELECTED>' . $file_groups['download_group_name'] . '</option>';
		} else {
		  echo "\n" . '<option name="' . TEXT_OPTION_FILEGROUP . '" value="' . $file_groups['download_group_id'] . '">' . $file_groups['download_group_name'] . '</option>';
		}
	  } 
?>
			  </select> </td>
			</tr>
<?php
	}
// EOF Super Download Shop v1.0 mod
?>
		  </table>
		</td>
		<td> </td>
	  </tr>
<?php
  }
?>
<?php
} elseif (($action == 'delete_product_attribute') && ($HTTP_GET_VARS['attribute_id'] == $attributes_values['products_attributes_id'])) {
?>
		<td class="smallText"> <b><?php echo $attributes_values["products_attributes_id"]; ?></b> </td>
		<td class="smallText"> <b><?php echo $products_name_only; ?></b> </td>
		<td class="smallText"> <b><?php echo $options_name; ?></b> </td>
		<td class="smallText"> <b><?php echo $values_name; ?></b> </td>
		<td align="right" class="smallText"> <b><?php echo $attributes_values["options_values_price"]; ?></b> </td>
		<td align="center" class="smallText"> <b><?php echo $attributes_values["price_prefix"]; ?></b> </td>

<?php // >>>> BOF <<<< EOF Linkmatics attributes sets plus edit - added next line to add sort order column ?>
			 		<td align="center" class="smallText"> <b><?php echo $attributes_values["sort_order"]; ?></b> </td>

		<td align="center" class="smallText"> <b><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=delete_attribute&attribute_id=' . $HTTP_GET_VARS['attribute_id'] . '&' . $page_info) . '">'; ?><?php echo tep_image_button('button_confirm.gif', IMAGE_CONFIRM); ?></a>  <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', IMAGE_CANCEL); ?></a> </b></td>
<?php
} else {
?>
		<td class="smallText"> <?php echo $attributes_values["products_attributes_id"]; ?> </td>
		<td class="smallText"> <?php echo $products_name_only; ?> </td>
		<td class="smallText"> <?php echo $options_name; ?> </td>
		<td class="smallText"> <?php echo $values_name; ?> </td>
		<td align="right" class="smallText"> <?php echo $attributes_values["options_values_price"]; ?> </td>
		<td align="center" class="smallText"> <?php echo $attributes_values["price_prefix"]; ?> </td>

<?php // >>>> BOF <<<< EOF Linkmatics attributes sets plus edit - added next line to add sort order column ?>
			 		<td align="center" class="smallText"> <?php echo $attributes_values["sort_order"]; ?> </td>

		<td align="center" class="smallText"> <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=update_attribute&attribute_id=' . $attributes_values['products_attributes_id'] . '&' . $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_edit.gif', IMAGE_UPDATE); ?></a>  <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=delete_product_attribute&attribute_id=' . $attributes_values['products_attributes_id'] . '&' . $page_info, 'NONSSL') , '">'; ?><?php echo tep_image_button('button_delete.gif', IMAGE_DELETE); ?></a> </td>
<?php
}
$max_attributes_id_query = tep_db_query("select max(products_attributes_id) + 1 as next_id from " . TABLE_PRODUCTS_ATTRIBUTES);
$max_attributes_id_values = tep_db_fetch_array($max_attributes_id_query);
$next_id = $max_attributes_id_values['next_id'];
?>
	  </tr>
<?php
 }
 if ($action != 'update_attribute') {
?>
	  <tr>
		<td colspan="8"><?php echo tep_black_line(); ?></td>
	  </tr>
	  <tr class="<?php echo (floor($rows/2) == ($rows/2) ? 'attributes-even' : 'attributes-odd'); ?>">
		<td class="smallText"> <?php echo $next_id; ?> </td>
		  <td class="smallText"> <select name="products_id">
<?php
$products = tep_db_query("select p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "' order by pd.products_name");
while ($products_values = tep_db_fetch_array($products)) {
  echo '<option name="' . $products_values['products_name'] . '" value="' . $products_values['products_id'] . '">' . $products_values['products_name'] . '</option>';
} 
?>
		</select> </td>
		<td class="smallText"> <select name="options_id">
<?php
$options = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . $languages_id . "' order by products_options_name");
while ($options_values = tep_db_fetch_array($options)) {
  echo '<option name="' . $options_values['products_options_name'] . '" value="' . $options_values['products_options_id'] . '">' . $options_values['products_options_name'] . '</option>';
} 
?>
		</select> </td>
		<td class="smallText"> <select name="values_id">
<?php
$values = tep_db_query("select * from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where language_id = '" . $languages_id . "' order by products_options_values_name");
while ($values_values = tep_db_fetch_array($values)) {
  echo '<option name="' . $values_values['products_options_values_name'] . '" value="' . $values_values['products_options_values_id'] . '">' . $values_values['products_options_values_name'] . '</option>';
} 
?>
		</select> </td>
		<td align="right" class="smallText"> <input type="text" name="value_price" size="6"> </td>
		<td align="right" class="smallText"> <input type="text" name="price_prefix" size="2" value="+"> </td>

<?php // >>>> BOF <<<< EOF Linkmatics attributes sets plus edit - added next line to add sort order column ?>			
			 		<td align="right" class="smallText"> <input type="text" name="sort_order" size="3" value="0"> </td>

		<td align="center" class="smallText"> <?php echo tep_image_submit('button_insert.gif', IMAGE_INSERT); ?> </td>
	  </tr>
<?php
  if (DOWNLOAD_ENABLED == 'true') {
	$products_attributes_maxdays  = DOWNLOAD_MAX_DAYS;
	$products_attributes_maxcount = DOWNLOAD_MAX_COUNT;
?>
	  <tr class="<?php echo (!($rows % 2)? 'attributes-even' : 'attributes-odd');?>">
		<td> </td>
		<td colspan="5">
		  <table>
<?php
// BOF AlexStusio mod
?>
			  <td class="smallText"><b><?php echo TABLE_HEADING_DOWNLOAD; ?> </b></td>
			  <td class="smallText"><?php echo TABLE_TEXT_FILENAME; ?></td>
			  <td class="smallText"><?php echo tep_draw_input_field('products_attributes_filename', $products_attributes_filename, 'size="15"'); ?> </td>
			  <td class="smallText"><?php echo TABLE_TEXT_MAX_DAYS; ?></td>
			  <td class="smallText"><?php echo tep_draw_input_field('products_attributes_maxdays', $products_attributes_maxdays, 'size="5"'); ?> </td>
			  <td class="smallText"><?php echo TABLE_TEXT_MAX_COUNT; ?></td>
			  <td class="smallText"><?php echo tep_draw_input_field('products_attributes_maxcount', $products_attributes_maxcount, 'size="5"'); ?> </td>
			</tr>
<?php
	if ( DOWNLOADS_CONTROLLER_FILEGROUP_STATUS == 'Yes' ) {
?>
			<tr class="<?php echo (!($rows % 2)? 'attributes-even' : 'attributes-odd');?>">
			  <td class="smallText"></td>
			  <td class="smallText"><?php echo TABLE_TEXT_FILEGROUP; ?></td>
			  <td class="smallText"> <select name="filegroup_id">
<?php
	  $file_groups_query = tep_db_query("select * from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD_GROUPS . " where language_id = '" . (int)$languages_id . "' order by download_group_id");
	  while ($file_groups = tep_db_fetch_array($file_groups_query)) {
		echo '<option name="' . TEXT_OPTION_FILEGROUP . '" value="' . $file_groups['download_group_id'] . '">' . $file_groups['download_group_name'] . '</option>';
	  } 
?>
			  </select> </td>
			</tr>
<?php
	}
// EOF Super Download Shop v1.0 mod
?>
		  </table>
		</td>
		<td> </td>
	  </tr>
<?php
  } // end of DOWNLOAD_ENABLED section
?>
<?php
 }
?>
	  <tr>
		<td colspan="8"><?php echo tep_black_line(); ?></td>
	  </tr>
	</table></form></td>
  </tr>
</table></td>
<!-- products_attributes_eof //-->
 </tr>
</table>
<!-- body_text_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

I am going to BEG for help in a second.. I just tried doing a merge of the attributes SETS and the downloads contribution pages for product_attributes, and i just dont know what to do... sort of uninstalling the downloads controller, i have NO CLUE what to do

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

Ok, if anyone has any comments on this issue, i would be forever greatful!!! You have no idea how much stress this is causing..

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

Ok, if anyone has any comments on this issue, i would be forever greatful!!! You have no idea how much stress this is causing..

 

When you're dreaming that your kitties face is melting, things are pretty bad. *patting Lindsay's head*

Link to comment
Share on other sites

okay, so the attributes aren't showing in the product page? Or is it that it's not coming through to the shopping cart? I'm confused on the page 1 page 2 thing.

Link to comment
Share on other sites

when you are on your admin side in the attributes section, you have three basic fields, the attribute , option value, and then the place where you tell which product goes to which attriibute.

 

So if you look at the option value (where you tell what TYPE of attribute it is.. so i have PRINT SIZE then 4 x 6 would be the option value) If i create more than 10 or so option values, it puts them on a second page (split results). It even shows the second page at the heading of the option value box.. page 1 is in red because that is the page i am on, and page two is black, becuase i am not there yet.. If i click on page 2 the url in my browser shows page=2 but i never actually see the second page!!! it stays on the first and page 1 is still red.. so i can not see the second page of attribute options .. EVER

 

then, if i go to the regular attributes (print size, digital files, ect) and i want to delete one, i can't. Nothing happens except that box goes blank..

 

THEN.. i have attributes sets install, and if i go there, i and i create a new set, it doesnt show ALL of the attribute values.. just some of them.. which means the list is not updating.. THAT i can live without, but i NEED NEED NEED to be able to see the second field of attributes options!!!

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

I get it now. I could ruminate for an hour, but the answer will still be the same....I don't have a clue. Hopefully the coders-manifique will show here soon.

Link to comment
Share on other sites

I am hoping so.. I did a comparisson last night between the contribution file for attributes sets and super download store because those are the two contrbutions that were isntalled that messed with the products_attributes.php page.

 

When i did a compare, there is a difference in the code where it defines the page split, but that code was right dead center of the download store code, meaning that code for the page split was probably written by the person who did the download store?? I'm not sure.. But it just seems like both are saying the same thing in a different way. I tried to copy the line frolm the attributes set and replace it with the downloads store code, but that gave me a bunch of unexpected $end or t_string errprs

 

 

anyways, i BELIEVE this might be the offending code as far as page two not showing on option values, but someone correct me if i am wrong:

 

 $per_page = MAX_ROW_LISTS_OPTIONS;
$options = "select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . (int)$languages_id . "' order by " . $option_order_by;
if (!isset($option_page)) {
  $option_page = 1;
}
$prev_option_page = $option_page - 1;
$next_option_page = $option_page + 1;

$option_query = tep_db_query($options);

$option_page_start = ($per_page * $option_page) - $per_page;
$num_rows = tep_db_num_rows($option_query);

if ($num_rows <= $per_page) {
  $num_pages = 1;
} else if (($num_rows % $per_page) == 0) {
  $num_pages = ($num_rows / $per_page);
} else {
  $num_pages = ($num_rows / $per_page) + 1;
}
$num_pages = (int) $num_pages;

$options = $options . " LIMIT $option_page_start, $per_page";

// Previous
if ($prev_option_page)  {
  echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'option_page=' . $prev_option_page) . '"> << </a> | ';
}

for ($i = 1; $i <= $num_pages; $i++) {
  if ($i != $option_page) {
	echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'option_page=' . $i) . '">' . $i . '</a> | ';
  } else {
	echo '<b><font color=red>' . $i . '</font></b> | ';
  }
}

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

I havent read through this thread, but I`m assuming that your problem is due the bug that stops the split page function working on the atributes page, I believe there is a bug fix somewhere, but cant recall where I saw it, my 'workaround' was to add a define at the start of the file.

 

The split works on 'MAX_ROW_LISTS_OPTIONS' but this constant is not set anywhere in admin so put

 

define('MAX_ROW_LISTS_OPTIONS', 99);

 

at the start of file and your split is set to 99.

 

Though in some versions its set in languages/products_attributes.php, so check there first.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Spooks, thanks for the help.. but unfortunately that did not fix my problem. The page is successfully splitting the attributes, but the link to the former pages do not go anywhere.

 

I can see that there are now 3 pages, but i can not click on any of those pages to get anywhere. The weirdest thing is that the url shows page=2 or page=3 when i click on pages 2 and 3.. it just does not change which attributes are shown

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

The 'fix' does not stop the pagination error, the idea is to set a value so that pagination does not occur (you get long lists) so avoiding the problem.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

hmmm i didnt get the long lists either.. i posted the EXACT code directly under the require(application_top.php);

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

OOPS.. i put it before application_top and now i'm good.. THANKS sam. A work around is ok for now for me..

 

I still have two more errors though.. i can not delete anything in the products options, it just makes that box blank, and the attributes sets never shows the newly added option values.

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

OOPS.. i put it before application_top and now i'm good.. THANKS sam. A work around is ok for now for me..

 

I still have two more errors though.. i can not delete anything in the products options, it just makes that box blank, and the attributes sets never shows the newly added option values.

 

The original guy who coded this still hasn't gotton back to you?

Link to comment
Share on other sites

nope.. well, kinda.. I will pm that story to you.. Dont wanna air someones dirty laundry.. i'm just happy that it is overall working for now..

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

I still have two more errors though.. i can not delete anything in the products options, it just makes that box blank, and the attributes sets never shows the newly added option values.

 

linsay, are you becoming a help vampire? just kidding!

 

i noticed some differences between your version of products_attributes and mine. up at the top of yours, starting on line 19 you have:

	$page_info = '';
if (isset($HTTP_GET_VARS['option_page'])) $page_info .= 'option_page=' . $HTTP_GET_VARS['option_page'] . '&';
if (isset($HTTP_GET_VARS['value_page'])) $page_info .= 'value_page=' . $HTTP_GET_VARS['value_page'] . '&';
if (isset($HTTP_GET_VARS['attribute_page'])) $page_info .= 'attribute_page=' . $HTTP_GET_VARS['attribute_page'] . '&';
// BOF Super Download Shop v1.0 mod
if (isset($HTTP_GET_VARS['file_group_page'])) $page_info .= 'file_group_page=' . $HTTP_GET_VARS['file_group_page'] . '&';
if (isset($HTTP_GET_VARS['group_file_page'])) $page_info .= 'group_file_page=' . $HTTP_GET_VARS['group_file_page'] . '&';
// EOF Super Download Shop v1.0 mod
if (tep_not_null($page_info)) {
  $page_info = substr($page_info, 0, -1);
}

 

and i have

  $option_page = (isset($HTTP_GET_VARS['option_page']) && is_numeric($HTTP_GET_VARS['option_page'])) ? $HTTP_GET_VARS['option_page'] : 1;
 $value_page = (isset($HTTP_GET_VARS['value_page']) && is_numeric($HTTP_GET_VARS['value_page'])) ? $HTTP_GET_VARS['value_page'] : 1;
 $attribute_page = (isset($HTTP_GET_VARS['attribute_page']) && is_numeric($HTTP_GET_VARS['attribute_page'])) ? $HTTP_GET_VARS['attribute_page'] : 1;
 // BOF superdownload
 $file_group_page = (isset($HTTP_GET_VARS['file_group_page']) && is_numeric($HTTP_GET_VARS['file_group_page'])) ? $HTTP_GET_VARS['file_group_page'] : 1;
 $group_file_page = (isset($HTTP_GET_VARS['group_file_page']) && is_numeric($HTTP_GET_VARS['group_file_page'])) ? $HTTP_GET_VARS['group_file_page'] : 1;
 $order_by = (isset($HTTP_GET_VARS['order_by']) && is_string($HTTP_GET_VARS['order_by'])) ? $HTTP_GET_VARS['order_by'] : '';
 // EOF superdownload

 $page_info = 'option_page=' . $option_page . '&value_page=' . $value_page . '&attribute_page=' . $attribute_page .
'&file_group_page=' . $file_group_page . '&group_file_page=' . $group_file_page . '&order_by' . $order_by;

 

the difference is that you're not setting the variables like 'file_group_page', etc. to a value .. unless they have a value as part of the get variables. (i know, that was perfectly clear, wasn't it...). the code i'm using ends up defaulting these variables to a value of 1 if they're not set, and takes the passed value if they are. a small, yet significant difference. the first time you enter this page, your $page_info will be empty, whereas mine is filled with '1's.

 

i don't know if this is going to fix your situation. i didn't take a close look further down on how this is being used. but i do know that the $page_info variable is used in a lot of the links built on this page, so it's possible it's having an effect. without having those default values, it may be getting confused in keeping track of what it's doing.

 

i hope this helps.

Link to comment
Share on other sites

i am NOT a help vampire.. I am just someone who is cramming too much stuff to do in one day!! atleast i dont ask people to do every step for me.. I do my research, i have gotten my self half way there... I just have too many questions because of this damn mess up. (that wasnt technically my fault, but i cant go into that on the public forum)

 

Which release of the download store did you use?? maybe i downloaded one that was a little older and needs a quick update..

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

i am NOT a help vampire..

 

i know.... and i said i was kidding! ;) besides, you offer help to others, so by definition you are not a help vampire.

 

Which release of the download store did you use?? maybe i downloaded one that was a little older and needs a quick update..

 

you expect me to remember details like that? (still kidding, by the way....) i'm very sorry, but i don't recall. that's why i always mark the changes i make and i'm very happy to see that you do the same. a highly recommended practice!

 

i should probably mark my changes with the date and version of the contribution as well to help jog my memory when needed. and there may very well have been newer releases of the contribution since the time i put mine in. dates and versions would help in figuring that out. keeping track of all the releases of all the contributions is almost a full time job.

 

i simply noticed that the method your code uses to build the $page_info variable is different in what could be a significant way from the way my code is doing things. and it's also possible that differences are a result of me coming up with a better (or at least different) way of doing things when i implemented the version of the contribution that i did. again, keeping track of things...full time job and all that.

 

take my comments or leave them, it's all fine.... :) i'm just trying to help by pointing out the things i see. and if they're helpful in some small way great! and if i lead you on a wild goose chase you have my sincere apologies in advance.

Link to comment
Share on other sites

i know you were kidding.. i had to clarify for those who do not know how to pickup on sarcasm through the computer.. I do try as HARD as i can to help others.. I figure if i pick up all the little crappy questions that are always the same, then the others can get more important things answered..

 

I also ALWAYS mark the changes and dont usuallt delete parts of code unless i need to replace it.. id rather comment it out.. Using date and version would be REALLY helpfull too.. i thoguht about adding the contribution tracker too.. it lets you know when a contribution that you have used had an update.

 

I will probably work on what you told me AFTER the weekend.. see, the thing is.. we did a photoshoot last weekend, and told peopel their pictures would be available to purchase prints from our website on FRIDAY.. so since this work around is working ok for now, i will be using it until most of those orders are done and through.. then i can go ahead and change things.

 

I still need to uninstall that stupid customer required fields contribution.. that still pisses me off.. Its not putting the customers details int he shipping and billing on checkout~ but thats another story.. i just need time to do that.. i should be FINE

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

Wow. I was wondering about this a few weeks ago and could not find anything. I ended up just hacking this through myphpadmin. It worked ok but it took a while for me to wrap my head around the database and how it works. That might be something you can do to just get it working.

Link to comment
Share on other sites

i have no idea what you are talking about..

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

Can you access the osc database somehow? If so, you can manipulate the fields in the orders_product_attribute etc tables to get this done. I have 11 pages that I can not access however I was able to do what I needed directly in the DB. I know it is not the best way to do it but if you are in a pinch it might be something you can do that will get what you need done today.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...