Jump to content
Sign in to follow this  
spooks

Product Listing Enhancements, Thumbnails & Manufacturer Headings

Recommended Posts

 

 

replace

 

 $specials_query_raw = "select " . $select_column_list . " p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price  from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' " . $sort_sql;

with:

 

$specials_query_raw = "select " . $select_column_list . " p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price  from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' " . $sort_sql;

 

 

Can't see from your image, looks like you need to adjust your css settings.


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

replace

 

 $specials_query_raw = "select " . $select_column_list . " p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price  from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' " . $sort_sql;

with:

 

$specials_query_raw = "select " . $select_column_list . " p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price  from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' " . $sort_sql;

 

 

Can't see from your image, looks like you need to adjust your css settings and/or increase Product Listing Box Height setting


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

Show sale price

Im using the contribe SaleMaker (http://addons.oscommerce.com/info/1340) does anyone know what i need to modify to have the gridlisting display the sale price?

 

 

in product_listing.php find(144):

 

 

 

if (tep_not_null($listing['specials_new_products_price'])) {
         	$price = '<s>' .  $price . '</s>' . ($last ? '<br />' : '  ') . '<span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>';
     	} else {
   	$price = ($p_price > 0 ? '' . $price . '' : '' . TEXT_POA); 
      if (function_exists(tep_get_att_price)) $price .= (tep_get_att_price($listing['products_id']) > 0 ? '+' : '') ; 
     	}
 return '<span class="productListing-list-price">' . $price . '</span>'; 

 

Replace with:

 

if (tep_not_null($listing['specials_new_products_price'])) {
         	$price = '<s>' .  $price . '</s>' . ($last ? '<br />' : '  ') . '<span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>';
     	} elseif (function_exists(tep_get_products_special_price)) { 
       if($new_price = tep_get_products_special_price($listing['products_id'])) { 
         $price = '<s>' .  $price . '</s>' . ($last ? '<br />' : '  ') . '<span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>';
       }
     	} 
    $price = ($p_price > 0 ? '' . $price . '' : '' . TEXT_POA); 
    if (function_exists(tep_get_att_price)) $price .= (tep_get_att_price($listing['products_id']) > 0 ? '+' : '') ; 

 return '<span class="productListing-list-price">' . $price . '</span>'; 

 

 

Not tested, let me know if it works OK wink.gif

 

 


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

Show sale price

 

 

in product_listing.php find(144):

 

 

 

if (tep_not_null($listing['specials_new_products_price'])) {
         	$price = '<s>' .  $price . '</s>' . ($last ? '<br />' : '  ') . '<span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>';
     	} else {
   	$price = ($p_price > 0 ? '' . $price . '' : '' . TEXT_POA); 
      if (function_exists(tep_get_att_price)) $price .= (tep_get_att_price($listing['products_id']) > 0 ? '+' : '') ; 
     	}
 return '<span class="productListing-list-price">' . $price . '</span>'; 

 

Replace with:

 

if (tep_not_null($listing['specials_new_products_price'])) {
         	$price = '<s>' .  $price . '</s>' . ($last ? '<br />' : '  ') . '<span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>';
     	} elseif (function_exists(tep_get_products_special_price)) { 
       if($new_price = tep_get_products_special_price($listing['products_id'])) { 
         $price = '<s>' .  $price . '</s>' . ($last ? '<br />' : '  ') . '<span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>';
       }
     	} 
    $price = ($p_price > 0 ? '' . $price . '' : '' . TEXT_POA); 
    if (function_exists(tep_get_att_price)) $price .= (tep_get_att_price($listing['products_id']) > 0 ? '+' : '') ; 

 return '<span class="productListing-list-price">' . $price . '</span>'; 

 

 

Not tested, let me know if it works OK wink.gif

 

Works perfect, THANKS A LOT!

 

 

For attributes we have a field for sort order when we add/edit product, i don't remember if this is a standard feature in OSC or a add-on we added, but it would be great if the grid view also would sort the attributes drop down.

Share this post


Link to post
Share on other sites

Atickmobiles.com.au

 

Hello thanks again for the contribution, i would like to show my site (still on progress) and a live thing that will show this contribution works..

 

Just one problem .. i am using before the dropdown list for Brands(or Manufaturer) .. then when i add a manufaturer i got an error for unexpected ">" on line 54.. then i planned to overwrite my files with the one in the package but it turned into lists..

 

any idea how can i turn it back on drop down list or maybe like make it the same layout with my categories much better?

 

here is my manufacturers php and categories php..

 

Categories

 

<?php
/*
 $Id: categories.php,v 1.25 2003/07/09 01:13:58 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
 function tep_show_category($counter, $count) {
      global $tree, $categories_string, $cPath_array, $ii;

if ($count ==0 ) $kk=' class="bg_list_sub"'; else $kk=''; 

$count++;

if(!$tree[$counter]['level']){ 
$categories_string .= $categories_string ? '' : ''; 
$categories_string .= '<li'.$kk.'><a href=';
if ($tree[$counter]['parent'] == 0) {
$cPath_new = 'cPath=' . $counter;
} else {
$cPath_new = 'cPath=' . $tree[$counter]['path'];
}
$categories_string .= tep_href_link('index.php', $cPath_new) . '>';

// display categry name
   $categories_string .= $tree[$counter]['name'];
   $categories_string .= '</a></li>';

  }else{  // SUBCATEGORY
   $count = 2;
   $categories_string .= '';

   for($i=0;$i<$tree[$counter]['le vel'];$i++)
    $categories_string .= '';

   $categories_string .= '<li class="bg_list_un"><a href=';   
   if ($tree[$counter]['parent'] == 0) {
     $cPath_new = 'cPath=' . $counter;
   } else {
     $cPath_new = 'cPath=' . $tree[$counter]['path'];
   }
   $categories_string .= tep_href_link('index.php', $cPath_new) . '>';
// display category name
   $categories_string .= $tree[$counter]['name'];
   $categories_string .= '</a></li>';
    }



   if ($tree[$counter]['next_id'] != false && $ii < 30) {
     tep_show_category($tree[$counter]['next_id'], $count);
   }  
 }
?>
<!-- categories //-->
         <tr>
           <td valign="top">
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES);

 new infoBoxHeading($info_box_contents, true, false);

 $categories_string = '<ul>';
 $tree = array();

 $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
 while ($categories = tep_db_fetch_array($categories_query))  {
   $tree[$categories['categories_id']] = array('name' => $categories['categories_name'],
                                               'parent' => $categories['parent_id'],
                                               'level' => 0,
                                               'path' => $categories['categories_id'],
                                               'next_id' => false);

   if (isset($parent_id)) {
     $tree[$parent_id]['next_id'] = $categories['categories_id'];
   }

   $parent_id = $categories['categories_id'];

   if (!isset($first_element)) {
     $first_element = $categories['categories_id'];
   }
 }

 //------------------------
 if (tep_not_null($cPath)) {
   $new_path = '';
   reset($cPath_array);
   while (list($key, $value) = each($cPath_array)) {
     unset($parent_id);
     unset($first_id);
     $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
     if (tep_db_num_rows($categories_query)) {
       $new_path .= $value;
       while ($row = tep_db_fetch_array($categories_query)) {
         $tree[$row['categories_id']] = array('name' => $row['categories_name'],
                                              'parent' => $row['parent_id'],
                                              'level' => $key+1,
                                              'path' => $new_path . '_' . $row['categories_id'],
                                              'next_id' => false);

         if (isset($parent_id)) {
           $tree[$parent_id]['next_id'] = $row['categories_id'];
         }

         $parent_id = $row['categories_id'];

         if (!isset($first_id)) {
           $first_id = $row['categories_id'];
         }

         $last_id = $row['categories_id'];
       }
       $tree[$last_id]['next_id'] = $tree[$value]['next_id'];
       $tree[$value]['next_id'] = $first_id;
       $new_path .= '_';
     } else {
       break;
     }
   }
 }
$count = 0;
 tep_show_category($first_element, $count); 
$categories_string .='</ul>';
 $info_box_contents = array();
 $info_box_contents[] = array('text' => $categories_string);

 new infoBox($info_box_contents);
?>
           </td>
         </tr>
<!-- categories_eof //-->

Manufacturers

 

<?php
/*
 $Id: manufacturers.php,v 1.19 2003/06/09 22:17:13 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
 if ($number_of_rows = tep_db_num_rows($manufacturers_query)) {
?>
<!-- manufacturers //-->
<tr><td>         

<?php
   $info_box_contents = array();
   $info_box_contents[] = array('text' => BOX_HEADING_MANUFACTURERS);

   new infoBoxHeading($info_box_contents, false, false);

   if ($number_of_rows <= MAX_DISPLAY_MANUFACTURERS_IN_A_LIST) {

// Display a list
     $manufacturers_list = '';
     while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
       $manufacturers_name = ((strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN) ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name']);
       if (isset($HTTP_GET_VARS['manufacturers_id']) && ($HTTP_GET_VARS['manufacturers_id'] == $manufacturers['manufacturers_id'])) $manufacturers_name = '<b>' . $manufacturers_name .'</b>';
       $manufacturers_list .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id']) . '">' . $manufacturers_name . '</a><br>';
     }

     $manufacturers_list = substr($manufacturers_list, 0, -4);

     $info_box_contents = array();
     $info_box_contents[] = array('text' => $manufacturers_list);
   } else {
// Display a drop-down
     $manufacturers_array = array();
     if (MAX_MANUFACTURERS_LIST < 2) {
       $manufacturers_array[] = array('id' => '', 'text' => PULL_DOWN_DEFAULT);
     }

     while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
       $manufacturers_name = ((strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN) ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name']);
       $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],
                                      'text' => $manufacturers_name);
     }

$info_box_contents[] = array('form' => tep_draw_form('manufacturers', tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'get'),
                                  'text' => (isset($_GET['sort']) ? tep_draw_hidden_field('sort', $_GET['sort']) : '') . (isset($_GET['list']) ? tep_draw_hidden_field('list', $_GET['list']) : '') . (isset($_GET['max']) ? tep_draw_hidden_field('max', $_GET['max']) : '') . tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, (isset($HTTP_GET_VARS['manufacturers_id']) ? $HTTP_GET_VARS['manufacturers_id'] : ''), 'onChange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '" style="width: 100%"') . tep_hide_session_id());
								</table>												
								');
   }

   new infoBox($info_box_contents);
?>

     </td></tr>   
<!-- manufacturers_eof //-->
<?php
 }
?>

Edited by halluzineyt

Share this post


Link to post
Share on other sites

Attribute sort order

For attributes we have a field for sort order when we add/edit product, i don't remember if this is a standard feature in OSC or a add-on we added, but it would be great if the grid view also would sort the attributes drop down.

 

There is no sort order on the default osC

The order is done in the query, line 384 you will find:

 

order by popt.products_options_name

change that to:

 

order by popt.sort_order

if your field is called sort_order, that also assumes the sort field is within the options table, if its in the attributes table it would need to be:

 

order by patrib.sort_order


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

 

 

If you look at the install instructions, the change for includes/boxes/manufacturers.php is quite simple,

 

the original has

 

 'text' => tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array,(isset($HTTP_GET_VARS['manufacturers_id']) ? $HTTP_GET_VARS['manufacturers_id'] : ''),

 

that is replaced by:

 

'text' => (isset($_GET['sort']) ? tep_draw_hidden_field('sort', $_GET['sort']) : '') . (isset($_GET['list']) ? tep_draw_hidden_field('list', $_GET['list']) : '') . (isset($_GET['max']) ? tep_draw_hidden_field('max', $_GET['max']) : '') . tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, (isset($HTTP_GET_VARS['manufacturers_id']) ? $HTTP_GET_VARS['manufacturers_id'] : ''), 

 

so its simply addding:

 

(isset($_GET['sort']) ? tep_draw_hidden_field('sort', $_GET['sort']) : '') . (isset($_GET['list']) ? tep_draw_hidden_field('list', $_GET['list']) : '') . (isset($_GET['max']) ? tep_draw_hidden_field('max', $_GET['max']) : '') 

 

to ensure that any new query string params that may be in use are not lost by simply selecting another manufacturer.


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

Attribute sort order

 

There is no sort order on the default osC

The order is done in the query, line 384 you will find:

 

order by popt.products_options_name

change that to:

 

order by popt.sort_order

if your field is called sort_order, that also assumes the sort field is within the options table, if its in the attributes table it would need to be:

 

order by patrib.sort_order

 

Tried but both both gave error, i checked in sql sort order is stored in products_options_sort_order and is in the main table products_attributes

Share this post


Link to post
Share on other sites

Tried but both both gave error, i checked in sql sort order is stored in products_options_sort_order and is in the main table products_attributes

 

 

OK, glad you sorted it then. smile.gif


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

OK, glad you sorted it then. smile.gif

 

Not yet dont have any coding skills :(, but a guess would be order by patrib.products_options_sort_order ?

Share this post


Link to post
Share on other sites

Not yet dont have any coding skills sad.gif, but a guess would be order by patrib.products_options_sort_order ?

 

Yes, order by patrib.products_options_sort_order would be correct, see coding is easy!! biggrin.gif


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

Attribute sort order

 

There is no sort order on the default osC

The order is done in the query, line 384 you will find:

 

order by popt.products_options_name

change that to:

 

order by popt.sort_order

if your field is called sort_order, that also assumes the sort field is within the options table, if its in the attributes table it would need to be:

 

order by patrib.sort_order

 

 

tnx sir but my manufacturer.php looks like this

 

<?php
/*
 $Id: manufacturers.php,v 1.19 2003/06/09 22:17:13 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
 if ($number_of_rows = tep_db_num_rows($manufacturers_query)) {
?>
<!-- manufacturers //-->
<tr><td>         

<?php
   $info_box_contents = array();
   $info_box_contents[] = array('text' => BOX_HEADING_MANUFACTURERS);

   new infoBoxHeading($info_box_contents, false, false);

   if ($number_of_rows <= MAX_DISPLAY_MANUFACTURERS_IN_A_LIST) {
// Display a list
     $manufacturers_list = '';
     while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
       $manufacturers_name = ((strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN) ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name']);
       if (isset($HTTP_GET_VARS['manufacturers_id']) && ($HTTP_GET_VARS['manufacturers_id'] == $manufacturers['manufacturers_id'])) $manufacturers_name = '<b>' . $manufacturers_name .'</b>';
       $manufacturers_list .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id']) . '">' . $manufacturers_name . '</a><br>';
     }

     $manufacturers_list = substr($manufacturers_list, 0, -4);

     $info_box_contents = array();
     $info_box_contents[] = array('text' => $manufacturers_list);
   } else {
// Display a drop-down
     $manufacturers_array = array();
     if (MAX_MANUFACTURERS_LIST < 2) {
       $manufacturers_array[] = array('id' => '', 'text' => PULL_DOWN_DEFAULT);
     }

     while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
       $manufacturers_name = ((strlen($manufacturers['manufacturers_name']) > MAX_DISPLAY_MANUFACTURER_NAME_LEN) ? substr($manufacturers['manufacturers_name'], 0, MAX_DISPLAY_MANUFACTURER_NAME_LEN) . '..' : $manufacturers['manufacturers_name']);
       $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],
                                      'text' => $manufacturers_name);
     }

[color="#FF0000"]      $info_box_contents = array();
     $info_box_contents[] = array('form' => tep_draw_form('manufacturers', tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'get'),
                                  'text' => '
								<table cellpadding="0" cellspacing="0" border="0" style=" width:170px;">
									<tr><td><br style="line-height:1px;"><br style="line-height:3px;">'. tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, (isset($HTTP_GET_VARS['manufacturers_id']) ? $HTTP_GET_VARS['manufacturers_id'] : ''), 'onChange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '" class="jamp" ') . tep_hide_session_id().'</td></tr>
								</table>	[/color]											
								');
   }

   new infoBox($info_box_contents);
?>

     </td></tr>   
<!-- manufacturers_eof //-->
<?php
 }
?>

 

that part look different to me but i just replaced the whole

 

$info_box_contents = array();
     $info_box_contents[] = array('form' => tep_draw_form('manufacturers', tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'get'),
                                  'text' => '
								<table cellpadding="0" cellspacing="0" border="0" style=" width:170px;">
									<tr><td><br style="line-height:1px;"><br style="line-height:3px;">'. tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, (isset($HTTP_GET_VARS['manufacturers_id']) ? $HTTP_GET_VARS['manufacturers_id'] : ''), 'onChange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '" class="jamp" ') . tep_hide_session_id().'</td></tr>
								</table>

 

with

 

info_box_contents[] = array('form' => tep_draw_form('manufacturers', tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false), 'get'), 'text' => (isset($_GET['sort']) ? tep_draw_hidden_field('sort', $_GET['sort']) : '') . (isset($_GET['list']) ? tep_draw_hidden_field('list', $_GET['list']) : '') . (isset($_GET['max']) ? tep_draw_hidden_field('max', $_GET['max']) : '') . tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, (isset($HTTP_GET_VARS['manufacturers_id']) ? $HTTP_GET_VARS['manufacturers_id'] : ''), 'onChange="this.form.submit();" size="' . MAX_MANUFACTURERS_LIST . '" style="width: 100%"') . tep_hide_session_id());

 

 

 

 

it works on the first time but when i added a manufacturer i got that error..

Share this post


Link to post
Share on other sites

 

 

Why are you quoting unrelated posts?

 

Try just making the addition I gave to you b4.


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

Yes, order by patrib.products_options_sort_order would be correct, see coding is easy!! biggrin.gif

 

It didn't give any error on the page so thats good, but it doesn't sort the attribute drop down either :( Any ideas?

Share this post


Link to post
Share on other sites

It didn't give any error on the page so thats good, but it doesn't sort the attribute drop down either sad.gif Any ideas?

 

 

There could be a number of reasons, if you simply give the code you were originally using it would make it much easier to tell


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

There could be a number of reasons, if you simply give the code you were originally using it would make it much easier to tell

 

Currently the sort order is used on the product_info page, this is the relevant code that i could find in that file, that sort and present the dropdown there.

 

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

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

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 class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>

<td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?

Share this post


Link to post
Share on other sites

 

 

in product_listing.php change the

products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");

 

to

products_options_values_id and pov.language_id = '" . (int)$languages_id . "' order by  pa.products_options_sort_order");

 

 

the previous query should have order by popt.products_options_sort_order but I assume you already did that?

Edited by spooks

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

in product_listing.php change the

products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");

 

to

products_options_values_id and pov.language_id = '" . (int)$languages_id . "' order by  pa.products_options_sort_order");

 

 

the previous query should have order by popt.products_options_sort_order but I assume you already did that?

 

worked like a charm! T H A N K S !

Share this post


Link to post
Share on other sites

Hi all,

 

First: amazing contrib¡

 

I try to create some icons in the product thumb in the product listing with aditional info like special price, new,...

 

I try to install this one "New Product Icon" http://addons.oscommerce.com/info/2690 and this other one Display Specials Discount Percentage http://addons.oscommerce.com/info/6838 ... At the end, I can't do it...

 

This is a good example:

http://picasaweb.google.com/lh/photo/5-x-1OeMmCsoL0GW9Lw8hg?feat=directlink

 

 

 

Other idea is add some icons or text with labels depends of the attribute. For example, ads one woman icon for woman clothing...

 

I don't know If somebody have develops this for the contribution Product Listing...[/code]

 

Thanks¡

Javier

Share this post


Link to post
Share on other sites

Hey Sam,

 

thanks for adding the average rating feature to the latest package. But, I'm going to be difficult now and ask - how do I add just the average rating to my current product listing without updating the most recent package? The reason I don't want to upgrade is because I’m happy with the way my product listing looks/works at the moment and if it ain't broke... (also some of the new updates don't suit site, like moving the price onto the same line as the product title)

 

I have tried to find all code relating to the average rating feature and added it in to my product listing where I think it should, go but don't get any results (no errors either). This is my product listing below with the added code in bold. Could you tell me where I'm going wrong? (I'm using manufacturer in blocks view)

 

Thanks.

 

 

<?php

/*

$Id: product_listing.php, v 2.2 2009/11/25 22:49:59 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

 

$graphic_bord = 'no'; // set to 'yes' if you have older 'graphic borders' and not 'easy graphic borders'.

$cat_path = false; // set to true to include category paths in urls

$no_drop = true; // set to true to remove resuls/page & sort order drop downs

$set_width = true; // set to false to allow columns to find their own widths in list mode

$ttip = false; // set to true to display tool tip pics on hover

$ttip_width = 200; // width of tooltip image on hover

$show_extra_fields = true; // set to true if you have products_extra_fields installed & you want to display the fields in the listing

$head_title = true; // Set to true so each listing entry will have its own product TITLE header (list modes only)

$multi_add = true; // Set to true to enable adding mutiple items to the cart at once

$global_add = 'both'; // If $multi_add = true, set position of buy button, top, bottom or both (ie the ends of the listing)

$qty_drop = false;// Set to true to have a drop down for quantity box instead of a input box

$last_size = 2;// set the size of the last column in block mode

$show_ratings = true; // set to true to show the products average review rating

 

 

if (tep_not_null($HTTP_GET_VARS['sort'])) $_GET['sort'] = $HTTP_GET_VARS['sort'];

$max_results = (tep_not_null($_GET['max']) ? $_GET['max'] : MAX_DISPLAY_SEARCH_RESULTS);

if (PRODUCTS_PER_ROW == 'PRODUCTS_PER_ROW' || PRODUCTS_PER_ROW == 0 || LISTING_SWITCH == 'LISTING_SWITCH') { $to = 'Setup Error!\nPlease ensure you have run the\nProduct Listing Setup File.' ; print "<script>alert('$to');</script>"; }

 

// sort order array

if ($_GET['sort'] == '0d') $sort_array[] = array('id' => 0 . 'd', 'text' => DATE_ORDER);

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

switch ($column_list[$i]) {

case 'PRODUCT_LIST_MODEL':

$sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_MODEL . APHA_ORDER);

break;

case 'PRODUCT_LIST_NAME':

$sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_PRODUCTS . APHA_ORDER);

break;

case 'PRODUCT_LIST_MANUFACTURER':

$sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_MANUFACTURER . APHA_ORDER);

break;

case 'PRODUCT_LIST_QUANTITY':

$sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_QUANTITY . NUM_ORDER);

break;

case 'PRODUCT_LIST_WEIGHT':

$sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_WEIGHT . NUM_ORDER);

break;

case 'PRODUCT_LIST_PRICE':

$sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_PRICE . NUM_ORDER);

break;

}

}

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

switch ($column_list[$i]) {

case 'PRODUCT_LIST_MODEL':

$sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_MODEL . REVERSE_ALPHA_ORDER);

break;

case 'PRODUCT_LIST_NAME':

$sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_PRODUCTS . REVERSE_ALPHA_ORDER);

break;

case 'PRODUCT_LIST_MANUFACTURER':

$sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_MANUFACTURER . REVERSE_ALPHA_ORDER);

break;

case 'PRODUCT_LIST_QUANTITY':

$sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_QUANTITY . REVERSE_NUM_ORDER);

break;

case 'PRODUCT_LIST_WEIGHT':

$sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_WEIGHT . REVERSE_NUM_ORDER);

break;

case 'PRODUCT_LIST_PRICE':

$sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_PRICE . REVERSE_NUM_ORDER);

break;

}

}

// Max Results Array

for ($i=1; $i<10; $i++) {

$max_display[] = array('id' => MAX_DISPLAY_SEARCH_RESULTS * $i, 'text' => MAX_DISPLAY_SEARCH_RESULTS * $i);

}

$max_display[] = array('id' => 1000000, 'text' => 'Show All');

// store GET vars

$get_vars = '';

reset($_GET);

while (list($key, $value) = each($_GET)) {

if ( ($key != 'sort') && ($key != 'max') && ($key != tep_session_name()) && ($key != 'x') && ($key != 'y') ) {

$get_vars .= tep_draw_hidden_field($key, $value);

}

}

$top_nav = ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'));

$base_nav = ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'));

$listing_split = new splitPageResults($listing_sql, $max_results, 'p.products_id');

$data_ok = ($listing_split->number_of_rows > 0);

 

$gbutton = ($data_ok ? tep_image_submit('button_multi_in_cart.gif', MULTI_ADD_ALT) : '') . '</div>';

$page_nav = '<table border="0" width="100%" cellspacing="0" cellpadding="2"><tr><td class="smallText">' . $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS) . '</td><td class="smallText" align="right">' . TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))) . '</td></tr></table>';

$drop = $no_drop ? '' : '<table border="0" width="100%" cellspacing="0" cellpadding="2" class="drop"><tr><td class="smallText">Results/Page: '. tep_draw_form('maxdisplay', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get') . $get_vars . (isset($_GET['sort']) ? tep_draw_hidden_field('sort', $_GET['sort']) : '') . tep_draw_pull_down_menu('max', $max_display, $_GET['max'], 'onChange="this.form.submit();"') . tep_hide_session_id().'</form></td><td class="smallText" align="right">Sort Order: ' . tep_draw_form('sorting', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get') . $get_vars . (isset($_GET['max']) ? tep_draw_hidden_field('max', $_GET['max']) : '') . tep_draw_pull_down_menu('sort', $sort_array, $_GET['sort'], 'onChange="this.form.submit();"') . tep_hide_session_id().'</form></td></tr></table>';

if ( ($listing_split->number_of_rows > (int)$max_results) && $top_nav ) echo $page_nav;

if ($top_nav && $data_ok) echo '<div id="drop1">' . $drop . '</div>';

if ($multi_add) { echo tep_draw_form('cart_quantity', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','products_id')) . 'action=add_multi')); if ($global_add != 'bottom') echo '<div class="multi_buy_now" id="gbutton1" align="right">' . $gbutton; }

 

 

if (($show_ratings || PRODUCT_LIST_DESCRIPTION ) && $data_ok) {

$listing_query = tep_db_query($listing_split->sql_query);

while ($products = tep_db_fetch_array($listing_query)) $id_array[] = $products['products_id'];

$pid_string = implode(',', array_unique($id_array));

}

if (PRODUCT_LIST_DESCRIPTION && $data_ok) {

$product_query = tep_db_query("select products_id, products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id in (" . $pid_string . ") and language_id = '" . (int)$languages_id . "'");

while ($products = tep_db_fetch_array($product_query)) {

$t_desc[$products['products_id']] = substr(strip_tags($products['products_description']), 0, PRODUCT_LIST_DESCRIPTION_MAX_LENGTH);

}

}

if ($show_ratings && $data_ok) {

$rating_query = tep_db_query("select count(*) as count, products_id, sum(reviews_rating) as total from " . TABLE_REVIEWS . " where products_id in (" . $pid_string . ") group by products_id");

while ($rating = tep_db_fetch_array($rating_query)) {

$review[$rating['products_id']] = ceil($rating['total'] / $rating['count']);

}

}

 

 

 

 

 

function tep_get_category_name($category_id, $language_id) {

$category_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$category_id . "' and language_id = '" . (int)$language_id . "'");

$category = tep_db_fetch_array($category_query);

 

return $category['categories_name'];

}

function tep_get_manufacturer_name($manufacturer_id) {

$manufacturers_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$manufacturer_id . "'");

$manufacturer = tep_db_fetch_array($manufacturers_query);

 

return $manufacturer['manufacturers_name'];

}

 

function extra_fields($products_id) {

global $languages_id, $show_extra_fields;

$extra_fields_text = '';

if ($show_extra_fields) {

$extra_fields_query = tep_db_query("SELECT pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef, ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf WHERE ptf.products_extra_fields_id=pef.products_extra_fields_id and ptf.products_id=". (int) $products_id ." and (pef.languages_id = '0' or pef.languages_id = '".(int)$languages_id."') and ptf.products_extra_fields_value <> '' and pef.products_extra_fields_status ORDER BY pef.products_extra_fields_order");

while ($extra_fields = tep_db_fetch_array($extra_fields_query)) {

$extra_fields_text .= '<tr><td class="smallText"><span class="xtra-field-name">' . $extra_fields['name'] . ': </span><span class="xtra-field-value">' . $extra_fields['value'] . '</span></td></tr>';

}

}

return $extra_fields_text;

}

 

function product_description($product_id,$link,$thumb=false) {

global $head_title, $t_desc, $review;

if ($review[$product_id]) $rating = '<span class="smallText"><br />' . sprintf(TEXT_AVERAGE_REVIEW, tep_image(DIR_WS_IMAGES . 'stars_' . $review[$product_id] . '.gif',sprintf(TEXT_AVERAGE_REVIEW,$review[$product_id]))) . '</span>';

if (PRODUCT_LIST_DESCRIPTION) {

return ($head_title || $thumb ? '' : '<br />') . '<span class="productListing-short">' . $t_desc[$product_id] . $link . '<b>...' . MORE . '</b></a></span>' . $rating;

} else {

return $rating;

}

}

 

 

 

function list_row ($listing, $column_list) {

global $rows, $gborders, $list_box_contents, $cPath, $cat_path, $head_title;

$list_box_contents[][] = array('text' => '<br />');

if (!$rows && $gborders) $list_box_contents = array();

$rows++;

$man_id = (tep_not_null($_GET['manufacturers_id']) ? $_GET['manufacturers_id'] : '');

$link = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id'] . ($man_id ? '&manufacturers_id='.$man_id : ($cPath && $cat_path ? '&cPath=' . $cPath : '')) ) . '"' . ($man_id || ($cat_path && $cat_path) ? ' rel="nofollow"' : '') . '>';

if ($head_title) { $list_box_contents[][] = array('align' => 'left',

'params' => 'colspan="'.sizeof($column_list).'" class="productListing-title"',

'text' => $link . '<b>' . $listing['products_name'] . '</b></a>');}

$list_box_contents[] = list_box_data($listing, $column_list, $link);

$list_box_contents[][] = array('align' => 'center',

'params' => 'class="separator" colspan="'.sizeof($column_list).'"',

'text' => '<br />');

return true;

}

?>

<script type="text/javascript" language="javascript">

<!--

function changeValue(inObject,delta)

{ var myVal = parseInt(inObject.value);

isNaN(myVal) ? myVal = delta : myVal = myVal + delta;

inObject.value = Math.max(myVal,0);

return; }

 

// -->

</script>

<?php

function quantity ($products_id) {

global $multi_add, $qty_drop, $thumbnail_view;

 

if (PRODUCT_LIST_QUANTITY_BOX == 'true' && strstr(LISTING_BUTTON, 'buy now')) {

if (tep_has_product_attributes($products_id) && PRODUCT_LIST_OPTIONS != 'true') return false;

if (!$qty_drop)

return '<table cellspacing="0" cellpadding="0"><tr><td class="quantity" >' . QUANTITY . tep_draw_input_field('cart_quantity' . ($multi_add ? '[]' : '') , ($multi_add ? '0' : '1') , 'maxlength="5" size="1" STYLE="text-align:center" id="qid'.$products_id.'"') . ($multi_add ? tep_draw_hidden_field('products_id[]', $products_id) : '') . '</td><td><a href="javascript:changeValue(document.getElementById(\'qid'.$products_id.'\'),1);">' . tep_image_button('btn_up.gif',MORE) . '</a><br><a href="javascript:changeValue(document.getElementById(\'qid'.$products_id.'\'),-1);">' . tep_image_button('btn_down.gif',LESS) . '</a></td></tr></table>';

else

$qty_array = array(); $pstock = min(tep_get_products_stock($products_id),MAX_QTY_IN_CART);

for ($i=0; $i<=$pstock; $i++) { $qty_array[]=array('id' => $i, 'text' => $i); }

return ($pstock ? '<div class="quantity" align="' . (strstr($thumbnail_view, 'thumbnails') ? 'center' : 'right' ) .'">' . QUANTITY . tep_draw_pull_down_menu('cart_quantity'.($multi_add ? '[]' : ''),$qty_array,($multi_add ? 0 : 1)) . '<br />' . ($multi_add ? tep_draw_hidden_field('products_id[]', $products_id) : '') . '</div>' : false);

} else { return false; }

}

 

function list_box_head($column_list) {

global $set_width;

for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {

switch ($column_list[$col]) {

case 'PRODUCT_LIST_MODEL':

$lc_text = TABLE_HEADING_MODEL;

$lc_align = 'center';

break;

case 'PRODUCT_LIST_NAME':

$lc_text = TABLE_HEADING_PRODUCTS;

$lc_align = '';

break;

case 'PRODUCT_LIST_MANUFACTURER':

$lc_text = TABLE_HEADING_MANUFACTURER;

$lc_align = 'center';

break;

case 'PRODUCT_LIST_PRICE':

$lc_text = TABLE_HEADING_PRICE;

$lc_align = 'right';

break;

case 'PRODUCT_LIST_PRICE_EX':

$lc_text = TABLE_HEADING_PRICE_EX;

$lc_align = 'center';

break;

case 'PRODUCT_LIST_QUANTITY':

$lc_text = TABLE_HEADING_QUANTITY;

$lc_align = 'right';

break;

case 'PRODUCT_LIST_WEIGHT':

$lc_text = TABLE_HEADING_WEIGHT;

$lc_align = 'right';

break;

case 'PRODUCT_LIST_IMAGE':

$lc_text = TABLE_HEADING_IMAGE;

$lc_align = 'center';

break;

case 'PRODUCT_LIST_BUY_NOW':

$lc_text = (PRODUCT_LIST_OPTIONS == 'true' ? 'Product Options</td><td align="center" class="productListing-heading">' : '') . (strstr(LISTING_BUTTON, 'buy now')? TABLE_HEADING_BUY_NOW : TABLE_HEADING_DETAIL);

$lc_align = 'center';

break;

}

if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {

$lc_text = tep_create_sort_heading($_GET['sort'], $col+1, $lc_text);

}

$list_box_contents[] = array('align' => $lc_align,'params' => 'class="productListing-heading" ' . ($set_width ? 'width="'.(int)(100/sizeof($column_list)) . '%"' : ''),'text' => ' ' . $lc_text . ' ');

}

return ($list_box_contents);

}

// function list_head end

 

function list_box_data($listing, $column_list, $link) {

global $PHP_SELF, $ttip, $ttip_width, $head_title, $rows, $set_width, $multi_add, $last_size;

$currencies = new currencies();

$alt_text = $listing['products_name'];

$image = (file_exists(DIR_WS_IMAGES . $listing['products_image']) ? $listing['products_image'] : 'no-image.jpg');

$image = '<span class="ttip">' . $link . tep_image(DIR_WS_IMAGES . $image, $alt_text, PRODUCT_IMAGE_WIDTH, PRODUCT_IMAGE_HEIGHT) . ($ttip ? tep_image(DIR_WS_IMAGES . $image, $alt_text, $ttip_width, '', 'class="large"') : '' ) . '</a></span>';

$name = (!$head_title ? $link.'<b>' . $listing['products_name'] . '</b></a>' : ' ');

if (LISTING_BUTTON != 'none' && PRODUCT_LIST_BUY_NOW) {

$buypic = (LISTING_BUTTON == 'buy now' ? 'button_in_cart.gif' : 'button_buy_now.gif');

$quantity_box = quantity ($listing['products_id']);

$form = ($multi_add ? '' : tep_draw_form('cart_quantity_' . $rows, tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','products_id')) . 'action=add_product')));

$buytable = '<table class="buytable" border="0" width="100%" cellspacing="0" cellpadding="2"><tr><td valign="top" class="productListing-data">';

$buytableend = '</td></tr></table>'. ($multi_add ? '' : '</form>');

$detail = $link . tep_image_button((strstr(LISTING_BUTTON, '&') || (strstr(LISTING_BUTTON, 'small')) ? 'button_details_small.gif' : 'button_details.gif'), IMAGE_BUTTON_DETAILS, 'class="thm_buy_now"') . '</a> ';

$add_cart = ($multi_add ? ($quantity_box && PRODUCT_LIST_QUANTITY_BOX == 'true' ? '' : $detail) : tep_draw_hidden_field('products_id', $listing['products_id']) . tep_image_submit($buypic, IMAGE_BUTTON_BUY_NOW, 'class="thm_buy_now"'));

$button = (LISTING_BUTTON == 'buy now & details' ? ($add_cart == $detail ? $add_cart : $add_cart . ' <span class="buy_now">|</span> ' . $detail ) : (strstr(LISTING_BUTTON, 'buy now') ? $add_cart : $detail ));

if ($listing['products_price'] == 0 || (isset($listing['products_quantity']) && !$listing['products_quantity'])) { $button = $detail; $quantity_box = '';}//'<span class="buy_now"> </span>'.

}

$list_box_temp = array('params' => 'class="list-block"');

if (!strstr(PRODUCT_THUMBNAIL_VIEW, 'block')) {

for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {

$lc_align = '';

$params = 'class="productListing-data" ' . ($set_width ? 'width="'.(int)(100/sizeof($column_list)) . '%"' : '') . ' valign="top" ';

switch ($column_list[$col]) {

case 'PRODUCT_LIST_MODEL':

$lc_align = 'center';

$lc_text = ' ' . $listing['products_model'] . ' ';

break;

case 'PRODUCT_LIST_NAME':

$lc_align = '';

$lc_text = $name . ($listing['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? '<br /><span class="short">' . $listing['short_desc'] . '</span>' : '');

$extra_fields_text = extra_fields($listing['products_id']);

if ($extra_fields_text) $lc_text .= '<br /><table>' . $extra_fields_text . '</table>';

break;

case 'PRODUCT_LIST_MANUFACTURER':

$lc_align = 'center';

$lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a> ';

break;

case 'PRODUCT_LIST_PRICE':

$lc_align = 'right';

$lc_text = '<span class="productListing-list-price">';

$price = (function_exists(display_short_price)) ? $currencies->display_short_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) : $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id']));

if (tep_not_null($listing['specials_new_products_price'])) {

$lc_text .= '<s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span><BR><span class="productSpecialPriceEX">(' . $currencies->display_price_ex($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ex.vat)</span><br>';

} else {

$lc_text .= ($listing['products_price'] > 0 ? '' . $price . '  ' : ' ' . TEXT_POA). '  <br><span class="productPriceEX">(' . $currencies->display_price_ex($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ex.vat)</span><br>';

if (function_exists(tep_get_att_price)) $lc_text .= (tep_get_att_price($listing['products_id']) > 0 ? '+' : ' ') ;

}

$lc_text .= '</span>';

 

break;

case 'PRODUCT_LIST_QUANTITY':

$lc_align = 'right';

$lc_text = ' ' . $listing['products_quantity'] . ' ';

break;

case 'PRODUCT_LIST_WEIGHT':

$lc_align = 'right';

$lc_text = ' ' . $listing['products_weight'] . ' ';

break;

case 'PRODUCT_LIST_IMAGE':

$lc_align = 'center';

$lc_text = $image;

break;

case 'PRODUCT_LIST_BUY_NOW':

if (PRODUCT_LIST_OPTIONS == 'true' ) $params = 'class="productListing-data" width="'.(int)((100/sizeof($column_list))*2).'%" colspan="2"';

$lc_align = 'center';

$button = $quantity_box . $button;

$lc_text = $form . $buytable . (PRODUCT_LIST_OPTIONS == 'true' ? attribute_drop($listing['products_id'],$listing['products_tax_class_id']) . '</td><td align="center" class="productListing-data">' . $button : $button) . $buytableend;

break;

}

$list_box_temp[] = array('align' => $lc_align,

'params' => $params,

'text' => $lc_text);

}

} else {

if (PRODUCT_LIST_IMAGE) { $list_box_temp[] = array('align' => 'center',

'params' => 'class="productListing-data" ',

'text' => $image); }

$display ='';$text = '';

for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {

$last = (($col + $last_size + 1) > $n);

$text .= ($text ? '<br />' : '');

switch ($column_list[$col]) {

case 'PRODUCT_LIST_MODEL':

$text .= $listing['products_model'];

if (!$last) {$display .= $text . '<br />'; $text = '';}

break;

case 'PRODUCT_LIST_NAME':

$text .= $name . ($listing['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? '<br /><span class="short">' . $listing['short_desc'] . '</span>' : '');

$extra_fields_text = extra_fields($listing['products_id']);

if ($extra_fields_text) $text .= '<br /><table>' . $extra_fields_text . '</table>';

 

 

if ($listing['products_multi_pack'] == true) {

$text .= '<span class="productPriceEX">' . MULTI_PACK_PRODUCT . '</span>';

 

} else {

 

}

 

if ($listing['products_high_capacity'] == true) {

$text .= '<span class="productPriceEX">' . HIGH_CAPACITY_PRODUCT . '</span>';

 

} else {

 

}

 

 

if (!$last) {$display .= $text . '<br />'; $text = '';}

 

break;

case 'PRODUCT_LIST_MANUFACTURER':

$text .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a>';

if (!$last) {$display .= $text . '<br />'; $text = '';}

break;

case 'PRODUCT_LIST_PRICE':

$text .= ($last ? '' : '<br />Price: ') . '<span class="productListing-list-price">';

$price = (function_exists(display_short_price)) ? $currencies->display_short_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) : $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id']));

if (tep_not_null($listing['specials_new_products_price'])) {

$text .= '<s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>' . ($last ? '  ' : '  ') . '<span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span><BR><span class="productSpecialPriceEX">(' . $currencies->display_price_ex($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ex.vat)</span><br>';

} else {

$text .= ($listing['products_price'] > 0 ? '' . $price : '' . TEXT_POA). '  <br><span class="productPriceEX">(' . $currencies->display_price_ex($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ex.vat)</span>';

if (function_exists(tep_get_att_price)) $display .= (tep_get_att_price($listing['products_id']) > 0 ? '+' : ' ') ;

}

 

 

$text .= '</span>' . ($last ? '' : '<br />');

if ($listing['products_free_shipping'] == true) {

$text .= '' . FREE_SHIPPING_FOR_THIS_PRODUCT2 . '';

 

} else {

$text .= '' . FREE_SHIPPING_FOR_THIS_PRODUCT3 . '';

}

if (!$last) {$display .= $text . '<br />'; $text = '';}

 

 

 

break;

case 'PRODUCT_LIST_QUANTITY':

$text .= ($listing['products_quantity'] ? 'Stock = ' . $listing['products_quantity'] : 'Out of Stock');

if (!$last) {$display .= $text . '<br />'; $text = '';}

break;

case 'PRODUCT_LIST_WEIGHT':

$text .= 'Weight = ' . $listing['products_weight'].WEIGHT_ABRV . ($last ? '' : '<br />');

if (!$last) {$display .= $text . '<br />'; $text = '';}

break;

case 'PRODUCT_LIST_BUY_NOW':

$button = '<div align="right" width="100%">' . $quantity_box . '</div>' . ($last ? '' : '  ') . $button;

$text .= $form . $buytable . (PRODUCT_LIST_OPTIONS == 'true' ? '<div ' . ($last ? 'align="right"' : 'align="left"' ) . ' width="100%">' . attribute_drop($listing['products_id'],$listing['products_tax_class_id']) . '</div>' . $button : '' . $button) . $buytableend;

//$display .= ($last ? '' : $text . '<br />');

if (!$last) {$display .= $text . '<br />'; $text = '';}

break;

}

}

$display .= '';

 

$list_box_temp[] = array('align' => 'left',

'params' => 'class="main" valign="top" ',

'text' => $display);

$list_box_temp[] = array('align' => 'right',

'params' => 'class="productListing-data" valign="top" ',

'text' => $text);

}

return ($list_box_temp);

}

// function list_box_data end

 

function attribute_drop($products_id,$tax_class_id) {

global $languages_id, $multi_add;

$currencies = new currencies();

$atrib_drop = '';

$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id='" . (int)$products_id . "'");

$products_attributes = tep_db_fetch_array($products_attributes_query);

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

 

$atrib_drop = '<table border="0" cellspacing="0" cellpadding="2" class="attributes">';

 

$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)$products_id . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");

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

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($tax_class_id)) .') ';

}

}

$atrib_drop .= '<tr><td class="attributes" >' . $products_options_name['products_options_name'] . ':' . '</td><td align="left">' . tep_draw_pull_down_menu('id' . ($multi_add ? '['. $products_id .']' : '') . '[' . $products_options_name['products_options_id'] . ']', $products_options_array) . '</td></tr>';

 

}

$atrib_drop .= '</table>';

}

return $atrib_drop;

}

// function attribute_drop end

 

// set initial values

$thumbnail_view = (isset($_GET['list']) ? $_GET['list'] : PRODUCT_THUMBNAIL_VIEW);

$empty_list=false;

if (isset($_GET['manufacturers_id']) && tep_not_null($_GET['manufacturers_id'])) {

$title_name = tep_get_manufacturer_name($_GET['manufacturers_id']);

} else {

$title_name = (!$category['categories_name'] && tep_not_null($_GET['cPath']) ? tep_get_category_name(substr($_GET['cPath'], strpos($_GET['cPath'],'_')+1),$languages_id) : '');

}

$grid = strstr(PRODUCT_THUMBNAIL_VIEW, 'grid');

$gborders = function_exists(mws_boxHeader);//$gborders = false;

$Tborder = (!$gborders ? '<table class="infoBoxList" width="100%"><tr><td>' : mws_boxHeader('<big>'.$title_name.'</big>'));

$Tborderend = (!$gborders ? '</td></tr></table>' : mws_boxFooter ());

$border2 = (!$gborders ? '<table class="infoBoxList" width="100%"><tr><td>' : ($graphic_bord == 'yes' ? mws_boxHeader('<big>'.$title_name.'</big>') : ''));

$border2end = (!$gborders ? '</td></tr></table>' : ($graphic_bord == 'yes' ? mws_boxFooter() : ''));

$list_box_empty[] = array(array('params' => 'class="productListing-data"','text' => TEXT_NO_PRODUCTS));

 

if (tep_not_null($_GET['categories_id']) && $current_category_id == 0) $current_category_id = $_GET['categories_id'];

 

// output selected display

if (strstr($thumbnail_view, 'thumbnails')) { //thumbnail

$row = 0;

$col = 0;

$border = (!$grid ? '<table class="infoBoxProducts" cellpadding="2" width="'.PRODUCT_LIST_WIDTH.'" height="'.PRODUCT_LIST_HEIGHT.'" ><tr><td valign="top">' : '<br />');

$borderend = (!$grid ? '</td></tr></table>' : '');

$style = (!$grid ? 'class="smallText"' : 'class="infoBoxGrid"');

$info_box_contents = array();

if ($data_ok) { $listing_query = tep_db_query($listing_split->sql_query);} else {

$listing_query = tep_db_query($listing_sql); }

if (tep_db_num_rows($listing_query)) {

while ($products = tep_db_fetch_array($listing_query)) {

if ($row == 0) {

if (!$gborders && !$grid) $info_box_contents[$row][$col] = array('align' => 'center',

'params' => 'class="smallText" width="'.(PRODUCTS_PER_ROW ? (int)(100/PRODUCTS_PER_ROW) : '').'%" valign="top"',

'text' => ' ');

echo $Tborder;$row ++;

}

 

// build thumb

$man_id = (tep_not_null($_GET['manufacturers_id']) ? $_GET['manufacturers_id'] : '');

$link = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id'] . ($man_id ? '&manufacturers_id='.$man_id : ($cPath && $cat_path ? '&cPath=' . $cPath : ''))) . '"' . ($man_id || ($cat_path && $cat_path) ? ' rel="nofollow"' : '') . '>';

$quantity_box = quantity ($products['products_id']);

$image = (file_exists(DIR_WS_IMAGES . $products['products_image']) ? $products['products_image'] : 'no-image.jpg');

$addimages = (file_exists(DIR_WS_CLASSES . 'displayimages.php')); // Additional Images Present

if ($addimages) {

$image_query = tep_db_query( "SELECT ai.medium_images, ai.images_description, ai.popup_images, p.products_image_med, p.products_image_description FROM " . TABLE_ADDITIONAL_IMAGES . " ai, " . TABLE_PRODUCTS . " p WHERE ai.products_id=p.products_id and ai.products_id = '".(int)$products['products_id']."'");

$selected_image = tep_db_fetch_array($image_query);

$image = ($selected_image['medium_images'] ? $selected_image['medium_images'] : ($selected_image['products_image_med'] ? $selected_image['products_image_med'] : ($selected_image['popup_images'] ? $selected_image['popup_images'] : $products['products_image'])));

}

$alt_text = ($addimages ? (tep_not_null($selected_image['images_description']) ? $selected_image['images_description'] : (tep_not_null($selected_image['products_image_description']) ? $selected_image['products_image_description'] : $products['products_name'])) : $products['products_name']);

$image = (!$grid && $column_list[0] == 'PRODUCT_LIST_IMAGE' ? '<br />' : '') . ' <span class="ttip">' . $link . tep_image(DIR_WS_IMAGES . $image, $alt_text, PRODUCT_IMAGE_WIDTH, PRODUCT_IMAGE_HEIGHT) . ($ttip ? tep_image(DIR_WS_IMAGES . $image, $alt_text, $ttip_width, '', 'class="large"') : '' ) . '</a></span>' . '<br />';

if (LISTING_BUTTON != 'none' && PRODUCT_LIST_BUY_NOW) {

$buypic = (LISTING_BUTTON == 'buy now' ? 'button_in_cart.gif' : 'button_buy_now.gif');

$detail = $link . tep_image_button((strstr(LISTING_BUTTON, '&') || (strstr(LISTING_BUTTON, 'small')) ? 'button_details_small.gif' : 'button_details.gif'), IMAGE_BUTTON_DETAILS, 'class="thm_buy_now"') . '</a>';

$add_cart = ($multi_add ? ($quantity_box && PRODUCT_LIST_QUANTITY_BOX == 'true' ? '' : $detail) : tep_draw_hidden_field('products_id', $products['products_id']) . tep_image_submit($buypic, IMAGE_BUTTON_BUY_NOW, 'class="thm_buy_now"'));

$button = (LISTING_BUTTON == 'buy now & details' ? '<br />' . $quantity_box . ($add_cart == $detail ? $add_cart : $add_cart . ' <span class="buy_now">|</span> ' . $detail . '<br /><br />') : (strstr(LISTING_BUTTON, 'buy now') ? '<br />' . $quantity_box . $add_cart . '<br /><br />' : '<br />'. $detail . '<br /><br />' ));

if ($products['products_price'] == 0 || (isset($products['products_quantity']) && !$products['products_quantity'])) { $button = '<br /><span class="buy_now"> </span>'. $detail . '<br />';$quantity_box = ''; }

}

$name = $link . '<b>' . $products['products_name'] . '</b>' . '</a><br />'. ($products['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? '<br />' . $products['short_desc'] . '<br />' : '');

$price = (function_exists(display_short_price)) ? $currencies->display_short_price($products['products_price'], tep_get_tax_rate($products['products_tax_class_id'])) : $currencies->display_price($products['products_price'], tep_get_tax_rate($products['products_tax_class_id']));

if (tep_not_null($products['specials_new_products_price'])) {

$price = '<s>' . $currencies->display_price($products['products_price'], tep_get_tax_rate($products['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($products['specials_new_products_price'], tep_get_tax_rate($products['products_tax_class_id'])) . '</span>';

}

if (function_exists(tep_get_att_price)) $price .= (tep_get_att_price($products['products_id']) > 0 ? '+' : '') ;

$show_price = '<br /><font size="'.PRODUCT_PRICE_SIZE.'">' . ($products['products_price'] > 0 ? $price : TEXT_POA) . '<br /></font>';

$quantity = ($products['products_quantity'] ? 'Stock = '.$products['products_quantity'] : 'Out of Stock').'<br />';

$weight = 'Weight = '.$products['products_weight'].WEIGHT_ABRV.'<br />';

$model = $products['products_model'] . '<br />';

$manfact = '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $products['manufacturers_id']) . '">' . $products['manufacturers_name'] . '</a><br />';

$display = $border;

for ($disp=0, $n=sizeof($column_list); $disp<$n; $disp++) {

switch ($column_list[$disp]) {

case 'PRODUCT_LIST_IMAGE':

$display .= '<table summary="" width="100%" ><tr><td style="text-align:center;" valign="top" height="'.PRODUCT_IMAGE_VSPACE.'" >'.$image.'</td></tr></table>';

break;

case 'PRODUCT_LIST_NAME':

$display .= '<table summary="" width="100%" ><tr><td class="thumbcontent" height="'.PRODUCT_NAME_VSPACE.'" >'.$name.'</td></tr>' . extra_fields($products['products_id']) . '</table>';

 

break;

case 'PRODUCT_LIST_MODEL':

$display .= $model;

break;

case 'PRODUCT_LIST_MANUFACTURER':

$display .= $manfact;

break;

case 'PRODUCT_LIST_PRICE':

$display .= $show_price;

break;

case 'PRODUCT_LIST_QUANTITY':

$display .= $quantity;

break;

case 'PRODUCT_LIST_WEIGHT':

$display .= $weight;

break;

}

}

$form = ($multi_add ? '' : tep_draw_form('cart_quantity_' . $col . $row, tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','products_id')) . 'action=add_product')));

$display .= $borderend . $form . '<br />' . (PRODUCT_LIST_OPTIONS == 'true' ? attribute_drop($products['products_id'],$products['products_tax_class_id']) . $button : $button) . ($multi_add ? '' : '</form>');

// thumb built

 

 

$info_box_contents[$row][$col] = array('align' => 'center',

'params' => $style . ' width="'.(PRODUCTS_PER_ROW ? (int)(100/PRODUCTS_PER_ROW) : '').'%" valign="top"',

'text' => $display );

$col ++;

if ($col > PRODUCTS_PER_ROW-1) {

$col = 0;

$row ++;

}

} // prod loop

} else {$empty_list=true; }// no products!!

// got display

if ($row) {

$i = 0 ; $nbx = class_exists(noborderBox); if ($col > 0 && $row > 1 && $nbx && !$grid) { for ($i=0, $n=$col; $i < $n; $i++) { $last_row[0][$i] = $info_box_contents[$row][$i]; unset($info_box_contents[$row][$i]); } }

if (!$i) {$col = 0;$row ++;$info_box_contents[$row][$col] = array('align' => 'center',

'params' => 'class="smallText" width="'.(PRODUCTS_PER_ROW ? (int)(100/PRODUCTS_PER_ROW) : '').'%" ',

'text' => ' '); }

if ($nbx) new noborderBox($info_box_contents); else new contentBox($info_box_contents);

if($i) new noborderBox($last_row);

echo $Tborderend;

} else {$empty_list=true; }

} elseif (strstr($thumbnail_view, 'manufacturer')) { //manufacturer

 

$row = 0;$col = 0;

 

if (isset($_GET['manufacturers_id']) && tep_not_null($_GET['manufacturers_id'])) {

$filterlist_sql= tep_db_query("select distinct m.manufacturers_id, m.manufacturers_name, mi.manufacturers_description from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on m.manufacturers_id = mi.manufacturers_id where m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "' and mi.languages_id = '" . (int)$languages_id . "'");

}else{

$filterlist_sql= tep_db_query("select distinct m.manufacturers_id, m.manufacturers_name, mi.manufacturers_description from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on m.manufacturers_id = mi.manufacturers_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' and mi.languages_id = '" . (int)$languages_id . "' order by m.manufacturers_name");

}

if (tep_db_num_rows($filterlist_sql)) { $rows = 0;

while ($manufacturer = tep_db_fetch_array($filterlist_sql)) {

$info_box_heading = array(); if ($rows) echo tep_draw_separator('pixel_trans.gif', '100%', '4');

echo $border2;

$info_box_heading[0] = array('text' => ''.$manufacturer['manufacturers_name'].' • '.$category['categories_name'].'<br />'.(MANU_DESCRIPTION == 'true' ? $manufacturer['manufacturers_description'].'<br />' : ''));

new infoBoxHeading($info_box_heading, false, false);

$list_box_contents = array();

$list_box_contents[0] = (LISTING_HEADINGS == 'true' && !strstr(PRODUCT_THUMBNAIL_VIEW, 'block') ? list_box_head($column_list) : '');

if ($data_ok) { $rows = 0; $listing_query = tep_db_query($listing_split->sql_query);} else {

$rows = 0; $listing_query = tep_db_query($listing_sql); }

while ($listing = tep_db_fetch_array($listing_query)) {

if ($listing['manufacturers_id'] != $manufacturer['manufacturers_id']) continue;

list_row ($listing, $column_list);

}

$list_box_contents[sizeof($list_box_contents)-1] = array(array('text' => '<br />'));

if (!$rows && isset($_GET['manufacturers_id'])) {

$rows++; $list_box_contents = $list_box_empty; $empty_list=true;}

if ($rows) new productListingBox($list_box_contents);

echo $border2end;

echo '<div class="multi_buy_now" id="gbutton2" align="right">' . $gbutton;

} // man loop;

} else {$empty_list=true; } // no manufacturers!!

}

if ((!strstr($thumbnail_view, 'thumbnails') && !strstr($thumbnail_view, 'manufacturer')) || $empty_list) { //default listing

 

if (MANU_DESCRIPTION == 'true' && tep_not_null($_GET['manufacturers_id'])) {

$manufacturer_query = tep_db_query("select manufacturers_description from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . (int)($_GET['manufacturers_id']) . "' and languages_id = '" . (int)$languages_id . "'");

$manufacturer = tep_db_fetch_array($manufacturer_query); }

 

$info_box_heading[0] = array('text' => '<big>'.$title_name.'</big>'.($manufacturer['manufacturers_description'] ? '<br />' . $manufacturer['manufacturers_description'] : ''));

$list_box_contents = array();

$list_box_contents[0] = (LISTING_HEADINGS == 'true' && !strstr(PRODUCT_THUMBNAIL_VIEW, 'block') ? list_box_head($column_list) : '');

if ($listing_split->number_of_rows > 0) { $rows = 0; $listing_query = tep_db_query($listing_split->sql_query);

 

while ($listing = tep_db_fetch_array($listing_query)) {

list_row ($listing, $column_list);

}

$list_box_contents[sizeof($list_box_contents)-1] = array(array('text' => '<br />'));

$empty_list = false;

echo $border2;

if ($title_name) new infoBoxHeading($info_box_heading, false, false);

new productListingBox($list_box_contents);

echo $border2end; //tep_draw_separator('pixel_trans.gif', '100%', '4');

} else {

new productListingBox($list_box_empty); $empty_list=true;

}

 

}

if ($multi_add) { echo '</form>'; }

if ($base_nav && !$empty_list) echo $drop;

if (($listing_split->number_of_rows > (int)$max_results) && $base_nav) echo $page_nav;

if (LISTING_SWITCH != 'false' && !$empty_list) echo '<br /><span class="smalltext"><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('list')). 'list='.(strstr($thumbnail_view, 'thumbnails') ? 'manufacturer' : 'thumbnails')) . '">' . (strstr($thumbnail_view, 'thumbnails') ? LIST_VIEW : THUMB_VIEW).'</a></span><br /><br />';

//echo '<hr>' . $listing_sql . '<hr>';

 

?>

Share this post


Link to post
Share on other sites

Use reviews code

 

 

I don't see anything obvious there, check the product your testing have reviews, also after the data gathering section check data exists with:

 

echo '$pid_string=' . $pid_string;

 

print_r(array_values($review));

 

edit

 

Just spotted it, you added to the function, but dont call it, add product_description($listing['products_id'],$link) where you want the display.

Edited by spooks

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

I came across an impediment when trying to apply round corner fix for IE (dd_dundies)

 

When applying it in stylesheet it worked perfectly (example)

 

.infoBoxProducts {

border: solid 0px #999999;

font-family: Verdana, Arial, sans-serif;

font-size: 10px;

font-weight: normal;

background-color: #eeeeee;

color: #333333;

-moz-border-radius:7px;

-webkit-border-radius:7px;

-khtml-border-radius:7px;

border-radius:7px;

vertical-align: bottom;

 

Now if I try to apply it to a (hover ) mode, it failed to execute round corners (example)

 

.infoBoxProducts:hover {

border: solid 0px #999999;

font-family: Verdana, Arial, sans-serif;

font-size: 10px;

font-weight: normal;

background-color: #eeeeee;

color: #333333;

-moz-border-radius:7px;

-webkit-border-radius:7px;

-khtml-border-radius:7px;

border-radius:7px;

vertical-align: bottom;

 

I have also changes the javascript in page-header-inc.htc

from:

 

<script language="JavaScript" type="text/javascript" src="DD_roundies.js"></script>

<script language="JavaScript" type="text/javascript" defer="defer">

DD_roundies.addRule('.infoBoxProducts', '7px');

</script>

 

To:

 

<script language="JavaScript" type="text/javascript" src="DD_roundies.js"></script>

<script language="JavaScript" type="text/javascript" defer="defer">

DD_roundies.addRule('.infoBoxProducts:hover', '7px');

</script>

 

Here is a working demo example to open in IE:

 

Demo

 

Anybody have a trick for this?

 

Thanks,

Ronnie

Share this post


Link to post
Share on other sites

Hi Spooks

 

many thank for your nice contrib and your friendly support.

 

I've implemented the prettyPhoto AddOn in your product_listing file, perhaps you and anyone else may find this useful.

I am almost certain there is a better way to merge it! :rolleyes:

Please feel free to share your suggestions. :blush:

 

Nevertheless, i will give something back to the community.

 

Here is a Demo

 

Here is my product_listing.php with prettyPhoto AddOn and some other small additions:

 

<!-- prettyPhoto BOF -->
<link rel="stylesheet" href="ext/prettyphoto/css/prettyPhoto.css" type="text/css" title="prettyPhoto main stylesheet" charset="utf-8" />
<script src="ext/prettyphoto/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="ext/prettyphoto/js/jquery.prettyPhoto.js" type="text/javascript" charset="utf-8"></script>
<script src="ext/prettyphoto/js/init.js" type="text/javascript" charset="utf-8"></script>
<!-- prettyPhoto EOF -->
<!-- hoverIcon BOF -->
<link rel="stylesheet" type="text/css" href="ext/prettyphoto/css/hoverIcon.css" charset="utf-8">
<!-- hoverIcon EOF -->
<?php
/*
 $Id: product_listing.php, v 2.2 2009/11/25 22:49:59 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
$graphic_bord = 'no'; //  set to 'yes' if you have older 'graphic borders' and not 'easy graphic borders'.
$cat_path = false; // set to true to include category paths in urls
$no_drop = false; // set to true to remove resuls/page & sort order drop downs
$set_width = false; // set to false to allow columns to find their own widths in list mode
$show_ratings = true; // set to true to show the products average review rating

$max_rows = intval($specials ? MAX_DISPLAY_SPECIAL_PRODUCTS : ($new_page ? MAX_DISPLAY_PRODUCTS_NEW : ($new_mode ? MAX_DISPLAY_NEW_PRODUCTS : MAX_DISPLAY_SEARCH_RESULTS)));
if (tep_not_null($HTTP_GET_VARS['sort'])) $_GET['sort'] = $HTTP_GET_VARS['sort'];
$max_results = (tep_not_null($_GET['max']) ? $_GET['max'] : $max_rows);
if (PRODUCTS_PER_ROW == 'PRODUCTS_PER_ROW' || PRODUCTS_PER_ROW == 0 || LISTING_SWITCH == 'LISTING_SWITCH') { $to = 'Setup Error!\nPlease ensure you have run the\nInstall SQL File.' ; print "<script>alert('$to');</script>"; }

// sort order array
if ($_GET['sort'] == '0d') $sort_array[] = array('id' => 0 . 'd', 'text' => DATE_ORDER);
for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
     switch ($column_list[$i]) {
       case 'PRODUCT_LIST_MODEL':
			$sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_MODEL . APHA_ORDER);
			$sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_MODEL . REVERSE_ALPHA_ORDER);
         break;
       case 'PRODUCT_LIST_NAME':
         $sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_PRODUCTS_NAME . APHA_ORDER);
	  $sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_PRODUCTS_NAME . REVERSE_ALPHA_ORDER);
         break;
       case 'PRODUCT_LIST_MANUFACTURER':
         $sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_MANUFACTURER . APHA_ORDER);
	   $sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_MANUFACTURER . REVERSE_ALPHA_ORDER);
         break;
       case 'PRODUCT_LIST_QUANTITY':
         $sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_QUANTITY . NUM_ORDER);
	  $sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_QUANTITY . REVERSE_NUM_ORDER);
         break;
       case 'PRODUCT_LIST_WEIGHT':
         $sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_WEIGHT . NUM_ORDER);
	  $sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_WEIGHT . REVERSE_NUM_ORDER);
         break;
	case 'PRODUCT_LIST_PRICE':
	  $sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_PRICE . NUM_ORDER);
	  $sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_PRICE . REVERSE_NUM_ORDER);
         break;	
     }
   }

// Max Results Array		
for ($i=1; $i<10; $i++) {		
	$max_display[] = array('id' => $max_rows * $i, 'text' => $max_rows * $i); 
	}	
	$max_display[] = array('id' => 1000, 'text' => TEXT_SHOW_ALL);
// store GET vars		
$get_vars = '';
   reset($_GET);
   while (list($key, $value) = each($_GET)) {
     if ( ($key != 'sort') && ($key != 'max') && ($key != tep_session_name()) && ($key != 'x') && ($key != 'y') ) {
       $get_vars .= tep_draw_hidden_field($key, $value);
     }
   }
$top_nav = ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'));
$base_nav = ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'));		
//$listing_split = new splitPageResults($listing_sql, $max_results, 'p.products_id');
if (isset($pw_mispell)){ //added for search enhancements mod
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr><td><?php echo $pw_string; ?></td></tr>
<tr><td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '20'); ?></td></tr>
</table>
<?php
} //end added search enhancements mod
 $listing_split = new splitPageResults($listing_sql, $max_results, 'p.products_id');
// fix counted products
$data_ok = ($listing_split->number_of_rows > 0);
$list_mode = isset($_GET['list']) ? $_GET['list'] : PRODUCT_THUMBNAIL_VIEW;
$thumbnail_view = strstr($list_mode, 'thumbnails');
$global_add = PRODUCT_LIST_MULTI_BUY;
$multi_add = ($global_add != 'false' && !$new_mode);
if ($new_mode) $no_drop = true;
if (LISTING_SWITCH != 'false' && !$empty_list) 
echo '<table style="background: url(images/small_bg.gif) repeat-x; color:#FFF; border: 1px outset white;" align="center" valign="middle" cellspacing="1" cellpadding="2"><tr><td align="center"><a class="main2fix_white" href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('list')). 'list='.(strstr($thumbnail_view, 'thumbnails') ? 'manufacturer' : 'thumbnails')) . '">' . (strstr($thumbnail_view, 'thumbnails') ? LIST_VIEW : THUMB_VIEW).'</a></td></tr></table>';

$gbutton = ($data_ok ? tep_image_submit('button_multi_in_cart.png', MULTI_ADD_ALT) : '') . '</div>';

$page_nav = '<table border="0" width="100%" cellspacing="0" cellpadding="2"><tr><td class="main2fix_small">' .  $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS) . '</td><td class="main2fix_small" align="right">' . TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))) . '</td></tr></table>';
$drop = $no_drop ? '' : '<table border="0" width="100%" cellspacing="0" cellpadding="2"class="drop"><tr><td class="main2fix_small">' . RESULTS_PER_PAGE . tep_draw_form('maxdisplay', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get') . $get_vars . (isset($_GET['sort']) ? tep_draw_hidden_field('sort', $_GET['sort']) : '') .  tep_draw_pull_down_menu('max', $max_display, $_GET['max'], 'onChange="this.form.submit();"') . tep_hide_session_id().'</form></td><td class="main2fix_small" align="right">' . SORT_ORDER . tep_draw_form('sorting', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get') . $get_vars . (isset($_GET['max']) ? tep_draw_hidden_field('max', $_GET['max']) : '') . tep_draw_pull_down_menu('sort', $sort_array, $_GET['sort'], 'onChange="this.form.submit();"') . tep_hide_session_id().'</form></td></tr></table>';
if ( ($listing_split->number_of_rows > (int)$max_results) && $top_nav ) echo $page_nav;
if ($top_nav && $data_ok) echo '<div id="drop1">' . $drop . '</div>';
if ($multi_add) { echo tep_draw_form('cart_quantity', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','products_id')) . 'action=add_multi')); if ($global_add != 'bottom') echo '<div class="multi_buy_now" id="gbutton1">' . $gbutton;	}
if (($show_ratings || PRODUCT_LIST_DESCRIPTION ) && $data_ok) {
	$listing_query = tep_db_query($listing_split->sql_query);
	while ($products = tep_db_fetch_array($listing_query)) $id_array[] = $products['products_id'];  
	$pid_string = implode(',', array_unique($id_array));
	}
if (PRODUCT_LIST_DESCRIPTION && $data_ok) {
   $product_query = tep_db_query("select products_id, products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id in (" . $pid_string . ") and language_id = '" . (int)$languages_id . "'");
	while ($products = tep_db_fetch_array($product_query)) {    
			$t_desc[$products['products_id']] = substr(strip_tags($products['products_description']), 0, PRODUCT_LIST_DESCRIPTION_MAX_LENGTH);  
  }
}
if ($show_ratings && $data_ok) {
   $rating_query = tep_db_query("select count(*) as count, products_id, sum(reviews_rating) as total from " . TABLE_REVIEWS . " where products_id in (" . $pid_string . ") group by products_id");
	while ($rating = tep_db_fetch_array($rating_query)) {    
			$review[$rating['products_id']] = ceil($rating['total'] / $rating['count']);  
  }
}

function tep_get_category_name($category_id, $language_id) {
      $category_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$category_id . "' and language_id = '" . (int)$language_id . "'");
    $category = tep_db_fetch_array($category_query);

     return $category['categories_name'];
    }
function tep_get_manufacturer_name($manufacturer_id) {
      $manufacturers_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$manufacturer_id . "'");
    $manufacturer = tep_db_fetch_array($manufacturers_query);

     return $manufacturer['manufacturers_name'];
    }

function extra_fields($products_id) {
	global $languages_id;
   $extra_fields_text = '';
		if (tep_not_null(TABLE_PRODUCTS_EXTRA_FIELDS) && LISTING_EXTRA_FIELDS == 'true') {
     $extra_fields_query = tep_db_query("SELECT pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef, ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf WHERE ptf.products_extra_fields_id=pef.products_extra_fields_id and ptf.products_id=". (int) $products_id ." and (pef.languages_id = '0' or pef.languages_id = '".(int)$languages_id."') and ptf.products_extra_fields_value <> '' and pef.products_extra_fields_status ORDER BY pef.products_extra_fields_order");
		while ($extra_fields = tep_db_fetch_array($extra_fields_query)) {
		$extra_fields_text .= '<tr><td class="smallText"><span class="xtra-field-name">' . $extra_fields['name'] . ': </span><span class="xtra-field-value">' . $extra_fields['value'] . '</span></td></tr>';
		}		
	}	
	return $extra_fields_text;	
}	

function product_description($product_id,$link,$thumb=false) {
   global $head_title, $t_desc, $review;
	if ($review[$product_id]) $rating = '<span class="smallText"><br />' . sprintf(TEXT_AVERAGE_REVIEW, tep_image(DIR_WS_IMAGES . 'stars_' . $review[$product_id] . '.gif',sprintf(TEXT_AVERAGE_REVIEW,$review[$product_id]))) . '</span>';
	if (PRODUCT_LIST_DESCRIPTION) {
   	return ($head_title || $thumb ? '' : '<br />') . '<span class="productListing-short">' . $t_desc[$product_id] . $link . '<b>...' . MORE . '</b></a></span>' . $rating;
	} else {
	return $rating; 
	}
 }	

function product_price ($listing,$last=false) {
	$currencies = new currencies();
	$p_price = $listing['products_price'];
	$price = (function_exists(display_short_price)) ? $currencies->display_short_price($p_price, tep_get_tax_rate($listing['products_tax_class_id'])) : $currencies->display_price($p_price, tep_get_tax_rate($listing['products_tax_class_id'])); 
        if (tep_not_null($listing['specials_new_products_price'])) {
             $price = '<s>' .  $currencies->display_price2($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>' . ($last ? '<br />' : '  ') . '<span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>';
         } else {
					  $price = ($p_price > 0 ? '' . $price . '' : '' . TEXT_POA); 
						if (function_exists(tep_get_att_price)) $price .= (tep_get_att_price($listing['products_id']) > 0 ? '+' : '') ; 
         }
	return '<span class="productListing-list-price">' . $price . '</span>';		
 }			


function list_row ($listing, $column_list) {
		global $rows, $gborders, $list_box_contents, $cPath, $cat_path, $head_title;
     $list_box_contents[][] = array('text' =>  '<br />');
		if (!$rows && $gborders) $list_box_contents = array();			
		$rows++;
		$man_id = (tep_not_null($_GET['manufacturers_id']) ? $_GET['manufacturers_id'] : '');
     $link = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id'] . ($man_id ? '&manufacturers_id='.$man_id : ($cPath && $cat_path ? '&cPath=' . $cPath : '')) ) . '"' . ($man_id || ($cat_path && $cat_path) ? ' rel="nofollow"' : '') . '>';
     		if ($head_title) { 
				    	if (in_array('PRODUCT_LIST_PRICE',$column_list)) $price = '<p style="float: right">' . product_price ($listing) . '</p>';
							$list_box_contents[][] = array('align' => 'left',
                                          'params' => 'colspan="'.sizeof($column_list).'" class="productListing-title"',
                                          'text' =>  '<div style="clear: both; width:100%;"><p style="float: left">' . $link . '<b>' . $listing['products_name'] . '</b></a></p>' . $price . '</div>');
				}
		$list_box_contents[] =	list_box_data($listing, $column_list, $link); 
		$list_box_contents[][] = array('align' => 'center',
                                          'params' => 'class="separator" colspan="'.sizeof($column_list).'"',
                                          'text' =>  '<br />');	
		return true;																		 
		}		
?>			
<script type="text/javascript" language="javascript">
<!--
function changeValue(inObject,delta)
{  var myVal = parseInt(inObject.value);
	isNaN(myVal) ? myVal = delta : myVal = myVal + delta;
	inObject.value = Math.max(myVal,0); 
	return; } 

// -->
</script>
<?php
function quantity ($products_id,$p_price) {
global $multi_add, $thumbnail_view;

if (PRODUCT_LIST_QUANTITY_BOX != 'false' && strstr(LISTING_BUTTON, 'buy now')) { 
				if (tep_has_product_attributes($products_id) && PRODUCT_LIST_OPTIONS != 'true' && $multi_add) return false; 
				$pstock = min(tep_get_products_stock($products_id),MAX_QTY_IN_CART);
				if (PRODUCT_LIST_QUANTITY_BOX == 'true')
				return ($pstock && $p_price != 0 ? '<table  cellspacing="0" cellpadding="2"><tr><td class="quantity" >' . QUANTITY . tep_draw_input_field('cart_quantity' . ($multi_add ? '[]' : '') , ($multi_add ? '0' : '1') , 'maxlength="5" size="2" id="qid'.$products_id.'"') . ($multi_add ? tep_draw_hidden_field('products_id[]', $products_id) : '') . '</td><td><a href="javascript:changeValue(document.getElementById(\'qid'.$products_id.'\'),1);">' . tep_image_button('btn_up.gif',MORE) . '</a><br><a href="javascript:changeValue(document.getElementById(\'qid'.$products_id.'\'),-1);">' . tep_image_button('btn_down.gif',LESS) . '</a></td></tr></table>' : '<br /><br />');
else
			$qty_array = array(); 
			for ($i=0; $i<=$pstock; $i++) {	$qty_array[]=array('id' => $i, 'text' => $i); }
			return ($pstock && $p_price != 0 ? '<div class="quantity" align="' . ($thumbnail_view ? 'center' : 'right' ) .'">' . QUANTITY . tep_draw_pull_down_menu('cart_quantity'.($multi_add ? '[]' : ''),$qty_array,($multi_add ? 0 : 1)) . '<br />' . ($multi_add ? tep_draw_hidden_field('products_id[]', $products_id) : '') . '</div>' : '<br />');
				} else { return false; }
		}																			 		

function list_box_head($column_list) {
 global $set_width, $head_title;
 for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
if ($head_title && $column_list[$col] == 'PRODUCT_LIST_PRICE') continue;
   switch ($column_list[$col]) {
     case 'PRODUCT_LIST_MODEL':
       $lc_text = TABLE_HEADING_MODEL;
       $lc_align = 'center';
       break;
     case 'PRODUCT_LIST_NAME':
       $lc_text = TABLE_HEADING_PRODUCTS;
       $lc_align = '';
       break;
  case 'PRODUCT_LIST_INFO':
       $lc_text = TABLE_HEADING_INFO;
       $lc_align = '';
       break;
     case 'PRODUCT_LIST_MANUFACTURER':
       $lc_text = TABLE_HEADING_MANUFACTURER;
       $lc_align = 'center';
       break;
     case 'PRODUCT_LIST_PRICE':
       $lc_text = TABLE_HEADING_PRICE;
       $lc_align = 'right';
       break;
     case 'PRODUCT_LIST_QUANTITY':
       $lc_text = TABLE_HEADING_QUANTITY;
       $lc_align = 'right';
       break;
     case 'PRODUCT_LIST_WEIGHT':
       $lc_text = TABLE_HEADING_WEIGHT;
       $lc_align = 'right';
       break;
     case 'PRODUCT_LIST_IMAGE':
       $lc_text = TABLE_HEADING_IMAGE;
       $lc_align = 'center';
       break;
     case 'PRODUCT_LIST_BUY_NOW':
       $lc_text = (PRODUCT_LIST_OPTIONS == 'true'  ? 'Product Options</td><td align="center" class="productListing-heading">' : '') . (strstr(LISTING_BUTTON, 'buy now')? TABLE_HEADING_BUY_NOW : TABLE_HEADING_DETAIL);
       $lc_align = 'center';
       break;
   }
   if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {
     $lc_text = tep_create_sort_heading($_GET['sort'], $col+1, $lc_text);
   }
  $list_box_contents[] = array('align' => $lc_align,'params' => 'class="productListing-heading" ' . ($set_width ? 'width="'.(int)(100/sizeof($column_list)) . '%"' : ''),'text' => ' ' . $lc_text . ' ');
 }
 return ($list_box_contents);
}
// function list_head end	

function list_box_data($listing, $column_list, $link) {
       global $PHP_SELF, $ttip, $head_title, $rows, $set_width, $multi_add;
$alt_text = $listing['products_name'];	
			$image = (file_exists(DIR_WS_IMAGES . $listing['products_image']) ? $listing['products_image'] : 'no-image.jpg');								
   		$image = '<span class="ttip">' . $link . tep_image(DIR_WS_IMAGES . $image, $alt_text, PRODUCT_IMAGE_WIDTH, PRODUCT_IMAGE_HEIGHT) . ($ttip ? tep_image(DIR_WS_IMAGES . $image, $alt_text, IMAGE_TTIP_WIDTH, '', 'class="large"') : '' ) . '</a></span>';
			$name = (!$head_title ? $link . '<span class="productListing-name">' . $listing['products_name'] . '</span></a>' : ''); 
  if (LISTING_BUTTON != 'none' && PRODUCT_LIST_BUY_NOW) {
       $buypic = (LISTING_BUTTON == 'buy now' ? 'button_in_cart.gif' : 'button_buy_now.gif');
			$p_price = $listing['products_price']; 
			$quantity_box = quantity ($listing['products_id'], $p_price);
			$form = ($multi_add ? '' : tep_draw_form('cart_quantity_' . $rows, tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','products_id')) . 'action=add_product')));
			$buytable = '<table class="buytable" border="0" width="100%" cellspacing="0" cellpadding="2"><tr><td valign="bottom" class="productListing-data">';
			$buytableend = '</td></tr></table>'. ($multi_add ? '' : '</form>');
			$detail = $link . tep_image_button((strstr(LISTING_BUTTON, '&') || (strstr(LISTING_BUTTON, 'small')) ? 'button_details_small.gif' : 'button_details.gif'), IMAGE_BUTTON_DETAILS, 'class="thm_buy_now"') . '</a> ';
			$add_cart = ($multi_add ? ($quantity_box ? '' : $detail) : tep_draw_hidden_field('products_id', $listing['products_id']) . tep_image_submit($buypic, IMAGE_BUTTON_BUY_NOW, 'class="thm_buy_now"'));
			$button = (LISTING_BUTTON == 'buy now & details' ? ($add_cart == $detail ? $add_cart : $add_cart . ' <span class="buy_now">|</span> ' . $detail ) : (strstr(LISTING_BUTTON, 'buy now') ? $add_cart : $detail ));	
			if ($p_price == 0 || (isset($listing['products_quantity']) && !$listing['products_quantity'])) { $button = $detail; $quantity_box = '';}//'<span class="buy_now"> </span>'. 
			}
			$list_box_temp =  array('params' => 'class="list-block"');	
			if (!strstr(PRODUCT_THUMBNAIL_VIEW, 'block'))	{		
			for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
			if ($head_title && $column_list[$col] == 'PRODUCT_LIST_PRICE') continue;
       $lc_align = '';
			$params = 'class="productListing-data" ' . ($set_width ? 'width="'.(int)(100/sizeof($column_list)) . '%"' : '') . ' valign="top" ';		
       switch ($column_list[$col]) {
         case 'PRODUCT_LIST_MODEL':
           $lc_align = 'center';
           $lc_text = ' ' . $listing['products_model'] . ' ';
           break;
         case 'PRODUCT_LIST_NAME':
           $lc_align = '';
           $lc_text = $name . ($listing['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? '<br /><span class="short">' . $listing['short_desc'] . '</span>' : '') . product_description($listing['products_id'],$link);
$extra_fields_text = extra_fields($listing['products_id']);
					if ($extra_fields_text) $lc_text .= '<br /><table>' . $extra_fields_text . '</table>';
          break;
	   case 'PRODUCT_LIST_INFO':
           $lc_align = '';
           $lc_text = '';
           break;
         case 'PRODUCT_LIST_MANUFACTURER':
           $lc_align = 'center';
           $lc_text = '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . '<b>' . TABLE_HEADING_MANUFACTURER . '<br /><font color="#eb570f">' . $listing['manufacturers_name'] . '</font></b></a> ';
           break;
         case 'PRODUCT_LIST_PRICE':
				  if(!$head_title) {
           $lc_align = 'right';
						$lc_text = product_price ($listing);
           }
           break;
         case 'PRODUCT_LIST_QUANTITY':
// #################### START Qauntity images and text unlimited ############# //
         $lc_align = 'center';
//       $lc_text = ' ' . $listing['products_quantity'] . ' '; 
        $lc_text = ' ' . picto_qty($listing['products_quantity']) . ' '; 
// #################### END Qauntity images and text unlimited ############# //
           break;
         case 'PRODUCT_LIST_WEIGHT':
           $lc_align = 'right';
           $lc_text = ' ' . $listing['products_weight'] . ' ';
           break;
         case 'PRODUCT_LIST_IMAGE':
           $lc_align = 'center';

		  $lc_text = '<div class="hover_icon_container" style="width: ' . SMALL_IMAGE_WIDTH . 'px; height: ' . SMALL_IMAGE_HEIGHT . 'px; ">';
             $lc_text .= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class="product_image"');
		  $lc_text .= "<a href=\"" . tep_href_link(DIR_WS_IMAGES . $listing['products_image']) . "\" target=\"_blank\" rel=\"prettyOverlay[gallery]\" class=\"hover_icon\" title=\"" . $listing['products_name'] ."\">" . tep_image(DIR_WS_ICONS . 'enlarge_l.gif', $listing['products_name'], 16, 16, 'border=0') . "</a>";
		  $lc_text .= '</a>' . "</div>";

           break;
         case 'PRODUCT_LIST_BUY_NOW':
				  if (PRODUCT_LIST_OPTIONS == 'true' ) $params = 'class="productListing-data" width="'.(int)((100/sizeof($column_list))*2).'%" colspan="2"'; 
				  $lc_align = 'center';
					$button = $quantity_box . $button;
           $lc_text = $form . $buytable . (PRODUCT_LIST_OPTIONS == 'true'  ? attribute_drop($listing['products_id'],$listing['products_tax_class_id']) . '</td><td align="center" class="productListing-data">' . $button : $button) . $buytableend;
          break;
       }
			$list_box_temp[] = array('align' => $lc_align,
                                'params' => $params,
                                'text'  => $lc_text);
     }
	} else {  
	if (PRODUCT_LIST_IMAGE) { $list_box_temp[] = array('align' => 'center',
                                 										 'params' => 'class="productListing-data" ',
                                											 'text'  => $image);   }
	     $display ='';$text = '';
	for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
	if ($head_title && $column_list[$col] == 'PRODUCT_LIST_PRICE') continue;
	    $last = (($col + BLOCK_LAST_SIZE + 1) > $n);
			$text .= ($text ? '<br />' : '');  
       switch ($column_list[$col]) {
         case 'PRODUCT_LIST_MODEL':
				  $text .= $listing['products_model'];
					if (!$last) {$display .= $text . '<br />'; $text = '';}
           break;
         case 'PRODUCT_LIST_NAME':
           $text .= $name . ($listing['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? '<br /><span class="short">' . $listing['short_desc'] . '</span>' : '') . product_description($listing['products_id'],$link);
$extra_fields_text = extra_fields($listing['products_id']);
					if ($extra_fields_text) $text .= '<br /><table>' . $extra_fields_text . '</table>';
					if (!$last) {$display .= $text . '<br />'; $text = '';}
          break;
	   case 'PRODUCT_LIST_INFO':
           $text = '';
           break;
         case 'PRODUCT_LIST_MANUFACTURER':
           $text .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . '<b><font color="#eb570f">' . $listing['manufacturers_name'] . '</font></b></a>';
					if (!$last) {$display .= $text . '<br />'; $text = '';}
           break;
         case 'PRODUCT_LIST_PRICE':
				  $text .= ($last ? '' : '<br />Price: ') . product_price ($listing, $last) . ($last ? '' : '<br />'); 
					if (!$last) {$display .= $text . '<br />'; $text = '';}
           break;
         case 'PRODUCT_LIST_QUANTITY':
           $text .= ($listing['products_quantity'] ? TEXT_STOCK . $listing['products_quantity'] : PICTURE_ONLY_ZERO);
					if (!$last) {$display .= $text . '<br />'; $text = '';}
           break;
         case 'PRODUCT_LIST_WEIGHT':
           $text .= 'Weight = ' . $listing['products_weight'].WEIGHT_ABRV . ($last ? '' : '<br />');
					if (!$last) {$display .= $text . '<br />'; $text = '';}
           break;
				case 'PRODUCT_LIST_BUY_NOW':
				  $button = '<div align="right" width="100%">' . $quantity_box . '</div>' . ($last ? '' : '  ') . $button;
           $text .= $form . $buytable . (PRODUCT_LIST_OPTIONS == 'true' ? '<div ' . ($last ? 'align="right"' : 'align="left"' ) . ' width="100%">' . attribute_drop($listing['products_id'],$listing['products_tax_class_id']) . '</div>' . $button : $button) . $buytableend; //'<br />' . 

					if (!$last) {$display .= $text . '<br />'; $text = '';}
           break;	
			}
		}	
		  $display .= '';

$list_box_temp[] = array('align' => 'left',
                            'params' => 'class="main" valign="top" ',
                            'text'  => $display);
$list_box_temp[] = array('align' => 'right',
                            'params' => 'class="productListing-data" valign="top" ',
                            'text'  => $text);
	}
	return 	($list_box_temp);	
   }
// function list_box_data end	

function attribute_drop($products_id,$tax_class_id) {
global $languages_id, $multi_add;
$currencies = new currencies();
$atrib_drop = '';			
	$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id='" . (int)$products_id . "'");
   $products_attributes = tep_db_fetch_array($products_attributes_query);
   if ($products_attributes['total'] > 0) {

	$atrib_drop = '<table border="0" cellspacing="0" cellpadding="2" class="attributes">';

	$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)$products_id . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
     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)$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 . "'");
       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($tax_class_id)) .') ';
         }
       }
$atrib_drop .= '<tr><td class="attributes" >' . $products_options_name['products_options_name'] . ':' . '</td><td align="left">' . tep_draw_pull_down_menu('id' . ($multi_add ? '['. $products_id .']' : '') . '[' . $products_options_name['products_options_id'] . ']', $products_options_array) . '</td></tr>';

     }
					$atrib_drop .= '</table>';
   }
	return $atrib_drop;
}
// function attribute_drop end

// set initial values	

$empty_list=false;
if (isset($_GET['manufacturers_id']) && tep_not_null($_GET['manufacturers_id'])) {
$title_name = tep_get_manufacturer_name($_GET['manufacturers_id']);
} else {
$title_name =  ($specials ? $specials : ($new_page ? ' ' : ($new_mode ? $new_mode : (!$category['categories_name'] && tep_not_null($_GET['cPath']) ? tep_get_category_name(substr($_GET['cPath'], strpos($_GET['cPath'],'_')+1),$languages_id) : ''))));
}
$grid = strstr(PRODUCT_THUMBNAIL_VIEW, 'grid');
$gborders = function_exists(mws_boxHeader);//$gborders = false;
$Tborder = (!$gborders ? '<div class="infoBoxList" style="width:100%;">' : mws_boxHeader('<big>'.$title_name.'</big>'));
$Tborderend = (!$gborders ? '</div>' : mws_boxFooter ());
$border2 = (!$gborders ? '<div class="infoBoxList" style="width:100%;">' : ($graphic_bord == 'yes' ? mws_boxHeader('<big>'.$title_name.'</big>') : ''));  
$border2end = (!$gborders ? '</div>' : ($graphic_bord == 'yes' ? mws_boxFooter() : ''));
$list_box_empty[] = array(array('params' => 'class="productListing-data"','text' => TEXT_NO_PRODUCTS));
$ttip = (IMAGE_TTIP == 'true');
$head_title = (PRODUCT_LIST_HEAD_TITLE == 'true');	

if (tep_not_null($_GET['categories_id']) && $current_category_id == 0) $current_category_id = $_GET['categories_id'];

// output selected display
if ($thumbnail_view) {  //thumbnail
 $row = 0;
 $col = 0;
$border = (!$grid ? '<div class="infoBoxProducts" style=" width:'.PRODUCT_LIST_WIDTH.'px; height:'.PRODUCT_LIST_HEIGHT.'px;" >' : '<br />');
$borderend = (!$grid ? '</div>' : '');
$style = (!$grid ? 'class="main2fix_small"' : 'class="infoBoxGrid"');
$info_box_contents = array();
if ($data_ok) {   $listing_query = tep_db_query($listing_split->sql_query);} else {
       $listing_query = tep_db_query($listing_sql); }
if (tep_db_num_rows($listing_query)) { 			
while ($products = tep_db_fetch_array($listing_query)) {
 	if ($row == 0) { 
	  if (!$gborders && !$grid) $info_box_contents[$row][$col] = array('align' => 'center',
                                          'params' => 'class="main2fix_small" width="'.(PRODUCTS_PER_ROW ? (int)(100/PRODUCTS_PER_ROW) : '').'%" valign="top"',
                                          'text' =>  ' ');  
																				 echo $Tborder;$row ++;
	               }

		// build thumb
	$man_id = (tep_not_null($_GET['manufacturers_id']) ? $_GET['manufacturers_id'] : '');	
	$link = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id'] . ($man_id ? '&manufacturers_id='.$man_id : ($cPath && $cat_path ? '&cPath=' . $cPath : ''))) . '"' . ($man_id  || ($cat_path && $cat_path) ? ' rel="nofollow"' : '') . '>';
	$p_price = $products['products_price']; 
	$quantity_box = quantity ($products['products_id'],$p_price);
	$image = (file_exists(DIR_WS_IMAGES . $products['products_image']) ? $products['products_image'] : 'no-image.jpg'); 
	$addimages = (file_exists(DIR_WS_CLASSES . 'displayimages.php')); // Additional Images Present
	if ($addimages) { 	
	$image_query = tep_db_query( "SELECT ai.medium_images, ai.images_description, ai.popup_images, p.products_image_med, p.products_image_description  FROM " .  TABLE_ADDITIONAL_IMAGES . " ai, " . TABLE_PRODUCTS . " p WHERE ai.products_id=p.products_id and ai.products_id = '".(int)$products['products_id']."'");
   $selected_image = tep_db_fetch_array($image_query);
	$image = ($selected_image['medium_images'] ? $selected_image['medium_images'] : ($selected_image['products_image_med'] ? $selected_image['products_image_med'] : ($selected_image['popup_images'] ? $selected_image['popup_images'] : $products['products_image']))); 
										} 
  $alt_text = ($addimages ? (tep_not_null($selected_image['images_description']) ? $selected_image['images_description'] : (tep_not_null($selected_image['products_image_description']) ? $selected_image['products_image_description'] : $products['products_name'])) : $products['products_name']);	
   $image = (!$grid && $column_list[0] == 'PRODUCT_LIST_IMAGE' ? '<br />' : '') . ' <span class="ttip">' . $link . tep_image(DIR_WS_IMAGES . $image, $alt_text, PRODUCT_IMAGE_WIDTH, PRODUCT_IMAGE_HEIGHT)  . ($ttip ? tep_image(DIR_WS_IMAGES . $image, $alt_text, IMAGE_TTIP_WIDTH, '', 'class="large"') : '' ) . '</a></span>' . '<br />';
	if (LISTING_BUTTON != 'none' && PRODUCT_LIST_BUY_NOW) {
	$buypic = (LISTING_BUTTON == 'buy now' ? 'button_in_cart.gif' : 'button_buy_now.gif');
	$detail = $link . tep_image_button((strstr(LISTING_BUTTON, '&') || (strstr(LISTING_BUTTON, 'small')) ? 'button_details_small.gif' : 'button_details.gif'), IMAGE_BUTTON_DETAILS, 'class="thm_buy_now"') . '</a>';
	$add_cart = ($multi_add ? ($quantity_box ? '' : $detail) : tep_draw_hidden_field('products_id', $products['products_id']) . tep_image_submit($buypic, IMAGE_BUTTON_BUY_NOW, 'class="thm_buy_now"'));
	$button = (LISTING_BUTTON == 'buy now & details' ? '<br />' . $quantity_box . ($add_cart == $detail ? $add_cart : $add_cart . ' <span class="buy_now">|</span> ' . $detail . '<br /><br />') : (strstr(LISTING_BUTTON, 'buy now') ? '<br />' . $quantity_box . $add_cart . '<br /><br />' : '<br />'. $detail . '<br /><br />' ));	
	if ($p_price == 0  || (isset($products['products_quantity']) && !$products['products_quantity'])) { $button = $quantity_box . '<br /><span class="buy_now"> </span>'. $detail . '<br />';$quantity_box = ''; }
	}
	$name =	'<div class="productListing-name">' . $link . $products['products_name'] . '</a></div>'. ($products['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? '' . $products['short_desc'] . '<br />' : '') . product_description($products['products_id'],$link, true);	 
	$show_price = '<br />' . product_price($products) . '<br />';
	$quantity = ($products['products_quantity'] ? ' ' . picto_qty($products['products_quantity']) : PICTURE_ONLY_ZERO).'<br />';
	$weight = 'Weight = '.$products['products_weight'].WEIGHT_ABRV.'<br />';
   	//$products_info = $listing['products_info'] . '<br />';
	$model = $products['products_model'] . '<br />';
	$manfact = '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $products['manufacturers_id']) . '">' . '<b>' . TABLE_HEADING_MANUFACTURER . '<br /><font color="#eb570f">' . $products['manufacturers_name'] . '</font></b></a><br />';
	$display = $border;
	for ($disp=0, $n=sizeof($column_list); $disp<$n; $disp++) {
       switch ($column_list[$disp]) {
         case 'PRODUCT_LIST_IMAGE':
				  $display .= '<table summary="" width="100%" ><tr><td style="text-align:center;" valign="top" height="'.PRODUCT_IMAGE_VSPACE.'" >'.$image.'</td></tr></table>';
				  $display .= "<a href=\"" . tep_href_link(DIR_WS_IMAGES . $products['products_image']) . "\" target=\"_blank\" rel=\"prettyOverlay[gallery]\" title=\"" . $products['products_name'] ."\">" . tep_image_button('image_enlarge.gif', $products['products_name'], 20, 20, 'border=0') . "</a>";

           break;
				case 'PRODUCT_LIST_NAME':
           $display .= '<table summary="" width="100%" ><tr><td class="thumbcontent" height="'.PRODUCT_NAME_VSPACE.'" >'.$name.'</td></tr>' . extra_fields($products['products_id']) . '</table>';
           break;

	      case 'PRODUCT_LIST_MODEL':
           $display .= $model;
           break;
				case 'PRODUCT_LIST_MANUFACTURER':
           $display .= $manfact;
           break;
				case 'PRODUCT_LIST_PRICE':   
           $display .= $show_price;
           break;		
				case 'PRODUCT_LIST_QUANTITY':
           $display .= $quantity;
           break;	
				case 'PRODUCT_LIST_WEIGHT':
           $display .= $weight;
           break;	
				}
	}
	$form = ($multi_add ? '' : tep_draw_form('cart_quantity_' . $col . $row, tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','products_id')) . 'action=add_product')));
	$display .= $borderend . $form . '' . (PRODUCT_LIST_OPTIONS == 'true' ? attribute_drop($products['products_id'],$products['products_tax_class_id']) . $button : $button) . ($multi_add ? '' : '</form>');
			// thumb built			 


	 $info_box_contents[$row][$col] = array('align' => 'center',
                                          'params' => $style . ' width="'.(PRODUCTS_PER_ROW ? (int)(100/PRODUCTS_PER_ROW) : '').'%" valign="top"',
                                          'text' => $display );
	$col ++;
   if ($col > PRODUCTS_PER_ROW-1) {
     $col = 0;
     $row ++;
   }
}  // prod loop
} else {$empty_list=true; }// no products!!
// got display
if ($row) { 
$i = 0 ; $nbx = class_exists(noborderBox); if ($col > 0 && $row > 1 && $nbx && !$grid) { for ($i=0, $n=$col; $i < $n; $i++) { $last_row[0][$i] =  $info_box_contents[$row][$i]; unset($info_box_contents[$row][$i]); } }
if (!$i) {$col = 0;$row ++;$info_box_contents[$row][$col] = array('align' => 'center',
                                          'params' => 'class="main2fix_small" width="'.(PRODUCTS_PER_ROW ? (int)(100/PRODUCTS_PER_ROW) : '').'%" ',
                                          'text' =>  ' '); }
if ($nbx) new noborderBox($info_box_contents); else new contentBox($info_box_contents);
if($i) new noborderBox($last_row); 
echo ($gborders ? '' : '') . $Tborderend;
 							  } else {$empty_list=true; }
} elseif (strstr($list_mode, 'manufacturer') && !$new_mode) {  //manufacturer

$row = 0;$col = 0;

if (isset($_GET['manufacturers_id']) && tep_not_null($_GET['manufacturers_id'])) {
$filterlist_sql= tep_db_query("select distinct m.manufacturers_id, m.manufacturers_name, mi.manufacturers_description from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on m.manufacturers_id = mi.manufacturers_id where m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "' and mi.languages_id = '" . (int)$languages_id . "'");
 }else{
$filterlist_sql= tep_db_query("select distinct m.manufacturers_id, m.manufacturers_name, mi.manufacturers_description  from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on m.manufacturers_id = mi.manufacturers_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' and mi.languages_id = '" . (int)$languages_id . "' order by m.manufacturers_name");
}
if (tep_db_num_rows($filterlist_sql)) { $rows = 0;
	while ($manufacturer = tep_db_fetch_array($filterlist_sql)) { 
	$info_box_heading = array(); if ($rows) echo tep_draw_separator('pixel_trans.gif', '100%', '4');	
	echo $border2; 
	$info_box_heading[0] = array('text' => '<big>'.$manufacturer['manufacturers_name'].'</big><br />'.(MANU_DESCRIPTION == 'true' ? $manufacturer['manufacturers_description'].'<br />' : ''));
	new infoBoxHeading($info_box_heading, false, false);	
  $list_box_contents = array();
   $list_box_contents[0] = (LISTING_HEADINGS == 'true' && !strstr(PRODUCT_THUMBNAIL_VIEW, 'block') ? list_box_head($column_list) : '');
   if ($data_ok) { $rows = 0;  $listing_query = tep_db_query($listing_split->sql_query);} else {
     $rows = 0;  $listing_query = tep_db_query($listing_sql); }
   while ($listing = tep_db_fetch_array($listing_query)) {
	if ($listing['manufacturers_id'] != $manufacturer['manufacturers_id']) continue;
	list_row ($listing, $column_list);
  }
	$list_box_contents[sizeof($list_box_contents)-1] = array(array('text' =>  '<br />'));
  if (!$rows && isset($_GET['manufacturers_id'])) {
   $rows++;  $list_box_contents = $list_box_empty; $empty_list=true;}
  if ($rows) new productListingBox($list_box_contents); 
   echo $border2end; 
}   // man loop;
} else {$empty_list=true; }  // no manufacturers!!
}
if ((!$thumbnail_view && !strstr($list_mode, 'manufacturer')) || $empty_list  || ($new_mode && !$thumbnail_view)) {   //default listing

 if (MANU_DESCRIPTION == 'true' && tep_not_null($_GET['manufacturers_id'])) { 
$manufacturer_query = tep_db_query("select manufacturers_description from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . (int)($_GET['manufacturers_id']) . "' and languages_id = '" . (int)$languages_id . "'");
   $manufacturer = tep_db_fetch_array($manufacturer_query); }

  $info_box_heading[0] = array('text' => '<big>'.$title_name.'</big>'.($manufacturer['manufacturers_description'] ? '<br />' . $manufacturer['manufacturers_description'] : ''));
 $list_box_contents = array();
  $list_box_contents[0] = (LISTING_HEADINGS == 'true' && !strstr(PRODUCT_THUMBNAIL_VIEW, 'block') ? list_box_head($column_list) : '');
  if ($listing_split->number_of_rows > 0) {  $rows = 0; $listing_query = tep_db_query($listing_split->sql_query);

   while ($listing = tep_db_fetch_array($listing_query)) {
	list_row ($listing, $column_list);
   }
	$list_box_contents[sizeof($list_box_contents)-1] = array(array('text' =>  '<br />'));
  $empty_list = false;
	echo $border2; 
	if ($title_name) new infoBoxHeading($info_box_heading, false, false);	
   new productListingBox($list_box_contents);
	echo $border2end; 
 } else {
   new productListingBox($list_box_empty); $empty_list=true;
 }

 }
if ($multi_add) { if ($global_add != 'top') echo '<div class="multi_buy_now" id="gbutton2">' . $gbutton;	echo '</form>';	} 
echo tep_draw_separator('pixel_trans.gif', '100%', '6');
if ($base_nav && !$empty_list) echo $drop;
if (($listing_split->number_of_rows > (int)$max_results) && $base_nav) echo $page_nav;
if (LISTING_SWITCH != 'top') echo $switch . '<br />';
  //echo '<hr>' . $listing_sql . '<hr>' . $listing_split->number_of_rows . ' records.'; 

?>

Share this post


Link to post
Share on other sites

 

 

The script is not designed to be used that way, only the way I did it, if you want it otherwise you must modify the javascript, sorry. huh.gif


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

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  

×