Jump to content
Sign in to follow this  
dontera

Products Attributes Sort v1.0

Recommended Posts


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.

Share this post


Link to post
Share on other sites

 

Hi Spooks, thanks for replying, I didn't see that contri, but the thing is the sorting is actually realy good with the contribution I use now. Only the function cloning doesn't do the job wel.

It is nice to do a clone for al the attributes on another product, so you don't have to go through all the clicking again.

But only than the sorting is in reverse order.

I think the contri you pointed out would be nice if I didn't manage to merge QTpro with products attributes sort.

 

Thanks.

Share this post


Link to post
Share on other sites

I am working this contribution now quite wel. The thing I do is I clone one product, and keep that product only as a cloning product. Since the order is reversed, if I use it to clone one other product the order get reversed again, and therefore is in the right order :)

Share this post


Link to post
Share on other sites

I am also having the sorting problem on the site because I have the "options as images" contribution on my site. Is there a fix so that I can use both contributions?

Share this post


Link to post
Share on other sites

I am preparing to install this, but there is a confusing sentence in the instructions.

 

In step 4, you have a choice (and I quote) to:

"Clone all attributes from One Product Attribute to ONE Option Value" -- OR ---

" Clone all attributes from ONE Product Attribute to MULTIPLE Option Values"

 

Clearly, the choice is to make a one-to-one or one-to-many decision, but the words above don't make any sense.

 

Should it read:

"Clone all attributes from One Product Option to ONE Option (for another product)" -- OR --

" Clone all attributes from One Product Option to MLTIPLE OPTIONS (for another product)"

 

I guess I really don't understand the purpose of this step, and its impact on me.

 

Can someone help?

Cheryl

Share this post


Link to post
Share on other sites
I am preparing to install this, but there is a confusing sentence in the instructions.

 

In step 4, you have a choice (and I quote) to:

"Clone all attributes from One Product Attribute to ONE Option Value" -- OR ---

" Clone all attributes from ONE Product Attribute to MULTIPLE Option Values"

 

Clearly, the choice is to make a one-to-one or one-to-many decision, but the words above don't make any sense.

 

Should it read:

"Clone all attributes from One Product Option to ONE Option (for another product)" -- OR --

" Clone all attributes from One Product Option to MLTIPLE OPTIONS (for another product)"

 

I guess I really don't understand the purpose of this step, and its impact on me.

 

Can someone help?

Cheryl

 

I had hoped someone could explain this ;-( will go ahead and install and figure it out by doing!

Share this post


Link to post
Share on other sites
I just installed this mod (latest version) And I get this error in my admin:

 

Fatal error: Call to undefined function tep_attributes_sort() in /home/jcsl01/domains/jcsl.nl/public_html/baja/shop/catalog/admin/products_attributes.php on line 602

 

 

601 // BOE: Attribute Sort with Clone Tool

602 $attributes_sort = tep_attributes_sort($attributes_values['products_attributes_id']);

603 // EOE: Attribute Sort with Clone Tool

 

 

I also have this error. You say that you fixed it - please elaborate???

 

Cheers

Share this post


Link to post
Share on other sites

Sorting still doesn't work in the options (select menu) the actual info page has the sorting nice and tidy.

I found this fix in the contribution area of product attributes sort v 1.0

 

"$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");" ... in the product_info.php file and replace it with ...

 

 

 

"$products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'

group by patrib.attribute_sort order by patrib.attribute_sort");" ... now your options will use the same ordering as your attributes ... enjoy

*************************************************************************************************

 

But the php in product_info.php is nothing like that, after later updates on this contribution, the php now looks like this, anyone any help to fix the sorting with this part of php below??

*************************************************************************************************

 

$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");

$products_attributes = tep_db_fetch_array($products_attributes_query);

if ($products_attributes['total'] > 0) {

Share this post


Link to post
Share on other sites

I was wrong with the above posts, I finally got it fixed.

I had to change code in de file catalog/includes/classes/pad_base.php

This is the file qtpro 4.51b uses to sort.

 

I changed the code:

$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$this->products_id . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'" . " order by pa.options_values_price, pa.products_attributes_id");

*********************************************************************

into

*********************************************************************

$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$this->products_id . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'" . " order by (pov.products_options_values_name+0)");

 

 

So realy the last part is changed.

Came from the idea I found on another attribute sort contribution http://addons.oscommerce.com/info/2673

CONTRIBUTION ADDON BY BEN NEVIS he changed it on another file, in a little different way.

 

Only sommetimes 7½ or 8½ comes before 7 or 8 not allways, but nevertheless, I am happy with the above sollution.

Share this post


Link to post
Share on other sites

I've installed this mod and its working fine, mostly.

 

I have a somewhat annoying issue: I am unable to add the sort order number when I assign an attribute to a product. I am able to enter a number in the 'sort order number' box but it doesn't "stick". The same thing is occurring with the "Value Price" attribute.

I have to assign the attribute and then I have to go through the 'edit' option to assign the sort order number and the value price.

 

Is this normal or does it needs fixing? If it needs a fix, can someone help?

 

Also has anyone used this mod with Easy Populate?

 

Thank you in advance. :thumbsup:

Steve

Share this post


Link to post
Share on other sites

My error is similar to larryjam:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'attribute_sort = '0' where products_attributes_id = '138'' at line 1

update products_attributes set products_id = '65', options_id = '2', options_values_id = '32', options_values_price = '0', price_prefix = '+', options_values_weight = '0.000' attribute_sort = '0' where products_attributes_id = '138'

[TEP STOP]

 

I get this error when I hit the update button when trying to change the sort order from 0 to 1 or any other values for things like weight etc.

 

Here is my code within directory\admin\products_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'] : '');

 $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) {
// BOE: Attribute Sort with Clone Tool
  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, attribute_sort 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, attribute_sort) VALUES (".$clone_product_id_to.", ".$attributes_values['options_id'].", ".$attributes_values['options_values_id'].", ".$attributes_values['options_values_price'].", '".$attributes_values['price_prefix']."' , ".$attributes_values['attribute_sort'].")");
	}	
       tep_redirect(tep_href_link(FILENAME_PRODUCTS_ATTRIBUTES, $page_info));
       break;
// EOE: Attribute Sort with Clone Tool
     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']]);
//++++ QT Pro: Begin Changed code
         $track_stock=isset($HTTP_POST_VARS['track_stock'])?1:0;
         tep_db_query("insert into " . TABLE_PRODUCTS_OPTIONS . " (products_options_id, products_options_name, language_id,products_options_track_stock) values ('" . (int)$products_options_id . "', '" . tep_db_input($option_name) . "', '" . (int)$languages[$i]['id'] . "', '" . (int)$track_stock . "')");
//++++ QT Pro: End Changed Code
       }
       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':
  // Where add weight is added
       $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']);
// BOE: Attribute Sort with Clone Tool
       $attributes_sort = tep_db_prepare_input($HTTP_POST_VARS['attributes_sort']);
// EOE: Attribute Sort with Clone Tool
       $value_price = tep_db_prepare_input($HTTP_POST_VARS['value_price']);
       $price_prefix = tep_db_prepare_input($HTTP_POST_VARS['price_prefix']);
	$value_weight = tep_db_prepare_input($HTTP_POST_VARS['value_weight']);

// BOE: Attribute Sort with Clone Tool
	tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values ('', '" . (int)$products_id . "', '" . (int)$options_id . "', '" . (int)$values_id . "', '" . tep_db_input($value_price) . "', '" . tep_db_input($price_prefix) . "',   '" . tep_db_input($value_weight) . "', '".tep_db_input($attributes_sort)."')");
// EOE: Attribute Sort with Clone Tool

       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':
       $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']]);
//++++ QT Pro: Begin Changed code
         $track_stock=isset($HTTP_POST_VARS['track_stock'])?1:0;
         tep_db_query("update " . TABLE_PRODUCTS_OPTIONS . " set products_options_track_stock='" . (int)$track_stock . "',products_options_name = '" . tep_db_input($option_name) . "' where products_options_id = '" . (int)$option_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'");
//++++ QT Pro: End Changed Code
       }

       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':
  // Weight Added
       $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']);
// BOE: Attribute Sort with Clone Tool
       $attributes_sort = tep_db_prepare_input($HTTP_POST_VARS['attributes_sort']);
// EOE: Attribute Sort with Clone Tool
       $value_price = tep_db_prepare_input($HTTP_POST_VARS['value_price']);
       $price_prefix = tep_db_prepare_input($HTTP_POST_VARS['price_prefix']);
	$value_weight = tep_db_prepare_input($HTTP_POST_VARS['value_weight']);
       $attribute_id = tep_db_prepare_input($HTTP_POST_VARS['attribute_id']);

// BOE: Attribute Sort with Clone Tool
       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) . "', options_values_weight = '" . tep_db_input($value_weight) . "' attribute_sort = '" . (int)$attributes_sort . "' where products_attributes_id = '" . (int)$attribute_id . "'");
// EOE: Attribute Sort with Clone Tool		

       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;
   }
 }
?>
<!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  width="100%" cellspacing="2" cellpadding="2">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table  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  width="100%" cellspacing="0" cellpadding="0">
<!-- options and values//-->
     <tr>
       <td width="100%"><table width="100%"  cellspacing="0" cellpadding="0">
         <tr>
           <td valign="top" width="50%"><table width="100%"  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  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>
<!-- BOE: Attribute Sort with Clone Tool //-->
				<td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_SORT_ORDER; ?> </td>
<!-- EOE: Attribute Sort with Clone Tool //-->
                 </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>
<?php
//++++ QT Pro: Begin Changed code
?>
               <td colspan="4"><?php echo tep_black_line(); ?></td>
<?php
//++++ QT Pro: End Changed Code
?>
             </tr>
             <tr class="dataTableHeadingRow">
               <td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_ID; ?> </td>
               <td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_NAME; ?> </td>
<?php
//++++ QT Pro: Begin Changed code
?>
               <td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_TRACK_STOCK; ?> </td>
<?php
//++++ QT Pro: End Changed Code
?>
               <td class="dataTableHeadingContent" align="center"> <?php echo TABLE_HEADING_ACTION; ?> </td>
             </tr>
             <tr>
<?php
//++++ QT Pro: Begin Changed code
?>
               <td colspan="4"><?php echo tep_black_line(); ?></td>
<?php
//++++ QT Pro: End Changed Code
?>
             </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&' . $page_info, '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>
<?php
//++++ QT Pro: Begin Changed code
?>
               <td align="center" class="smallText"><input type=checkbox name=track_stock <? echo $options_values['products_options_track_stock']?"checked":""; ?>></td>
<?php
//++++ QT Pro: End Changed Code
?>
               <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>' . "\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>
<?php
//++++ QT Pro: Begin Changed code
?>
               <td align="center" class="smallText"> <?php echo $options_values['products_options_track_stock']?"Yes":"No"; ?></td>
<?php
//++++ QT Pro: End Changed Code
?>
               <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>
<?php
//++++ QT Pro: Begin Changed code
?>
               <td colspan="4"><?php echo tep_black_line(); ?></td>
<?php
//++++ QT Pro: End Changed Code
?>
             </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 ++) {
       $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>
<?php
//++++ QT Pro: Begin Changed code
?>
               <td align="center" ><input type=checkbox name=track_stock></td>
               <td align="left" class="smallText"> <?php echo tep_image_submit('button_insert.gif', IMAGE_INSERT); ?> </td>
<?php
//++++ QT Pro: End Changed Code
     echo '</form>';
?>
             </tr>
             <tr>
<?php
//++++ QT Pro: Begin Changed code
?>
               <td colspan="4"><?php echo tep_black_line(); ?></td>
<?php
//++++ QT Pro: End Changed Code
?>
             </tr>
<?php
   }
 }
?>
           </table></td>
<!-- options eof //-->
           <td valign="top" width="50%"><table width="100%"  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  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&' . $page_info, '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  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  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  width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td colspan="8"><?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"> <?php echo TABLE_HEADING_OPT_PRICE; ?> </td>
           <td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_PRICE_PREFIX; ?> </td>
           <td class="dataTableHeadingContent"> <?php echo TABLE_HEADING_OPT_WEIGHT; ?> </td>
           <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']);
// BOE: Attribute Sort with Clone Tool
   $attributes_sort = tep_attributes_sort($attributes_values['products_attributes_id']);
// EOE: Attribute Sort with Clone Tool
   $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>
<!-- BOE: Attribute Sort with Clone Tool //-->
           <td align"right" class="smallText"> <input type="text" name="attributes_sort" value="<?php echo $attributes_sort; ?>" size="3"> </td>
<!-- EOE: Attribute Sort with Clone Tool //-->
           <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="right" class="smallText"> <input type="text" name="value_weight" value="<?php echo $attributes_values['options_values_weight']; ?>" size="6"> </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>
<!-- BOE: Attribute Sort with Clone Tool //-->
           <td class="smallText"> <b><?php echo $attributes_sort; ?></b> </td>
<!-- EOE: Attribute Sort with Clone Tool //-->            <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="right" class="smallText"> <b><?php echo $attributes_values["options_values_weight"]; ?></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>
<!-- BOE: Attribute Sort with Clone Tool //-->
           <td class="smallText"> <?php echo $attributes_sort; ?> </td>
<!-- EOE: Attribute Sort with Clone Tool //-->
           <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="right" class="smallText"> <?php echo $attributes_values["options_values_weight"]; ?> </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>
<!-- BOE: Attribute Sort with Clone Tool //-->
           <td align="right" class="smallText"> <input type="text" name="attributes_sort" size="3"> </td>
<!-- EOE: Attribute Sort with Clone Tool //-->
           <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="right" class="smallText"> <input type="text" name="value_weight" size="6" 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>
<!-- BOE: Attribute Sort with Clone Tool //-->
<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
<select name="clone_products_id_to">
<?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>
<!-- EOE: Attribute Sort with Clone Tool //-->
   </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'); ?>

Share this post


Link to post
Share on other sites

THIS IS WHAT I HAVE POSTED BEFORE:

 

“ i installed the EN-FR-DE Attribute Sort with Attribute Clone 1_8_3 where the clone options works fine; however if i want to put a new attribute for a product under Porduct Attributes and click on "Insert" it give me this error:

 

1136 - Column count doesn't match value count at row 1

 

insert into products_attributes values (null, '109', '1', '15', '0', '+')

 

[TEP STOP]

 

please keep in mind the number change every time; i did everything the right way but not sure when its doing this, any advice? “

 

AND THIS IS THE REPLY I GOT:

 

“If you look in the product_attributes table you will see there are probably 7 fields in it.

 

The insert statement in your post only has 6.

 

Therefore you need to change the code to insert data into every field.

 

HTH

 

G”

 

HOWEVER, THIS REPLY IS GREAT AND I THINK IT’S THE RIGHT ONE, BUT I HAVE NO IDEA WHERE TO GO AND FIX IT… AND CHANGE IT FROM 6 FIELDS TO 7 FIELDS?

 

PLEASE ANY SUGGESTIONS OR FILES I CAN CHECK OR START WITH? ANYTHING WOULD HELP? THANK YOU ALL!

Share this post


Link to post
Share on other sites

Ooops, the multiquote didn't work, I'm editing to add this:

 

View PostJ.S. Coolen, on Apr 20 2009, 08:43 AM, said:

I just installed this mod (latest version) And I get this error in my admin:

 

Fatal error: Call to undefined function tep_attributes_sort() in /home/jcsl01/domains/jcsl.nl/public_html/baja/shop/catalog/admin/products_attributes.php on line 602

 

 

601 // BOE: Attribute Sort with Clone Tool

602 $attributes_sort = tep_attributes_sort($attributes_values['products_attributes_id']);

603 // EOE: Attribute Sort with Clone Tool

 

I also have this error. You say that you fixed it - please elaborate???

 

Cheers

 

Hi, I am getting this same error. IF anyone has figured it out, could you share for others, or does anyone know how to fix this? Help :(

Edited by Dianna668

Share this post


Link to post
Share on other sites

Error when running this in osC 2.3 . Yes, I know it was written for 2.2, but it's mostly working. Am able to add the sort order attributes via the admin page (though the header is missing), but when I display a product that has the sort order attribute, I get the following error when it should show the drop-down box under "Available Options:"

 

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /shop/includes/functions/database.php on line 99

 

Not a page I modified.

 

It's a substantially unmodified site - thoughts?

Share this post


Link to post
Share on other sites

Error when running this in osC 2.3 . Yes, I know it was written for 2.2, but it's mostly working. Am able to add the sort order attributes via the admin page (though the header is missing), but when I display a product that has the sort order attribute, I get the following error when it should show the drop-down box under "Available Options:"

 

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /shop/includes/functions/database.php on line 99

 

Not a page I modified.

 

It's a substantially unmodified site - thoughts?

 

user error...sorry.

Edited by BurtonDavis

Share this post


Link to post
Share on other sites

This is the support thread for Products Attributes Sort v1.0

 

Morning Ladies & Gentlemen,

 

I am new to OsCommerce, PHP, SQL and need some help. On install I can do everything but the very first step. How do I run the file? Where do I insert the line?

 

 

************

* Database *

************

 

Run the included "attribute_sort.sql" OR insert line below

using phpMyAdmin or comparable software...

 

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

 

 

I am gettting the below error message in Admin/attributes.

 

Products Attributes

 

<< Page 12 of 2 >>

 

ID Product Name Option Name Option Value Sort Order Value Price Prefix Action

 

1054 - Unknown column 'attribute_sort' in 'field list'

 

select attribute_sort from products_attributes where products_attributes_id = '45'

 

 

Please can some help. Thanks

Share this post


Link to post
Share on other sites

I am having the similar issue that Larry had on the last page, in that I am running SPPC and adding attribute sort, and the query in Product info that needs to be replaced is different from the standard one in the instructions.

 

I've been working on manually merging the two queries but it's fighting me. Given enough time I'm sure I'll get it (infinite monkey theorem), but if someone has that query already done, I'd really appreciate the help.


Gary

Share this post


Link to post
Share on other sites

Apparently it's easier to round up an infinite number of monkeys than I thought:

 

// BOE: Attribute Sort with Clone Tool, including support for SPPC  gearheadgary 7-6-2011
$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id,  pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 order by pa.attribute_sort" );
$list_of_prdcts_attributes_id = '';
$products_options = array(); // makes sure this array is empty again
while ($_products_options = tep_db_fetch_array($products_options_query)) {
$products_options[] = $_products_options;
$list_of_prdcts_attributes_id .= $_products_options['products_attributes_id']."," ;
// EOE: Attribute Sort with Clone Tool


Gary

Share this post


Link to post
Share on other sites

I have 2.3.1 install. I am trying to get this contrib to work but have a problem.

I am getting the following error:

PHP Fatal error: Class 'splitPageResults' not found in html/shop/admin/products_attributes.php on line 280

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

 

Any idea of what the problem could be?

 

BTW in the install instructions for this contrib it says the following:

**********

* Upload *

**********

 

If you have an unmodified store you may upload

and overwrite your files with the included fileset

and complete Steps 1 & 2 ONLY below.

 

Otherwise, please follow the step by step instructions below.

 

There is no fileset included in the contrib. It would be nice to have an edited products_attributes.php file.

Share this post


Link to post
Share on other sites

OK, I realized that I had not downloaded the full version of this contrib.

 

I uploaded the products_attributes.php file from the contrib to my server. Everything is working fine except that my products_attributes.php is messed up in how it displays.

post-93738-0-01205000-1311957022_thumb.jpg

Share this post


Link to post
Share on other sites

If you look at the posted attached image, on the left side is all the text and links for the admin console.

Share this post


Link to post
Share on other sites

newtech - it appears as though you needed to redo the require(..application_top.php) in admin/products_attributes.php.

 

gearheadgary - I get...

1054 - Unknown column 'pa.attributes_sort' in 'order clause'

...so I went back to original with SPPC. I get no errors with that, but I haven't really tested much as I just installed it...

Edited by The Munch

Thank You!!

----------

Using: OSC 2.3.1, Algozone Template, Jcow 5 Pro, CometChat 4 Premium.

 

Contributions for OSC-2.3.1: QT Pro 4.6.1, Easy Populate EPv2.77a, Admin Notes, Contribution Tracker, Multi-Product Manager, myQBi Quickbooks Sync, Order Editor 5.0.9, Dynamic Sitemap, Tax ID in Order Editor, Separate Pricing Per Customer v4.2.2 ... etc ...

 

Contributions for OSC-2.2 I've Modified for OSC-2.3.1: Admin Level Account with Categories 2.3.4, File Logging or Email for Failed Admin Login Attempts, Autologon v1.09, Admin Specials by Categories, CCGV 6.0_1, Hide Categories, How Did You Hear About Us, MSRP Listing, Multiple Sales Per Product, osc as info site, OSC Checkout Security Boost v1.1, Points and Rewards Module, Quick Stock Updater, Quick Updates 292, RMA Returns System 2.6, Show Unit Price, Store Mode, Supplier Admin v1.3, Tell A Friend, Required Customer Details v22rc2a, Admin Change Customers Password v3.3, PDF Invoice & PackingSlip 1.6, Quick Price Updates for SPPC v1.5, Country-State Selector v1.5.5 + Limit Countries v2.2, Contact Us Popup Business Card, No Right Click, Delete Customer Account v1.2, Control Login v2.2, Member Type Control v1.1, .... etc...

Share this post


Link to post
Share on other sites

I'm having the same issue as newtech...Overall it seems to be working correctly but the products_attributes.php page isn't loading the left menu correctly...any ideas on how to fix?

Share this post


Link to post
Share on other sites

Figured it out...need to replace:

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

 

with:

<?php require(DIR_WS_INCLUDES . 'template_top.php'); ?>

 

at line 173

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×