Jump to content
Sign in to follow this  
dontera

Products Attributes Sort v1.0

Recommended Posts

used the attribute sorter and tried the fix above, but either with or without the fix, product_info.php with changes makes the page in admin and product page lose its layout and ruin the borders and boxes.

 

any ideas please

 

thank you

 

steve


Hope it helps...

PC Planet

Share this post


Link to post
Share on other sites

Would like to install this but I have too many mods to replace product_info, product_attributes, and categories.php The documentation says:

 

--/admin/products_attributes.php--

::replace whole file or update manually (many small changes)::

 

----------------------------------

--/admin/categories.php--

::replace whole file or update manually (many small changes):

 

but no info about the many small changes. Is there further documentation on how to hack the existing files without overwriting them?

 

Thanks

Share this post


Link to post
Share on other sites

Hey there.. author here\,

 

SOrry ive been away from this thread so long, been building other sites and had pretty much forgotten about this.

 

re: further documentation, when I made this, it was only for myself, so I didnt bother to mark any changes in the product_attributes.php file. Mostly the changes are to the HTML of the tabling on that page, to accomodate the new "sort" column. If you do a diff between my version and yours, you should be able to pick out all the small changes.

Share this post


Link to post
Share on other sites

dontera,

Question...

I have Product Attribute/Item Editor loaded on my site and I would like to add your Attributes sort however in the Categories.php I run into a problem where both scripts are wanting me to make changes.

My existing code with Products Attribute/Item Editor code

<td class="main"><?php echo TEXT_PRODUCTS_WEIGHT; ?></td>
? ? ? ? ? ?<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_weight', $pInfo->products_weight); ?></td>
? ? ? ? ?</tr>
? ? ? ? ?<!--Improve Product Attributes/Item Editor begin -->
<tr>
? ? ? ? ? ?<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
? ? ? ? ?</tr>
? ? ? ? ?<tr>
? ? ? ? ?<td class="main">Product Attributes</td>
? ? ? ? ?<td class="main">
? ? ? ? ?<tr>
? ? ? ? ?<td></td>
? ? ? ? ?<td class="main">
? ? ?<?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' ?>To select multiple items, hold down ctrl or shift and click.
? ? ? ? ?</td>
? ? ? ? ?</tr>
? ? ? ? ?<tr>
? ? ? ? ? ?<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
? ? ? ? ?</tr>
<?php
? ? ?$options = tep_db_query("select products_options_name, products_options_id from " . TABLE_PRODUCTS_OPTIONS . " where language_id = '" . $languages_id . "' order by products_options_name");
? ? ?// ?Revision by RE
? // ?INITIALIZE $i VARIABLE, VALUE "0"
? $i = '0';
? while($options_values = tep_db_fetch_array($options)) {
? ? ? ?echo "\n" . '<tr><td class=main valign=top>' . $options_values['products_options_name'] . '</td>' . "\n";
? ? ? ?echo '<td class="main">' . "\n";
? ? ? // echo '<select multiple name="attributes[]" size=5 style="width: 136;">';
? ? ? ?
? ? ? ?//$suboptions = tep_db_query("SELECT DISTINCT POV.products_options_values_id, POV.products_options_values_name FROM products_options_values POV, products_options_values_to_products_options POVtoPO WHERE language_id = '" . $languages_id . "' AND POVtoPO.products_options_id = '" . $options_values['products_options_id'] . "' AND POVtoPO.products_options_values_id = POV.products_options_values_id ORDER BY POV.products_options_values_id");
? ? ? ?$suboptions = tep_db_query("SELECT * FROM products_options_values POV, products_options_values_to_products_options POVtoPO WHERE language_id = '" . $languages_id . "' AND POVtoPO.products_options_id = '" . $options_values['products_options_id'] . "' AND POVtoPO.products_options_values_id = POV.products_options_values_id ORDER BY POV.products_options_values_id");
? ? ? ?//$xx = 0;
? ? ? ? 
? // ?Revision by RE
? // EXTRA CODE, COMMENTED OUT
? //$suboptions_values = tep_db_fetch_array($suboptions);
? while($suboptions_values = tep_db_fetch_array($suboptions)) {
? ?	$prodoptions = tep_db_query("SELECT * FROM products_attributes WHERE products_id = '" . $pID . "' AND options_id = '" . $options_values['products_options_id'] . "' AND options_values_id = '" . $suboptions_values['products_options_values_id'] . "'" );
? ?	if ($prodoptions_values = tep_db_fetch_array($prodoptions)) {
? ? ?$checked = 'checked'; ? ? ?
? ?	} else {
? ? ?$checked = ''; ? ? ?
? ?	}
// Changed by SP ? ?	echo "\n" . "<option value=\"" . $options_values['products_options_id'] . "_" . $suboptions_values['products_options_values_id'] . "\"" . $checked . ">" . $suboptions_values['products_options_values_name'] . "</option>";
? ?	if ($prodoptions_values['price_prefix'] == "+")
? ?	{$price_checked_plus = ?"selected";}
? ?	else
? ?	{$price_checked_plus = "";}
? ?	
? ?	if ($prodoptions_values['price_prefix'] == "-")
? ?	{$price_checked_minus = ?"selected";}
? ?	else
? ?	{$price_checked_minus = "";}	
? ?	
? ?	// ?Reveision by RE
? ?	// ?ALLOW ARRAYS TO BE POPULATED ? ?	
? ?	echo "\n" . "<input type=\"checkbox\" name=\"attributes[".$i."]\" value=\"" . $options_values['products_options_id'] . "_" . $suboptions_values['products_options_values_id'] . "_" . $prodoptions_values['options_values_price'] . "_" . $prodoptions_values['price_prefix'] . "\"" . $checked . ">" . $suboptions_values['products_options_values_name'] . " <input size=\"6\" type=\"text\" name=\"att_price[".$i."]\" value=\"".$prodoptions_values['options_values_price']."\"> <select name=\"plus[".$i."]\"><option value=\"\"><option value=\"+\"". $price_checked_plus .">+<option value=\"-\"". $price_checked_minus .">-</select><br>";
? ? ? ?//$xx++;
?// ?Revision by RE
?// ?INCREASE THE VALUE OF $i AND LOOP BACK
? ? ? ?$i++;}
? ? ? ?//echo "\n" . '</select></td></tr>';
? ? ? ?echo "\n" . ' ?<tr>';
? ? ? ?echo "\n" . ' ? ?<td colspan=2>' . tep_draw_separator('pixel_trans.gif', '1', '10') . '</td>';
? ? ? ?echo "\n" . ' ?</tr>';
?
? ? ?}
?>
<!--Improve Product Attributes/Item Editor end -->
? ? ? ?</table></td>
? ? ?</tr>

and now this is the same area in your code

<td class="main"><?php echo TEXT_PRODUCTS_WEIGHT; ?></td>
? ? ? ? ? ?<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_weight', $pInfo->products_weight); ?></td>
? ? ? ? ?</tr>
? ? ? ?</table></td>
? ? ?</tr>
<!-- INSERT CODE BLOC 2, ATTRIBUTES CODE -->
<!-- INSERT CODE BLOC 2, ATTRIBUTES CODE -->
? ? ?<tr>
? ? ? ?<td><table border="0" cellspacing="0" cellpadding="2">
? ? ? ? ?<tr valign="top">
<?php
? ?$rows = 0;
? ?$options_query = 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 = tep_db_fetch_array($options_query)) {
? ? ?$values_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " p2p where pov.products_options_values_id = p2p.products_options_values_id and p2p.products_options_id = '" . $options['products_options_id'] . "' and pov.language_id = '" . $languages_id . "'");
? ? ?$header = false;
? ? ?while ($values = tep_db_fetch_array($values_query)) {
? ? ? ?$rows ++;
? ? ? ?if (!$header) {
? ? ? ? ?$header = true;
?>
? ? ? ? ? ?<td><table border="0" cellpadding="0" cellspacing="0">
? ? ? ? ? ? ?<tr class="dataTableHeadingRow">
? ? ? ? ? ? ? ?<td class="dataTableHeadingContent" colspan="4"><?php echo $options['products_options_name']; ?></td>
? ? ? ? ? ? ?</tr>
? ? <tr class="dataTableHeadingRow">
? ?<td class="dataTableHeadingContent" align="center">Option</td>
? ?<td class="dataTableHeadingContent" align="center">Prefix</td>
? ?<td class="dataTableHeadingContent" align="center">Price</td>
? ?<td class="dataTableHeadingContent" align="center">Sort Order</td>
?	</tr>
<?php
? ? ? ?}
? ? ? ?$attributes = array();
? ? ? ?if (sizeof($HTTP_POST_VARS) > 0) {
? ? ? ? ?if ($HTTP_POST_VARS['option'][$rows]) {
? ? ? ? ? ?$attributes = array('products_attributes_id' => $HTTP_POST_VARS['option'][$rows],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'options_values_price' => $HTTP_POST_VARS['price'][$rows],
? ? ? ?'attribute_sort' => $HTTP_POST_VARS['sort'][$rows], ? ? ? ? ? ? ? ? ? ? ? ? 'price_prefix' => $HTTP_POST_VARS['prefix'][$rows]);
? ?
// ?	, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'attribute_sort' => $HTTP_POST_VARS['sort'][$rows];
? ? ? ? ?}
? ? ? ?} else {
? ? ? ? ?$attributes_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix, attribute_sort from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $pInfo->products_id . "' and options_id = '" . $options['products_options_id'] . "' and options_values_id = '" . $values['products_options_values_id'] . "'");
? ? ? ? ?if (tep_db_num_rows($attributes_query) > 0) {
? ? ? ? ? ?$attributes = tep_db_fetch_array($attributes_query);
? ? ? ? ?}
? ? ? ?}
?>
? ? ? ? ? ? ?<tr class="dataTableRow">
? ? ? ? ? ? ? ?<td class="dataTableContent"><?php echo tep_draw_checkbox_field('option[' . $rows . ']', $attributes['products_attributes_id'], $attributes['products_attributes_id']) . ' ' . $values['products_options_values_name']; ?> </td>
? ? ? ? ? ? ? ?<td class="dataTableContent"><?php echo tep_draw_input_field('prefix[' . $rows . ']', $attributes['price_prefix'], 'size="2"'); ?></td>
? ? ? ? ? ? ? ?<td class="dataTableContent"><?php echo tep_draw_input_field('price[' . $rows . ']', $attributes['options_values_price'], 'size="7"'); ?></td>
? ? ? ? ? ? ? ?<td class="dataTableContent"><?php echo tep_draw_input_field('sort[' . $rows . ']', $attributes['attribute_sort'], 'size="7"'); ?></td>
? ? ? ? ? ? ?</tr>
<?php
? ? ?}
? ? ?if ($header) {
?>
? ? ? ? ? ?</table></td>
<?php
? ? ?}
? ?}
?>
? ? ? ? ?</tr>
? ? ? ?</table></td>
? ? ?</tr>
<!-- END INSET CODE BLOCK 2 -->

Any suggestions on how I can integrate the two codes. I'd really like to have that ability...

Teresa

Share this post


Link to post
Share on other sites

I am having the same problem as mentioned earlier in this thread. Installed this contribution, admin works fine, attribute sort values are being stored in the table, but attibute values are not being sorted on the product pages. Did anyone ever come up with a solution? Any help is appreciated.

Share this post


Link to post
Share on other sites

If it's helpful, here is the code for my product_info.php page for the above post. Changes from the original distribution are some layout changes, and I have added the options as images contribution and addtional images contribution. Any help is appreciated...Thanks

 

<?php
/*
 $Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);

 $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
 $product_check = tep_db_fetch_array($product_check_query);
?>
<!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>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript"><!--
function popupWindow(url) {
 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res
izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le
ft=150')
}
//--></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="20px" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php // require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!-- body_text //-->
   <td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
<?php
 if ($product_check['total'] < 1) {
?>
     <tr>
       <td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
<?php
 } else {
   $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, p.products_image_pop, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
   $product_info = tep_db_fetch_array($product_info_query);

   tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

   if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
     $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
   } else {
     $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
   }

   if (tep_not_null($product_info['products_model'])) {
     $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
   } else {
     $products_name = $product_info['products_name'];
   }
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading" valign="top"><?php echo $products_name; ?></td>
           <td class="pageHeading" align="right" valign="top"><?php //echo $products_price; ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td>
<?php
   if (tep_not_null($product_info['products_image'])) {
?>
           <table border="0" cellspacing="0" cellpadding="2" align="left" class="main">
             <tr>
             <td align="center" class="smallText">

<!--Additional Images Contribution Begin-->
<script language="javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), DISPLAY_IMAGE_WIDTH, DISPLAY_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
//--></script>
<noscript>
<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image_pop']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image_pop'], $product_info['products_name'], DISPLAY_IMAGE_WIDTH, DISPLAY_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
<!--Additional Images Contribution END-->

<!-- Original Code <script language="javascript">
document.write('<?php //echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
</script>
<noscript>
<?php //echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br clear="all">' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>//-->

<?php
   }
?>
             </td>
           </tr>
         </table>
           <p align="left" class="main"><?php echo stripslashes($product_info['products_description']); ?></p>
             
           <p align="right" class="pageHeading">Price <?php echo $products_price; ?></p>

<br clear="all">
   
<?php
   if (OPTIONS_AS_IMAGES_ENABLED == 'false'){
$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) {
?>
         <table border="0" cellspacing="0" cellpadding="2">
           <tr>
             <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
           </tr>
<?php
     $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.attribute_sort");
     while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
       $products_options_array = array();
       $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, 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 . "' order by pa.attribute_sort");
       while ($products_options = tep_db_fetch_array($products_options_query)) {
         $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
         if ($products_options['options_values_price'] != '0') {
           $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
         }
       }

       if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
         $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
       } else {
         $selected_attribute = false;
       }
?>
           <tr>
             <td width="17" class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
             <td width="24" class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
           </tr>
<?php
     }
?>
         </table>
<?php
   }
//Options as Images. Add the curly bracket as shown on the next line
}
?>

<?php
//Options as Images. This whole php clause needs to be added
if (OPTIONS_AS_IMAGES_ENABLED == 'true') include ('options_images.php'); 
?>
       </td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>

<?php
   $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
   $reviews = tep_db_fetch_array($reviews_query);
   if ($reviews['count'] > 0) {
?>
     <tr>
       <td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
   }

   if (tep_not_null($product_info['products_url'])) {
?>
     <tr>
       <td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
   }

   if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
     <tr>
       <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td>
     </tr>
<?php
   } else {
?>
     <tr>
       <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td>
     </tr>
<?php
   }
?>

     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td>
               <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
<tr>
       <tr>
           <td class="pageHeading" valign="top"><br>Additional Photos:</td>
          </tr>
 <td>
         <?php require(DIR_WS_MODULES . FILENAME_ADDITIONAL_IMAGES); ?>   
       </td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td>

<?php
   if ((USE_CACHE == 'true') && empty($SID)) {
     echo tep_cache_also_purchased(3600);
   } else {
     include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
   }
 }
?>
       </td>
     </tr>
   </table></form></td>
<!-- body_text_eof //-->
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Share this post


Link to post
Share on other sites

I just installed the contrib and it is working great. I have a question about something I am trying to accomplish and I am not sure if this contrib will do it or not or if there is something available that will do it.

 

The attribute sort works great. The problem is now in the Product Options area of the product attributes page. I need a sort for the product options now.

 

The product options are displayed in alphabetical order on the site and I would like to be able to sort them the same way I do with the attributes. For instance I now have...

 

Color

Memory

Size

 

And I would like for it to be...

 

Size

Memory

Color

 

Is there any way to accomplish this?

 

Thanks,

Zickarena

Share this post


Link to post
Share on other sites

Great contrib Forrest - well done!

 

Like numerous others that have posted here, I really need more global sorting of the attribs (2000+ products with 11 attribs each!).

 

As you can imagine, I am using EasyPopulate for this kind of db loading / maintenance and wondered how difficult it might be to include EasyPopulate support?

 

I probably have absolutely no concept of just how busy you are but would really appreciate your response.

 

Gratefully standing by...

Share this post


Link to post
Share on other sites
Great contrib Forrest - well done!

 

Like numerous others that have posted here, I really need more global sorting of the attribs (2000+ products with 11 attribs each!).

 

As you can imagine, I am using EasyPopulate for this kind of db loading / maintenance and wondered how difficult it might be to include EasyPopulate support?

 

I probably have absolutely no concept of just how busy you are but would really appreciate your response.

 

Gratefully standing by...

I too have a VERY large Product line (850,000 to be exact), and NO I do not have them all uploaded yet! :) I am using Easy Populate to upload products into my DB and currently have aprox 2,000 items out there right now. I sell auto accessories so a majority of my descriptions are the same (type of car you have) and the customer knows what product they are looking at by the drill down they completed to get to the product list. So where this becomes a HUGE problem is when I go to use the attribute Function, it goes by description. Well I am unable to tell by the discription (as there is alot of the same ones), which product I want to add the attributes too. Is there a way that we could also add a drop down box for Part Number? As this would be VERY helpful and assure that we get the correct product attributes to the correct product! Any input would be great!

 

Thanks

Charles


Best of luck!

Charles

 

Installed Contributions:

MS2

USPS

UPS

PayPal IPN

2CheckOut

Some other too that I am trying to figure out!

-To all OSC programmers: Thank you for all your hard work put into this application!

Share this post


Link to post
Share on other sites

For those of you that were having problems getting this module to work with the options as images contribution installed...I got it to work by applying the changes outlined in the readme file to the catalog/options_images.php file. (around line 29) change

 

$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pov.products_options_values_thumbnail, pa.options_values_price, 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 . "' ");

 

to

 

$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pov.products_options_values_thumbnail, pa.options_values_price, 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 . "' order by pa.attribute_sort");

 

Applying the changes to product_info.php will only work if you have options as images disabled.

Share this post


Link to post
Share on other sites

Hello,

Thanx for this great contribution. i works good and had no problems with installing this contribution.

I only have one quistion:

I have 15 kinds of options so mij admin/categories page is getting verry width when i ad a new product becouce this contribution places al the options on 1 row.

Is it posible to split this up, so it places only 3 options on a row and the next 3 on a row under that en the next 3 on a row under that and so on?

This wil make it a lot nicer to work, otherwise i have to scrol a lot to ad the options.

This code is what shows the fields on the admin/categories.php page:

 

<!-- INSERT CODE BLOC 2, ATTRIBUTES CODE -->
<!-- INSERT CODE BLOC 2, ATTRIBUTES CODE -->

    <tr>
      <td><table border="1" cellspacing="0" cellpadding="2">
        <tr valign="top">
<?php
  $rows = 0;
  $options_query = 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 = tep_db_fetch_array($options_query)) {
    $values_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " p2p where pov.products_options_values_id = p2p.products_options_values_id and p2p.products_options_id = '" . $options['products_options_id'] . "' and pov.language_id = '" . $languages_id . "'");
    $header = false;
    while ($values = tep_db_fetch_array($values_query)) {
      $rows ++;
      if (!$header) {
        $header = true;
?>
          <td><table border="1" cellpadding="0" cellspacing="0">
            <tr class="dataTableHeadingRow">
              <td class="dataTableHeadingContent" colspan="4"><?php echo $options['products_options_name']; ?></td>
            </tr>
   <tr class="dataTableHeadingRow">
  <td class="dataTableHeadingContent" align="center">Option</td>
  <td class="dataTableHeadingContent" align="center">Prefix</td>
  <td class="dataTableHeadingContent" align="center">Price</td>
  <td class="dataTableHeadingContent" align="center">Sort Order</td>
 </tr>
<?php
      }
      $attributes = array();
      if (sizeof($HTTP_POST_VARS) > 0) {
        if ($HTTP_POST_VARS['option'][$rows]) {
          $attributes = array('products_attributes_id' => $HTTP_POST_VARS['option'][$rows],
                              'options_values_price' => $HTTP_POST_VARS['price'][$rows],
      'attribute_sort' => $HTTP_POST_VARS['sort'][$rows],                         'price_prefix' => $HTTP_POST_VARS['prefix'][$rows]);

  
//   ,                                'attribute_sort' => $HTTP_POST_VARS['sort'][$rows];
        }
      } else {
        $attributes_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix, attribute_sort from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $pInfo->products_id . "' and options_id = '" . $options['products_options_id'] . "' and options_values_id = '" . $values['products_options_values_id'] . "'");
        if (tep_db_num_rows($attributes_query) > 0) {
          $attributes = tep_db_fetch_array($attributes_query);
        }
      }
?>
            <tr class="dataTableRow">
              <td class="dataTableContent"><?php echo tep_draw_checkbox_field('option[' . $rows . ']', $attributes['products_attributes_id'], $attributes['products_attributes_id']) . ' ' . $values['products_options_values_name']; ?> </td>
              <td class="dataTableContent"><?php echo tep_draw_input_field('prefix[' . $rows . ']', $attributes['price_prefix'], 'size="2"'); ?></td>
              <td class="dataTableContent"><?php echo tep_draw_input_field('price[' . $rows . ']', $attributes['options_values_price'], 'size="7"'); ?></td>
              <td class="dataTableContent"><?php echo tep_draw_input_field('sort[' . $rows . ']', $attributes['attribute_sort'], 'size="7"'); ?></td>
            </tr>
<?php
    }
    if ($header) {
?>
          </table></td>
<?php
    }
  }
?>
        </tr>
      </table></td>
    </tr>

<!-- END INSET CODE BLOCK 2 -->
<!-- END INSET CODE BLOCK 2 -->

 

Hope someone can help me.

Kind regards

 

Dani?l

Share this post


Link to post
Share on other sites

I followed the install instructions and it worked fine in the admin area. I can see the product attributes in the admin and that seems fine. The problem is with the store front I get the following error:

 

Fatal error: Cannot redeclare tep_set_banner_status() (previously declared in ......../getscrappy/catalog/includes/functions/general.php:694)

 

can anyone help me?

 

regards

 

Blair

Share this post


Link to post
Share on other sites

Sorry for lame post... There are two general.php files .. I had simply updated the wrong general.php file.. I put the admin one in the catalog sections. I changed it over and it seems to work fine now.

 

Thanks for the great contrib and I also vote for some sort of function like this being added to the standard build of osCommerce. It only makes sense to edit attributes right in the product admin edit area. Having attributes in a separate area it very poor logic.

Share this post


Link to post
Share on other sites

dfeenstra, I had the same request. I've whipped up something that seems to work...

 

In admin/categories.php, replace:

<?php
   $rows = 0;
   $options_query = 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 = tep_db_fetch_array($options_query)) {
     $values_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " p2p where pov.products_options_values_id = p2p.products_options_values_id and p2p.products_options_id = '" . $options['products_options_id'] . "' and pov.language_id = '" . $languages_id . "'");
     $header = false;
      while ($values = tep_db_fetch_array($values_query)) {

 

with this:

 

<?php
   $rows = 0;
   $columns = 0;
   $options_query = 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 = tep_db_fetch_array($options_query)) {
     $columns ++;
     $values_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov, " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " p2p where pov.products_options_values_id = p2p.products_options_values_id and p2p.products_options_id = '" . $options['products_options_id'] . "' and pov.language_id = '" . $languages_id . "'");
     $header = false;
     if ($columns > 5) {
       $columns = 1;
       ?>
      </tr><tr valign="top">
      <?php
      }
     while ($values = tep_db_fetch_array($values_query)) {

 

You can change the 4 to be whatever you want. For reasons I don't understand, I get only three columns after the first row, but I'm sure this will come to me after a while...

Share this post


Link to post
Share on other sites

For those having problems, if you add a brand new product the sorted Attributes will show up, but old products it will not.

Share this post


Link to post
Share on other sites

Thank you very much for this contribution. I installed it and it seems to be working perfectly. Great Job???

 

Not sure if this history text will help any new people out there.

 

I had 3 image installed and most of the files Attributes Sort replaced had not been previously modified so I just copied the included attributes sort files over the originals. Of course I made backups of the files first.

 

When I came to the catagories.php I realized it was one of the files which was modified with 3 image. Not being a php programmer I had to stop and think for a moment. I knew there was code in that file that 3 image needed and I couldn't replace the file with the one included with attributes sort so I had to figure out what was different about your file.

 

I used ExamDiff to compare yours with the original categories.php and to my surprise it was easy to see where to insert the new code in the file.

 

I imported the sql with phpmyadmin, went to the admin and brought up a product to edit and look in amazement at what you had done.

 

I only wish I had the knowlege to make such modifications and contribute them as you have done.

 

Thanks again so much. Life is 1.25 iotas better.

Share this post


Link to post
Share on other sites

Where is the updated version of this mod?

 

The one in the contribution is dated - 28 Nov 2003 - Products Attributes Sort v1.0

 

is the the latest? Should I be using this?

 

Kindly let me know

 

Thanks

hk

Share this post


Link to post
Share on other sites

I hope this isnt a dead forum so please help me... in my admin directory this error is displayed...

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']; }
Warning: Cannot send session cookie - headers already sent by (output started at /home/httpd/vhosts/freepgs.com/httpdocs/mijman2/catalog/admin/includes/functions/general.php:1314) in /home/httpd/vhosts/freepgs.com/httpdocs/mijman2/catalog/admin/includes/functions/sessions.php on line 67

Warning: Cannot send session cache limiter - headers already sent (output started at /home/httpd/vhosts/freepgs.com/httpdocs/mijman2/catalog/admin/includes/functions/general.php:1314) in /home/httpd/vhosts/freepgs.com/httpdocs/mijman2/catalog/admin/includes/functions/sessions.php on line 67

 

Whats going on?

Share this post


Link to post
Share on other sites

Can you post the specific things that you need to edit in the two documents that you say just to upload...

 

I need to use this in conjunction with a stocking contribution, and both say to just overwrite the directory...

 

So either one works or the other works but not both...

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  

×