Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product Attributes Sort Order v1.6


Guest

Recommended Posts

My client has hundreds of attributes to add, and the (Product Attributes Sort Order v1.6 Contribution: http://addons.oscommerce.com/info/1822) works great, with one major problem.

 

According to the SQL statement, the initial entry is set to "0" which means every entry has to be tagged twice. The first time to enter the Option and Value information and the defaulted "0". Then a second time to change the default sort order from "0" to the actual order it should actually be. When the required sort order is added initially, it's overidden by the "0".

 

ALTER TABLE products_attributes ADD COLUMN attribute_sort INT UNSIGNED NOT NULL DEFAULT '0';

 

This is a show stopper for my client because with 444 pages to search through, it's no longer time effective to keep touching each new entry twice.

 

I've installed this clone tool http://addons.oscommerce.com/info/4550 which saves a tremendous amount of time by copying one entry to many at one time, so they no longer have to worry about copying the change to subsequent entries.

 

Unfortunately, I can't find any way to get around this Sort Order issue and any help would be greatly appreciated.

Edited by raymondburns
Link to comment
Share on other sites

if you are good with database's then pull what you need down and do mass edit in excel then re upload but ony do this if you now a lot about mysql?

 

I'm not so good with DB's, I can read through a query to figure out what it's doing, same with php coding, but not so good with writing stuff from scratch. I actually installed this contrib to edit the DB in Excel: Easy Populate & Products Attributes http://addons.oscommerce.com/info/500

 

The Easy Populate Contrib works great for everything except the Attributes. At least not with with the contrib I installed for the attributes that allows you to install dropdowns/radio buttons/text fields etc. With all of these tweaks the .csv file is a bit messy to decipher.

 

I'm sure my client would be willing to pay anyone to fix this for them, if no one can figure out an easy fix they'd be willing to share.

Edited by raymondburns
Link to comment
Share on other sites

Well after looking through all the other posts requesting assistance, the one's looking to pay for help seem to be ignored. And the one's with pasted code are assisted, so I'm pasting away.

 

This seems like it should be pretty straight forward, you should be able to simply add a sort order number and it gets loaded into the db when "Insert" is selected. But for some reason everything else gets inserted fine except for the Sort Number? It changes fine with no problems using the "Edit" button. But the problem is that it takes forever to Insert a new entry, then to search through a hundred pages to find the new entry to change the sort order. Please help!

 

Sort Attribute Screenshot

 

SQL Query for MySQL - 4.1.22:

ALTER TABLE `products_attributes` ADD `sort_order` INT DEFAULT '50' NOT NULL;

ALTER TABLE products_attributes ADD COLUMN attribute_sort INT UNSIGNED NOT NULL DEFAULT '0';

 

Add the new lines before ?>

 

catalog/admin/includes/functions/general.php

function tep_attributes_sort($attributes_id) {

global $languages_id;

 

$attributes_sort = tep_db_query("select attribute_sort from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_attributes_id = '" . (int)$attributes_id . "'");

$attributes_sort_values = tep_db_fetch_array($attributes_sort);

 

return $attributes_sort_values['attribute_sort'];

}

 

 

admin/products_attributes.php

<?php

/*

$Id: products_attributes.php,v 1.52 2003/07/10 20:46:01 dgw_ Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 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'] : '');

 

$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;

 

$page_info = 'option_page=' . $option_page . '&value_page=' . $value_page . '&attribute_page=' . $attribute_page;

 

if (tep_not_null($action)) {

 

switch ($action) {

// BOF Multiple Product Attributes Clone

/*

case 'clone_attributes':

$clone_product_id_from = $HTTP_POST_VARS['clone_products_id_from'];

$clone_product_id_to = $HTTP_POST_VARS['clone_products_id_to'];

tep_db_query("delete from ".TABLE_PRODUCTS_ATTRIBUTES." WHERE products_id='".$clone_product_id_to."'");

$attributes = tep_db_query("select products_id, options_id, options_values_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES ." where products_id='".$clone_product_id_from."'");

 

while($attributes_values = tep_db_fetch_array($attributes)) {

 

tep_db_query("INSERT INTO " . TABLE_PRODUCTS_ATTRIBUTES . " ( products_id, options_id, options_values_id, options_values_price, price_prefix ) VALUES (".$clone_product_id_to.", ".$attributes_values['options_id'].", ".$attributes_values['options_values_id'].", ".$attributes_values['options_values_price'].", '".$attributes_values['price_prefix']."')");

 

}

break;

*/

case 'clone_attributes':

$multi_clone_products_id_to=$HTTP_POST_VARS['clone_products_id_to'];

for ($i=0;$i<sizeof($multi_clone_products_id_to);$i++) {

$clone_product_id_from = $HTTP_POST_VARS['clone_products_id_from'];

$clone_product_id_to = $multi_clone_products_id_to[$i];

tep_db_query("delete from ".TABLE_PRODUCTS_ATTRIBUTES." WHERE products_id='".$clone_product_id_to."'");

$attributes = tep_db_query("select products_id, options_id, options_values_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES ." where products_id='".$clone_product_id_from."'");

while($attributes_values = tep_db_fetch_array($attributes)) {

tep_db_query("INSERT INTO " . TABLE_PRODUCTS_ATTRIBUTES . " ( products_id, options_id, options_values_id, options_values_price, price_prefix ) VALUES (".$clone_product_id_to.", ".$attributes_values['options_id'].", ".$attributes_values['options_values_id'].", ".$attributes_values['options_values_price'].", '".$attributes_values['price_prefix']."')");

}

}

break;

 

// EOF Multiple Product Attributes Clone

 

 

 

case 'add_product_options':

$products_options_id = tep_db_prepare_input($HTTP_POST_VARS['products_options_id']);

// OTF contrib begins

//$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'] . "')");

 

$option_name_array = $HTTP_POST_VARS['option_name'];

$option_type = $HTTP_POST_VARS['option_type']; //clr 030714 update to add option type to products_option

$option_length = $HTTP_POST_VARS['option_length']; //clr 030714 update to add option length to products_option

 

for ($i=0, $n=sizeof($languages); $i<$n; $i ++) {

$option_name = tep_db_prepare_input($option_name_array[$languages[$i]['id']]);

$option_comment = $HTTP_POST_VARS['option_comment']; //clr 030714 update to add option comment to products_option

 

tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS . " (products_options_id, products_options_name, language_id, products_options_type, products_options_length, products_options_comment) values ('" . (int)$products_options_id . "', '" . tep_db_input($option_name) . "', '" . (int)$languages[$i]['id'] . "', '" . $option_type . "', '" . $option_length . "', '" . $option_comment[$languages[$i]['id']] . "')");

if($option_type != 0 && $option_type != 2){

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

}

// OTF contrib ends

}

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']);

$attributes_sort = tep_db_prepare_input($HTTP_POST_VARS['attributes_sort']);

 

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

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']);

 

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) . "')");

}

}

 

tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));

break;

case 'update_option_name':

// OTF contrib begins

//$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'] . "'");

//}

$option_name_array = $HTTP_POST_VARS['option_name'];

$option_type = $HTTP_POST_VARS['option_type']; //clr 030714 update to add option type to products_option

$option_length = $HTTP_POST_VARS['option_length']; //clr 030714 update to add option length to products_option

$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']]);

$option_comment = $HTTP_POST_VARS['option_comment']; //clr 030714 update to add option comment to products_option

 

tep_db_query("update " . TABLE_PRODUCTS_OPTIONS . " set products_options_name = '" . tep_db_input($option_name) . "', products_options_type = '" . $option_type . "', products_options_length = '" . $option_length . "', products_options_comment = '" . $option_comment[$languages[$i]['id']] . "' where products_options_id = '" . (int)$option_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'");

}

// OTF contrib ends

 

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']);

$attributes_sort = tep_db_prepare_input($HTTP_POST_VARS['attributes_sort']);

 

tep_db_query("update " . TABLE_PRODUCTS_ATTRIBUTES . " set products_id = '" . (int)$products_id . "', options_id = '" . (int)$options_id . "', options_values_id = '" . (int)$values_id . "', options_values_price = '" . (float)tep_db_input($value_price) . "', price_prefix = '" . tep_db_input($price_prefix) . "', attribute_sort = '" . (int)$attributes_sort . "' 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']);

 

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) . "'");

}

}

 

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;

}

}

// OTF contrib begins

//CLR 030312 add function to draw pulldown list of option types

// Draw a pulldown for Option Types

function draw_optiontype_pulldown($name, $default = '') {

$values = array();

$values[] = array('id' => 0, 'text' => 'Select');

$values[] = array('id' => 1, 'text' => 'Text');

$values[] = array('id' => 2, 'text' => 'Radio');

$values[] = array('id' => 3, 'text' => 'Checkbox');

$values[] = array('id' => 4, 'text' => 'Textarea');

return tep_draw_pull_down_menu($name, $values, $default);

}

 

//CLR 030312 add function to translate type_id to name

// Translate option_type_values to english string

function translate_type_to_name($opt_type) {

if ($opt_type == 0) return 'Select';

if ($opt_type == 1) return 'Text';

if ($opt_type == 2) return 'Radio';

if ($opt_type == 3) return 'Checkbox';

if ($opt_type == 4) return 'Textarea';

return 'Error ' . $opt_type;

}

// OTF contrib ends

?>

<!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">

</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>

</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, $page_info, '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_option&option_id=' . $HTTP_GET_VARS['option_id'] . '&' . $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_delete.gif', ' delete '); ?></a>   <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, '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" align="right">

<?php

$options = "select * from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . (int)$languages_id . "' order by products_options_id";

$options_split = new splitPageResults($option_page, MAX_ROW_LISTS_OPTIONS, $options, $options_query_numrows);

echo $options_split->display_links($options_query_numrows, MAX_ROW_LISTS_OPTIONS, MAX_DISPLAY_PAGE_LINKS, $option_page, 'value_page=' . $value_page . '&attribute_page=' . $attribute_page, 'option_page');

 

?>

</td>

</tr>

<tr>

<!-- OTF contrib begins -->

<!--

<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>

-->

<td colspan="6"><?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_TYPE; ?> </td> <!-- CLR 030212 - Add column for option type //-->

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_LENGTH; ?> </td> <!-- CLR 030212 - Add column for option length //-->

<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_COMMENT; ?> </td> <!-- CLR 030212 - Add column for option comment //-->

<td class="dataTableHeadingContent" align="center"> <?php echo TABLE_HEADING_ACTION; ?> </td>

</tr>

<tr>

<td colspan="6"><?php echo tep_black_line(); ?></td>

</tr>

<!-- OTF contrib ends --><?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&' . $page_info, 'NONSSL') . '" method="post">';

$inputs = '';

for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {

// OTF contrib begins

// $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 {

 

$option_name = tep_db_query("select products_options_name, products_options_length, products_options_comment 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="32" value="' . $option_name['products_options_name'] . '">  ' . TABLE_HEADING_OPT_COMMENT . ' <input type="text" name="option_comment[' . $languages[$i]['id'] . ']" size="32" value="' . $option_name['products_options_comment'] . '"><br>';

}

//CLR 030212 - Add column for option type

?>

<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" colspan="3"><?php echo $inputs; ?></td>

<td class="smallText"><?php echo TABLE_HEADING_OPT_LENGTH . ' <input type="text" name="option_length" size="4" value="' . $option_name['products_options_length'] . '">'; ?></td> <!-- CLR 030212 - Add column for option length //-->

<td class="smallText"><?php echo draw_optiontype_pulldown('option_type', $options_values['products_options_type']); ?></td> <!-- CLR 030212 - Add column for option type //-->

<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 {

// OTF contrib ends

?>

<td align="center" class="smallText"> <?php echo $options_values["products_options_id"]; ?> </td>

<td class="smallText"> <?php echo $options_values["products_options_name"]; ?> </td>

<!-- OTF contrib begins -->

<td class="smallText"> <?php echo translate_type_to_name($options_values["products_options_type"]); ?> </td> <!-- CLR 030212 - Add column for option type //-->

<td class="smallText"> <?php echo $options_values["products_options_length"]; ?> </td> <!-- CLR 030212 - Add column for option length //-->

<td class="smallText"> <?php echo $options_values["products_options_comment"]; ?> </td> <!-- CLR 030212 - Add column for option comment //-->

<!-- OTF contrib ends -->

<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'] . '&' . $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_option&option_id=' . $options_values['products_options_id'] . '&' . $page_info, '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>

<!-- OTF contrib begins -->

<!-- <td colspan="3"><?php echo tep_black_line(); ?></td>-->

<td colspan="6"><?php echo tep_black_line(); ?></td>

<!-- OTF contrib ends -->

</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&' . $page_info, 'NONSSL') . '" method="post"><input type="hidden" name="products_options_id" value="' . $next_id . '">';

$inputs = '';

for ($i = 0, $n = sizeof($languages); $i < $n; $i ++) {

// OTF contrib begins

//$inputs .= $languages[$i]['code'] . ': <input type="text" name="option_name[' . $languages[$i]['id'] . ']" size="20"> <br>';

$inputs .= $languages[$i]['code'] . ': <input type="text" name="option_name[' . $languages[$i]['id'] . ']" size="32">' . TABLE_HEADING_OPT_COMMENT . ' <input type="text" name="option_comment[' . $languages[$i]['id'] . ']" size="32"><br>';

// OTF contrib ends

}

?>

<td align="center" class="smallText"> <?php echo $next_id; ?> </td>

<!-- OTF contrib begins -->

<!--<td class="smallText"><?php echo $inputs; ?></td>-->

<td class="smallText" colspan="2"><?php echo $inputs; ?></td>

<td class="smallText"><?php echo TABLE_HEADING_OPT_LENGTH . ' <input type="text" name="option_length" size="4" value="' . $option_name['products_options_length'] . '">'; ?></td> <!-- CLR 030212 - Add column for option length //-->

<td class="smallText"><?php echo draw_optiontype_pulldown('option_type'); ?></td> <!-- CLR 030212 - Add column for option type //-->

<!-- OTF contrib ends -->

<td align="center" class="smallText"> <?php echo tep_image_submit('button_insert.gif', IMAGE_INSERT); ?> </td>

<?php

echo '</form>';

?>

</tr>

<tr>

<!-- OTF contrib begins -->

<!-- <td colspan="3"><?php echo tep_black_line(); ?></td>-->

<td colspan="6"><?php echo tep_black_line(); ?></td>

<!-- OTF contrib ends -->

</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>

</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, $page_info, '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'] . '&' . $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_delete.gif', ' delete '); ?></a>   <?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info, 'NONSSL') . '">'; ?><?php echo tep_image_button('button_cancel.gif', ' cancel '); ?></a> </td> </tr>

<?php

}

?>

</table></td>

</tr>

<?php

} else {

?>

<tr>

<td colspan="4" class="pageHeading"> <?php echo HEADING_TITLE_VAL; ?> </td>

</tr>

<tr>

<td colspan="4" class="smallText" align="right">

<?php

$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";

$values_split = new splitPageResults($value_page, MAX_ROW_LISTS_OPTIONS, $values, $values_query_numrows);

echo $values_split->display_links($values_query_numrows, MAX_ROW_LISTS_OPTIONS, MAX_DISPLAY_PAGE_LINKS, $value_page, 'option_page=' . $option_page . '&attribute_page=' . $attribute_page, 'value_page');

?>

</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, $page_info, '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'] . '&' . $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_option_value&value_id=' . $values_values['products_options_values_id'] . '&' . $page_info, '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&' . $page_info, '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>

<!-- products_attributes //-->

<tr>

<td class="smallText"> </td>

</tr>

<tr>

<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"> <?php echo HEADING_TITLE_ATRIB; ?> </td>

</tr>

</table></td>

</tr>

<tr>

<?php

if ($action == 'update_attribute') {

$form_action = 'update_product_attribute';

} else {

$form_action = 'add_product_attributes';

}

 

?>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="smallText" align="right">

<?php

$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";

$attributes_split = new splitPageResults($attribute_page, MAX_ROW_LISTS_OPTIONS, $attributes, $attributes_query_numrows);

echo $attributes_split->display_links($attributes_query_numrows, MAX_ROW_LISTS_OPTIONS, MAX_DISPLAY_PAGE_LINKS, $attribute_page, 'option_page=' . $option_page . '&value_page=' . $value_page, 'attribute_page');

?>

</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"> <?php echo TABLE_HEADING_OPT_SORT_ORDER; ?> </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>

<td class="dataTableHeadingContent" align="center"> <?php echo TABLE_HEADING_ACTION; ?> </td>

</tr>

<tr>

<td colspan="7"><?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']);

$attributes_sort = tep_attributes_sort($attributes_values['products_attributes_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="attributes_sort" value="<?php echo $attributes_sort; ?>" size="3"> </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') {

$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'];

}

?>

<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');?>">

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_DOWNLOAD; ?> </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>

</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 class="smallText"> <b><?php echo $attributes_sort; ?></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>

<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 class="smallText"> <?php echo $attributes_sort; ?> </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>

<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="7"><?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="attributes_sort" size="3"> </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>

<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>

<tr class="<?php echo (!($rows % 2)? 'attributes-even' : 'attributes-odd');?>">

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_DOWNLOAD; ?> </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>

</table>

</td>

<td> </td>

</tr>

<?php

} // end of DOWNLOAD_ENABLED section

?>

<?php

}

?>

<tr>

<td colspan="7"><?php echo tep_black_line(); ?></td>

</tr>

</table></form></td></tr>

<!-- Start Clone -->

<tr><td>

<?php

echo '<form name="clone" action="' . tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, 'action=clone_attributes', 'NONSSL') . '" method="post">';

?>

<Table>

<!-- Data Start -->

<tr><td class="pageHeading">Clone Product Attributes</td></tr>

<tr>

 

<td class="smallText">From

<select name="clone_products_id_from">

<?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">To

<!-- BOF Multiple Product Attributes Clone

<select name="clone_products_id_to">

//-->

<select name="clone_products_id_to[]" multiple size="20">

<!-- EOF Multiple Product Attributes Clone //-->

<?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><?php echo tep_image_submit('button_update.gif', IMAGE_UPDATE); ?></td></tr>

<tr><td>

</td></tr>

<!-- Data End -->

 

</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'); ?>

Edited by raymondburns
Link to comment
Share on other sites

  • 2 years later...

hi all,

 

i have 3 sections

 

* main product atributes

* option value

* product atributes

 

the product atributes have a sort value after instal this contri v 1.6

But i also want a sort value for the option value and the first main product atributes options

 

did i do something wrong?

 

 

greetz Edwin

Edited by edensan
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...