Jump to content
Sign in to follow this  
spooks

Product Listing Enhancements, Thumbnails & Manufacturer Headings

Recommended Posts

Hmmm, I see already changed it to 0px. But now I remembered when it went wrong.

I installed the contribution "pure css button image swap". When I restore my backup, the detail button levels with the buy now. This contribution messed the thing up.

 

When I delete the _over image, the details and buy now button levels again.

 

This contribution uses the following code in html_output.php. Does someone what to change to correct this problem?

 

////
// The HTML form submit button wrapper function
// Outputs a button in the selected language
 function tep_image_submit($image, $alt = '', $parameters = '') {
   global $language, $button_class;$image_src = tep_output_string(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image);
	$iefix = '<a href="javascript:void(0)">'; //set to $iefix = ''; if your using an xhtml doctype
	list($width, $height) = getimagesize($image_src);
	$idx = strrpos($image,'.'); $id = substr ($image,0,$idx);
	$hover_image = tep_output_string(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $id . "_over" . substr ($image, $idx));
	$hover = file_exists($hover_image);
   $image_submit = '<input type="image" src="' . $image_src . '" border="0" alt="' . tep_output_string($alt) . '"';
   if ($hover) $image_submit = $iefix . '<img alt="" src="' . $hover_image . '" style="display:none" /><input type="submit" value="" class="' . $id . '"';
   if (tep_not_null($alt)) $image_submit .= ' title=" ' . tep_output_string($alt) . ' "';

   if (tep_not_null($parameters)) $image_submit .= ' ' . $parameters;

   $image_submit .= '>';
	if ($hover && $iefix) $image_submit .= '</a>';
   if ($hover) $button_class .= '.' . $id . ' { border: none; background: url("' . $image_src . '") no-repeat top left; width:' . $width . 'px; height:' . $height . 'px; cursor:pointer;}  input.' . $id . ':hover, a:hover input.' . $id . ' { border: none; background: url("' . $hover_image . '") no-repeat top left;  }  ';

   return $image_submit;
 }

////
// Output a function button in the selected language
 function tep_image_button($image, $alt = '', $parameters = '') {
   global $language, $button_class; $image_src = tep_output_string(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image);
   list($width, $height) = getimagesize($image_src);
	$idx = strrpos($image,'.'); $id = substr ($image,0,$idx);
	$hover_image = tep_output_string(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $id . "_over" . substr ($image, $idx));
	$hover = file_exists($hover_image);
	$button = '<img alt="" src="' . $hover_image . '" style="display:none" /><img src="' . DIR_WS_IMAGES . 'pixel_trans.gif' . '" class="' . $id . '" alt="' . tep_output_string($alt) . '"';
	if (tep_not_null($alt)) $button .= ' title=" ' . tep_output_string($alt) . ' "';
	if (tep_not_null($parameters)) $button .= ' ' . $parameters;
	$button .= '/>';

	if ($hover) { $button_class .= '.' . $id . ' { border: none; background: url("' . $image_src . '") no-repeat top left; width:' . $width . 'px; height:' . $height . 'px; cursor:pointer;}  a:hover img.' . $id . ' { border: none; background: url("' . $hover_image . '") no-repeat top left;  } '; return $button;
				 } else {
   return tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/' . $image, $alt, '', '', $parameters); }
 }

Edited by EIF

Share this post


Link to post
Share on other sites

Hi Sam,

 

What an amazing add-on you have made! Lots of enhancements in 1 package.

However I have a webshop running for a few years now with a lot of changes in layout I made over the years, so my question is this; do you have a simple solution to get a dropdown menu to let customers sort products by price, name or newly added products?

Maybe I can use only a part of your contri? (because I don't want to risk losing the changes i've made by installing your complete package)

 

Thank you in advance,

 

Berry

Edited by eprom

Share this post


Link to post
Share on other sites

Hi Spooks,

 

thank you very much for all your work. Everything works perfectly.

I would like to ask just one thing. Is it possible to make extra field in products listing a link? If I would have extra field let say color and a customer click on word "red" it displays all other products with the same extra field value "red"?

 

I tried to install contribution http://addons.oscommerce.com/info/4218 which makes search keywords from product name and hoped that I could change it, but it seems to be beyond my poor PHP knowledge :'(

Thank you very much

Share this post


Link to post
Share on other sites

hi everybody......

 

 

 

would be there someone to help me a bit for a problem i don't find solution ( i am not so good in php !!)

 

 

i use the contribution manufacturer2 that duplicate the manufacturer (http://addons.oscommerce.com/info/2634)

 

 

 

i try to find how i could return the name and _id of manufacturer2 in the product listing

 

 

 

 

is there anyone using this contribution with manufacturers2 ?

 

any suggestion that could help me ?

 

 

thnks you for your time...

 

 

 

 

sorry for my english skill !

 

 

ciju

Share this post


Link to post
Share on other sites

one more question if you please....

 

 

 

i try to find the answer in the topics but it is 90 pages and can't find the good words to make the correct search inside the topic...

 

i think maybe this question has allready been asked....

 

 

 

 

in my product listing , i can sort products by date_added , name of manufacturer (A-Z & Z-A) and name of product (A-Z & Z-A)

 

when the page loads, my listing show all products that match the request and the dropdown menu let me choose to order the listing either by date , name of manufacturer and name of product ...till there all is ok ....

 

but if i choose to order by name of product or manufacturer my page reload with the new listing ordered , but i cannot anymore choose to re-order it again by date added (only name of manufacturer or product)

 

 

is there something i mage wrong , or is there something to do to let my customer always be abble to order the listing by date added even they first choose to order it by an other way ?

 

 

i will be very please if someone can help me on this matter

 

 

thank you very much

 

 

ciju

Share this post


Link to post
Share on other sites

also one more thing and after i stop ;)

 

i can get the drop down to order by date in my product listing in products_new.php but it is not avalaible in index.php

 

 

for this also can i get an idea of what to do ?

 

many thx ..hope to get ananswer from one of you ;)

 

 

ciju

 

 

for those who would like to see in real what i'am talking about i can give you the web adress of the website i am working on (it is not a merchand shop , it is an artist gallery to show arts from designers)

Share this post


Link to post
Share on other sites

Hello Sam,

 

I would love to use your contribution but I get stuck with the integration of your contribution and the SPPC (seperate prices per customer) contribution. I just can't figure out how to merge them. Could you please help me out by telling me where I should add your PLE code?

 

In product_listing.php:

 


// Get product information from products_id parameter
$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
$product_info = tep_db_fetch_array($product_info_query);

// BOF Separate Price per Customer

   if(!tep_session_is_registered('sppc_customer_group_id')) { 
   $customer_group_id = '0';
   } else {
    $customer_group_id = $sppc_customer_group_id;
   }

      $scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id =  '" . $customer_group_id . "'");
      if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {
      $product_info['products_price']= $scustomer_group_price['customers_group_price'];
}
// EOF Separate Price per Customer

$template['regularprice'] = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));

 

In new_products.php:

 

<?php
/*
 $Id: new_products.php,v 1.34 2003/06/09 22:49:58 hpdl Exp $
 adapted for Separate Pricing Per Customer v4.2 2008/07/13

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- new_products //-->
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')));

 new contentBoxHeading($info_box_contents);

 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
// BOF Separate Pricing Per Customer
   $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and pd.language_id = '" . (int)$languages_id . "' and p.products_id = pd.products_id order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 } else {
   $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on pd.products_id = p2c.products_id left join " . TABLE_CATEGORIES . " c using(categories_id) where c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' and pd.language_id = '" . (int)$languages_id . "' and p.products_id = pd.products_id order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 }

// global variable (session) $sppc_customer_group_id -> local variable customer_group_id

 if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
   $customer_group_id = $_SESSION['sppc_customer_group_id'];
 } else {
   $customer_group_id = '0';
 }

 if (($no_of_new_products = tep_db_num_rows($new_products_query)) > 0) {
  while ($_new_products = tep_db_fetch_array($new_products_query)) {
$new_products[] = $_new_products;
$list_of_prdct_ids[] = $_new_products['products_id'];
}

$select_list_of_prdct_ids = "products_id = '".$list_of_prdct_ids[0]."' ";
 if ($no_of_new_products > 1) {
  for ($n = 1 ; $n < count($list_of_prdct_ids) ; $n++) {
  $select_list_of_prdct_ids .= "or products_id = '".$list_of_prdct_ids[$n]."' ";
  }
}
// get all customers_group_prices for products with the particular customer_group_id
// however not necessary for customer_group_id = 0
if ($customer_group_id != '0') {
 $pg_query = tep_db_query("select pg.products_id, customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where (".$select_list_of_prdct_ids.") and pg.customers_group_id = '".$customer_group_id."'");
while ($pg_array = tep_db_fetch_array($pg_query)) {
$new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price'], 'specials_new_products_price' => '');
}

  for ($x = 0; $x < $no_of_new_products; $x++) {
// replace products prices with those from customers_group table
    if(!empty($new_prices)) {
     for ($i = 0; $i < count($new_prices); $i++) {
	     if( $new_products[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
		     $new_products[$x]['products_price'] = $new_prices[$i]['products_price'];
	     }
     }
   } // end if(!empty($new_prices)
  } // end for ($x = 0; $x < $no_of_products_new; $x++)
} // end if ($customer_group_id != '0')

// an extra query is needed for all the specials
$specials_query = tep_db_query("select products_id, specials_new_products_price from " . TABLE_SPECIALS . " where (".$select_list_of_prdct_ids.") and status = '1' and customers_group_id = '" .$customer_group_id. "' ");
while ($specials_array = tep_db_fetch_array($specials_query)) {
$new_s_prices[] = array ('products_id' => $specials_array['products_id'], 'specials_new_products_price' => $specials_array['specials_new_products_price']);
}

// replace products_price with the correct specials_new_products_price
if(!empty($new_s_prices)) {
for ($x = 0; $x < $no_of_new_products; $x++) {
   for ($i = 0; $i < count($new_s_prices); $i++) {
     if( $new_products[$x]['products_id'] == $new_s_prices[$i]['products_id'] ) {
       $new_products[$x]['products_price'] = $new_s_prices[$i]['specials_new_products_price'];
     }
   }
 }
} // // end if(!empty($new_s_prices)

 $row = 0;
 $col = 0;

 $info_box_contents = array();

//  while ($new_products = tep_db_fetch_array($new_products_query)) {
for ($x = 0; $x < $no_of_new_products; $x++) {
// getting products_name added to the $new_products_query above so we can skip this
//    $new_products[$x]['products_name'] = tep_get_products_name($new_products[$x]['products_id']);

   $info_box_contents[$row][$col] = array('align' => 'center',
                                          'params' => 'class="smallText" width="33%" valign="top"',
                                          'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products[$x]['products_image'], $new_products[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products[$x]['products_id']) . '">' . $new_products[$x]['products_name'] . '</a><br>' . $currencies->display_price($new_products[$x]['products_price'], tep_get_tax_rate($new_products[$x]['products_tax_class_id'])));

   $col ++;
   if ($col > 2) {
     $col = 0;
     $row ++;
   }
  } // end for ($x = 0; $x < $no_of_new_products; $x++)
} //  end if (($no_of_new_products = tep_db_num_rows($new_products_query)) > 0)
// EOF Separate Pricing Per Customer
new contentBox($info_box_contents);
?>
<!-- new_products_eof //-->

 

in products_new.php

 

<?php
/*
 $Id: products_new.php 1739 2007-12-20 00:52:16Z hpdl $
 adapted for Separate Pricing Per Customer v4.2 2007/06/23

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

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

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PRODUCTS_NEW));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!-- body_text //-->
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_products_new.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
 $products_new_array = array();

 $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";
 $products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW);

 if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td class="smallText"><?php echo $products_new_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td>
           <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $products_new_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
 }
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
<?php
 if ($products_new_split->number_of_rows > 0) {
// BOF Separate Pricing Per Customer
//  global variable (session): $sppc_customers_group_id -> local variable $customer_group_id
 if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
   $customer_group_id = $_SESSION['sppc_customer_group_id'];
 } else {
   $customer_group_id = '0';
 }

   $products_new_query = tep_db_query($products_new_split->sql_query);
   $no_of_products_new = tep_db_num_rows($products_new_query);
   while ($_products_new = tep_db_fetch_array($products_new_query)) {
 	  $products_new[] = $_products_new;
    $list_of_prdct_ids[] = $_products_new['products_id'];
   }

 $select_list_of_prdct_ids = "products_id = '" . $list_of_prdct_ids[0] . "' ";
  if ($no_of_products_new > 1) {
    for ($n = 1 ; $n < count($list_of_prdct_ids) ; $n++) {
      $select_list_of_prdct_ids .= "or products_id = '" . $list_of_prdct_ids[$n] . "' ";
    }
  }

// get all customers_group_prices for products with the particular customer_group_id
// however not necessary for customer_group_id zero
if ($customer_group_id != '0') {
 $pg_query = tep_db_query("select pg.products_id, customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where (" . $select_list_of_prdct_ids . ") and pg.customers_group_id = '" . $customer_group_id . "'");
while ($pg_array = tep_db_fetch_array($pg_query)) {
  $new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price'], 'specials_new_products_price' => '');
}

  for ($x = 0; $x < $no_of_products_new; $x++) {
// replace products prices with those from customers_group table
// originally they would be obtained with an extra query for every new product:
//   if ($new_price = tep_get_products_special_price($products_new['products_id'])) {

    if (!empty($new_prices)) {
      for ($i = 0; $i < count($new_prices); $i++) {
        if ($products_new[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
          $products_new[$x]['products_price'] = $new_prices[$i]['products_price'];
        }
      }
   } // end if (!empty($new_prices)
  } // end for ($x = 0; $x < $no_of_products_new; $x++)
} // end if ($customer_group_id != '0')

// an extra query is needed for all the specials

$specials_query = tep_db_query("select s.products_id, specials_new_products_price from " . TABLE_SPECIALS . " s  where (".$select_list_of_prdct_ids.") and status = '1' and s.customers_group_id = '" .$customer_group_id. "'");
while ($specials_array = tep_db_fetch_array($specials_query)) {
  $new_prices[] = array ('products_id' => $specials_array['products_id'], 'products_price' => '', 'specials_new_products_price' => $specials_array['specials_new_products_price']);
}

// replace specials_new_products_price with those those for the customers_group_id
for ($x = 0; $x < $no_of_products_new; $x++) {

     if (!empty($new_prices)) {
       for ($i = 0; $i < count($new_prices); $i++) {
         if ( $products_new[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
           $products_new[$x]['specials_new_products_price'] = $new_prices[$i]['specials_new_products_price'];
         }
       }
     } // end if (!empty($new_prices)

if (tep_not_null($products_new[$x]['specials_new_products_price'])) {
        $products_price = '<s>' . $currencies->display_price($products_new[$x]['products_price'], tep_get_tax_rate($products_new[$x]['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($products_new[$x]['specials_new_products_price'], tep_get_tax_rate($products_new[$x]['products_tax_class_id'])) . '</span>';
     } else {
	$products_price = $currencies->display_price($products_new[$x]['products_price'], tep_get_tax_rate($products_new[$x]['products_tax_class_id']));
     }
?>
         <tr>
           <td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>" valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $products_new[$x]['products_image'], $products_new[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; ?></td>
           <td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new[$x]['products_id']) . '"><b><u>' . $products_new[$x]['products_name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . tep_date_long($products_new[$x]['products_date_added']) . '<br>' . TEXT_MANUFACTURER . ' ' . $products_new[$x]['manufacturers_name'] . '<br><br>' . TEXT_PRICE . ' ' . $products_price; ?></td>
           <td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new[$x]['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td>
         </tr>
         <tr>
           <td colspan="3"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
<?php // EOF Separate Pricing Per Customer
  } // end for ($x = 0; $x < $no_of_products_new; $x++)
 } else {

?>
         <tr>
           <td class="main"><?php echo TEXT_NO_NEW_PRODUCTS; ?></td>
         </tr>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
<?php
 }
?>
       </table></td>
     </tr>
<?php
 if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td class="smallText"><?php echo $products_new_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></td>
           <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $products_new_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
         </tr>
       </table></td>
     </tr>
<?php
 }
?>
   </table></td>
<!-- body_text_eof //-->
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </table></td>
 </tr>
</table>
<!-- body_eof //-->

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

 

and in specials.php:

 

<?php
/*
 $Id: specials.php 1739 2007-12-20 00:52:16Z hpdl $
 adapted for Separate Pricing Per Customer v4.2 2007/06/23

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

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

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SPECIALS));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!-- body_text //-->
   <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_specials.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
// BOF Separate Pricing Per Customer
//  global variable (session): $sppc_customers_group_id -> local variable $customer_group_id

 if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
   $customer_group_id = $_SESSION['sppc_customer_group_id'];
 } else {
   $customer_group_id = '0';
 }

 $specials_query_raw = "select 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' and s.customers_group_id = '" . (int)$customer_group_id . "' order by s.specials_date_added DESC";
// EOF Separate Pricing Per Customer
 $specials_split = new splitPageResults($specials_query_raw, MAX_DISPLAY_SPECIAL_PRODUCTS);

 if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td class="smallText"><?php echo $specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td>
           <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $specials_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
 }
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
<?php
// BOF Separate Pricing Per Customer

   $row = 0;
   $specials_query = tep_db_query($specials_split->sql_query);

   $no_of_specials = tep_db_num_rows($specials_query);
// get all product prices from the table products_groups in one query
// traverse specials_query for products_id's, store the query result in a numbered array
  while ($_specials = tep_db_fetch_array($specials_query)) {
   $specials[] = $_specials;
   $list_of_prdct_ids[] = $_specials['products_id'];
  } // end while ($_specials = tep_db_fetch_array($specials_query))
// a line needed for the selection of the products_id's
 $pg_list_of_prdct_ids = "products_id = '".$list_of_prdct_ids[0]."' ";
 if ($no_of_specials > 1) {
   for ($n = 1 ; $n < count($list_of_prdct_ids) ; $n++) {
     $pg_list_of_prdct_ids .= "or products_id = '".$list_of_prdct_ids[$n]."' ";
   }
 }
// now get all the customers_group_price's
$pg_query = tep_db_query("select products_id, customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where (".$pg_list_of_prdct_ids.") and customers_group_id =  '" . $customer_group_id . "'");
// put all the info in an array called new_prices
while ($pg_array = tep_db_fetch_array($pg_query)) {
  $new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['customers_group_price']);
}
// we already got the results from the query and put them into an array, can't use while now
//    while ($specials = tep_db_fetch_array($specials_query)) {
for ($x = 0; $x < $no_of_specials; $x++) {
     $row++;
// replace products prices with those from customers_group table
     if (!empty($new_prices)) {
       for ($i = 0; $i < count($new_prices); $i++) {
         if ($specials[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
           $specials[$x]['products_price'] = $new_prices[$i]['products_price'];
         }
       }
     } // end if (!empty($new_prices)

     echo '            <td align="center" width="33%" class="smallText"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $specials[$x]['products_image'], $specials[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $specials[$x]['products_id']) . '">' . $specials[$x]['products_name'] . '</a><br><s>' . $currencies->display_price($specials[$x]['products_price'], tep_get_tax_rate($specials[$x]['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $currencies->display_price($specials[$x]['specials_new_products_price'], tep_get_tax_rate($specials[$x]['products_tax_class_id'])) . '</span></td>' . "\n";
// EOF Separate Pricing per Customer, specials code

     if ((($row / 3) == floor($row / 3))) {
?>
         </tr>
         <tr>
           <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
         <tr>
<?php
     }
   }
?>
         </tr>
       </table></td>
     </tr>
<?php
 if (($specials_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
     <tr>
       <td><br><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr>
           <td class="smallText"><?php echo $specials_split->display_count(TEXT_DISPLAY_NUMBER_OF_SPECIALS); ?></td>
           <td align="right" class="smallText"><?php echo TEXT_RESULT_PAGE . ' ' . $specials_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
         </tr>
       </table></td>
     </tr>
<?php
 }
?>
   </table></td>
<!-- body_text_eof //-->
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </table></td>
 </tr>
</table>
<!-- body_eof //-->

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

 

If you could help me out with this as I think this is the final step to finalising my website. I've looked into the forum and haven't find anything that could help me out. You are my last hope or anyone else of course.

Share this post


Link to post
Share on other sites

Hi Sam

 

Thanks for your fantastic Module.

 

It works fine on my mebsite:

 

www.shakeran.com

 

but I have 2 problems:

 

1) The language of my site is Persian(farsi)(UTF-8), and the last character of the Product Truncated Description is usually something like: � why? (and this causes IE not to detect the end of text)

how can I fix it? I think the Mod can't truncate persian texts properly?

 

2) In "list view", the columns are not sorted as my previous sort order. I mean I need to have this arrengment form right to left:

 

product model, product name, product image, Product Truncated Description, price, buy now

 

 

What should I do?

 

Thanks

Edited by shakeran

فروشگاه بزرگ اینترنتی شاکران

Share this post


Link to post
Share on other sites

Hello and thank you for all of your hard work on this contribution. I have installed it but am having some problems with certain items being displayed. I am using thumbnails in a grid - 4 across. I made that change in the css.

 

I have tried using the settings in the admin panel but it doesn't seem to work for a few things. For instance: I would like the item name, price then the attributes (2) different ones then a buy now button. However, in trying to set these to display, they aren't.

 

I ran the sql, made all the changes, but it appears there might be something wrong with what i did.

 

Could you please let me know what I messed up. Also, since this is such a great contribution maybe you could make an faq section that would minimize all of these questions.

 

 

site http://www.sunnysleevez.com/catalog

 

Thanks again

 

Beth

Share this post


Link to post
Share on other sites

Hello Spooks,

 

Firstly, thank you very much for your work on this very useful contribution.

I work on it and most of them works perfectly fine.

Though I could not modified 'SOLD OUT but displayed' contribution with your contribution.

When product is sold out, it turns inactive automatically.

 

How to make product_listing and new_products display sold out product with 'sold out' button instead of buy now / details button?

I need to have sold out products displayed in store for showcase.

 

Thank you very much in advance.

Raykit

Edited by raykit

Share this post


Link to post
Share on other sites

Hi.

When i click on a category in my cloumn left it past all the subcategories in the index side.

Does anyone know how i can remove the subcategories in the index side. Not in my column left categories..

 

I only whant products to show up in the index side.

Thanks :)

Share this post


Link to post
Share on other sites

Hi Spooks and Everyone

 

Please can yuoou help me. I have trawled though loads of the 92 pages of this topic but can't find the answer to my question (thats not to say it isn't there, i just haven't found it).

 

I have had this contribution working great on my site for a while now and it really is great. I have now installed the 'Featured Products' contribution and wanted to know how i can get the module on the index page that replaces the new products module to display with borders etc as per this contibution. I know that the latest version includes add on pages for the featured.php page, bu this doesnt help me with the index page module.

 

Please help me out anyone???

 

Thanks in advance

 

Matt S

Share this post


Link to post
Share on other sites

Hi Spooks and Everyone

 

Please can yuoou help me. I have trawled though loads of the 92 pages of this topic but can't find the answer to my question (thats not to say it isn't there, i just haven't found it).

 

I have had this contribution working great on my site for a while now and it really is great. I have now installed the 'Featured Products' contribution and wanted to know how i can get the module on the index page that replaces the new products module to display with borders etc as per this contibution. I know that the latest version includes add on pages for the featured.php page, bu this doesnt help me with the index page module.

 

Please help me out anyone???

 

Thanks in advance

 

Matt S

 

 

Really sorry about this - after a good nights sleep i found the info i was after.

 

Sam - can i suggest the the module files are included in the contribution as well as the add on pages for featured products etc. It will help pepple like me out in the future.

 

These can be found here: Modlue & Add-on Filesand although i had to make an amend to the module code for Featured Products it was a great starting point.

 

Thanks again for this great contribution

 

Matt

Share this post


Link to post
Share on other sites

Hi All

 

I'm still working hard to perfect this contribution. I have managed to get almost all the elements working well, either through the kind help of Sam or from the general community support, and sometimes from just trial and error.

 

The last area that i need help with is to get the contibution working with the Xsell addon. I have installed this successfully but would now like to get this module looking in keeping with my product listings and featured products etc.

 

The contibution available here basicially lets you list a number of releted products on each product page by assigning relationships in the admin.

 

The code for module is below. I have tried playing with this using the new products module and featured products modules as an example but the coding changes required are beyone me unfortunately and i just get endless errors.

 

Please can someone take a look at the code below and let me know how to get this to use the product listing layout.

 

Cheers all.

Matt S

 

<?php
/*
$Id: xsell_products.php, v1  2002/09/11
// adapted for Separate Pricing Per Customer v4 2005/02/24

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

Copyright (c) 2002 osCommerce

Released under the GNU General Public License
*/
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_XSELL_PRODUCTS);
if ((USE_CACHE == 'true') && empty($SID)) {
// include currencies class and create an instance
require_once(DIR_WS_CLASSES . 'currencies.php');
$currencies = new currencies();
}

if ($HTTP_GET_VARS['products_id']) {

$xsell_query = tep_db_query("select distinct p.products_id, p.products_image, pd.products_name, p.products_tax_class_id, products_price, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, specials_new_products_price
from " . TABLE_PRODUCTS_XSELL . " xp left join " . TABLE_PRODUCTS . " p on xp.xsell_id = p.products_id
left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "'
left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id 
where xp.products_id = '" . $HTTP_GET_VARS['products_id'] . "'
and p.products_status = '1'
order by sort_order asc limit " . MAX_DISPLAY_XSELL);

$num_products_xsell = tep_db_num_rows($xsell_query);
if ($num_products_xsell > 0) {
?>
<!-- xsell_products //-->
<?php
    $info_box_contents = array();
    $info_box_contents[] = array('align' => 'left', 'text' => TEXT_XSELL_PRODUCTS);
    new contentBoxHeading($info_box_contents);

    $row = 0;
    $col = 0;
    $info_box_contents = array();
    while ($xsell = tep_db_fetch_array($xsell_query)) {
		if (tep_not_null($xsell['specials_new_products_price'])) {
			$xsell_price =  '<s>' . $currencies->display_price($xsell['products_price'], tep_get_tax_rate($xsell['products_tax_class_id'])) . '</s><br>';
      	$xsell_price .= '<span class="productSpecialPrice">' . $currencies->display_price($xsell['specials_new_products_price'], tep_get_tax_rate($xsell['products_tax_class_id'])) . '</span>';
		} else {
			$xsell_price =  $currencies->display_price($xsell['products_price'], tep_get_tax_rate($xsell['products_tax_class_id']));
		}
      $text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $xsell['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $xsell['products_image'], $xsell['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $xsell['products_id']) . '">' . $xsell['products_name'] .'</a><br>' . $xsell_price. '<br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=buy_now&product_to_buy_id=' . $xsell['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $xsell['products_name'] . TEXT_NOW) .'</a>';
      $info_box_contents[$row][$col] = array('align' => 'center',
                                             'params' => 'class="smallText" width="33%" valign="top"',
                                             'text' => $text) ; 
   $col ++;
      if ($col > 2) {
        $col = 0;
        $row ++;
      }
    }
new contentBox($info_box_contents);
?>
<!-- xsell_products_eof //-->
<?php
  }
}
?>

Share this post


Link to post
Share on other sites

An easy one (?) but I don't get it...

 

How do I get the price next to the add_cart image? (I only display the small by now)

Share this post


Link to post
Share on other sites

Hello!

 

I have a weird problem. In the admin section i've chosen "thumbnails in grid" and to show 12 products at a time. But sometimes (it seems random) when i select a manufacturer it shows the manufacturers products in "list mode" and 48 or all products. This only happens with manufaturers when i chose a category it always displays 12 thumbnails in a grid. Anyone got any ideas?

 

Thank you for taking your time.

Edited by kurios

Share this post


Link to post
Share on other sites

Hey Spooks,

 

Love the contribution.

 

I was just playing around with the code to see if I could limit the number of products listed in the products_new.php page using "MAX_DISPLAY_PRODUCTS_NEW" but it doesn't seem possible (or I'm just not good enough) since the products query is already being limited by the "MAX_DISPLAY_SEARCH_RESULTS".

 

Can you tell me if this is possible to do? I just don't want to keep trying to make it work when it can't even be done.

 

Hope to hear back from you.

 

Thanks.

Share this post


Link to post
Share on other sites

This contribution runs perfectly now, but now I want to install Ultimate SEO URL, version 2-2.2d-10.

 

These two are conflicting with each other. Can't add products to the cart anymore from the listing. Or when in the product_info, I can, but when go to another product, the cart is empty again.

 

Does someone has experience with both contribution and can help me out?

Share this post


Link to post
Share on other sites

Many thanks for your patience Sam, I confess I barely remember even going there, I really mustn't try to learn this stuff at night with a bottle of red. I've just read the Vampire article in your signature, eek.

 

 

I've PMd you a link rather than show it in public, just so you can witness my intermittent borders in IE8. It looks a pretty patternless behaviour to me. It probably goes without saying that it's fine in Firefox.

I'm experiencing the same thing in IE8, but I have noticed a pattern! When I load the page the borders are broken...

When I hover over the page results OR choose to view all products the borders magically reappear! :huh:

Share this post


Link to post
Share on other sites

Spooks

 

Thank you for another wonderful contribution - I have previously used your security guidance to very good effect.

 

Product Listing Enhancements is working well on our website www.abbeybook.com Ideally would like to have an additional sorting option, so customers can list our old books in order of publication date. But this is contained in one of our Extra Fields. Is it possible to add some code to enable sorting on an extra field? To do so, would we need to enable display of extra fields in admin?

 

Thanks again for your help.

Share this post


Link to post
Share on other sites

 

ie8 can have an issue still:

 

edit your index.php & advanced search results.php & any others that call the listing:

 

immediatly after the

 

<head>add:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

Hi Spooks,

 

I've installed the contribution and was dealing with the same issue in IE8. I've tried adding the IE7 emulate code, but this didn't make a difference.

The tooltip image still appeared behind the next main product thumb. I wanted the tooltip image to appear in exactly the same place as the main thumb

because I'm using it swap the main thumb with another/additional product image.

Mainly because I added adding left:0; to span.ttip a:hover img.large in page-header-inc.htc, the IE8 issue was fixed.

I removed the if IE7 css bit....

Share this post


Link to post
Share on other sites

Hi Spooks, was wondering if you could help me integrate another add-on into this great contribution of yours. I have installed the Availability 1.0.3 contrib. (http://addons.oscommerce.com/info/4948) which basically displays some text if the product is in or out of stock (this text is displayed only on the product info and shopping cart pages). I want to get the text to display on product listing, I have tried but its a bit beyond my capabilities. I am using Product Listing Style: manufacturer in blocks and would like the text from the Availability contrib. to appear directly underneath the image I have for products_free_shipping. Below is the code from my products_listing.php file. :)

 

<?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 = 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 . ' </td><td><a href="javascript:changeValue(document.getElementById(\'qid'.$products_id.'\'),-1);">' . tep_image_button('minus.png',LESS) . '</a></td><td>' . 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('plus.png',MORE) . '</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') ? '<span class="short">' . $listing['short_desc'] . '</span>' : '');
					$extra_fields_text = extra_fields($listing['products_id']);
					if ($extra_fields_text) $text .= '<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 />'. product_description($listing['products_id'],$link) . ''; $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 ? '+' : ' ') ; 
					 }



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

Hello,

I have installed this great contrib onto my osc site which uses STS contrib also. Everything seems to be fine except that the box titles at the top of the products list are not displaying properly. Instead I have:

 

TABLE_HEADING_PRODUCTS

TABLE_HEADING_PRICE

TABLE_HEADING_BUY_NOW

 

etc..

 

these headers are working fine in my shopping cart page but not on the main home page. They are also fine on the category pages unless there are sub categories in which case I get the 'calls' above (is that the right word? i have no idea) .

 

 

in my english/index.php file the defines are there

 

define('TABLE_HEADING_PRODUCTS', 'Product Name');

define('TABLE_HEADING_PRICE', 'Price');

define('TABLE_HEADING_BUY_NOW', 'Buy Now');

 

 

Any ideas what has happened and why they seem to work on some pages but not the top pages (home, category with sub categories)?

 

any help muchly appreciated!

 

jon

Share this post


Link to post
Share on other sites

Hi all

 

Vast improvement on the out of the box product listing. I'm having a problem though with TD widths. I've got it set up to display 4 products per row.(this will never change)

 

I've run through product_listing.php and can see that theres a few lines of code thoughout like

 

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

 

I need to make the TD's a specific size as in the site design. I've tried deleting the width equation and setting the width with CSS but nothing changes. Is this the code that needs changing or is it hidden somwhere else?

 

If someone could please please help me out it would stop me going insane and just staring at the screen!

Share this post


Link to post
Share on other sites

Hi,

 

Really love this contribution, it's really helping me get the look and feel I'm wanting for my site. The php is all rather new to me so there are a couple of minor tweaks I can't see how to change and having trawled through a number of threads on the message boards I'm still no further.

 

Firstly, here's my index page... here

 

With this contribution, I was then able to make my category pages look pretty much the same... Cushions link

 

The queries I have are probably simple for someone who knows what they're doing.

 

1. How do I centre the product description and move it up slightly, so it looks like the category descriptions on my index page?

 

2. How do I then get the rollover event to match, with the italic effect, I can't see which point in the css this hover state is being called.

 

3. I'm getting a large white space below my heading and the tops of the first images and can't see how to reduce this down. When I inspect the page it is saying that the pixel spacer image is there, but I can't see where this is called in the code.

 

Many thanks

 

Satkin2

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  

×