Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

add / minus buttons for qty boxes on product_listing


Guest

Recommended Posts

Hi, I have just installed this contribution - http://addons.oscommerce.com/info/6369 which adds a qty box with add and minus buttons to product_info and it works great. I like it so much I would like to have the feature on the product_listing page as well, problem is the code doesn’t seem to work on product_listing. If someone could please tell me where to put the code in product_listing in order to get it work I would be extremely grateful.

 

This is the code to the qty box and the add/minus buttons:

 

<script type="text/javascript" src="js/calculate.js"></script>
<script type="text/javascript" src="js/prototype.js"></script>
<img src="<? echo DIR_WS_IMAGES .'icons/plus.png' ?>" onclick="changeQty('add');" />
<input name="quantity" type="text" class="moduleRow" id="quant" style="text-align:center" onkeyup="changeQty('field');" value="1" size="4" maxlength="4" />
<img src="<? echo DIR_WS_IMAGES .'icons/minus.png' ?>" onclick="changeQty('subtract');" /><br />

 

and here is my product_listing:

 

<form name="cart_multi" method="post" action="<?php echo tep_href_link(FILENAME_SHOPPING_CART, tep_get_all_get_params(array('action')) . 'action=add_multi', 'NONSSL'); ?>">
<?php
/*
 $Id: product_listing.php,v 2 2008/06/30 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
*/


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>"; }
$listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');
 if ( ($listing_split->number_of_rows > (int)MAX_DISPLAY_SEARCH_RESULTS) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 </tr>
</table>

<?php
}

function thumbnail($products,$manufacturer = NULL,$column_list,$border,$borderend,$PHP_SELF) {
$currencies = new currencies();
	$image = $products['products_image']; 
	$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']))); 
										} 
$image = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $image, ($addimages ? ($selected_image['images_description'] ? $selected_image['images_description'] : ($selected_image['products_image_description'] ? $selected_image['products_image_description'] : $products['products_name'])) : $products['products_name']), PRODUCT_IMAGE_WIDTH, '') . '</a>' . '<br><br>';
	$buypic = (LISTING_BUTTON == 'buy now' ? 'button_in_cart.gif' : 'button_buy_now.gif');
	$button = (LISTING_BUTTON != 'none' && PRODUCT_LIST_BUY_NOW ? (LISTING_BUTTON == 'buy now & details' ? '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products['products_id']) . '">' . tep_image_button($buypic, IMAGE_BUTTON_BUY_NOW, 'class="thm_buy_now"') . '</a> <span class="buy_now">|</span> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . tep_image_button('button_details_small.gif', IMAGE_BUTTON_DETAILS, 'class="thm_buy_now"') . '</a><br><br>' : (strstr(LISTING_BUTTON, 'buy now') ? '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products['products_id']) . '">' . tep_image_button($buypic, IMAGE_BUTTON_BUY_NOW) . '</a><br><br>' : '<br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . tep_image_button('button_details.gif', IMAGE_BUTTON_DETAILS) . '</a><br><br>' )) : ' '); 

	$name =	'<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">'. '<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'])); 					  
	$show_price = '<br><font size="'.PRODUCT_PRICE_SIZE.'">' . ($products['products_price'] > 0 ? $price : 'P.O.A') . '<br></font>';
	$quantity = ($products['products_quantity'] ? 'Stock = '.$products['products_quantity'] : 'Out of Stock').'<br />';
	$weight = 'Weight = '.$products['products_weight'].'Kg<br />';
$model = $products['products_model'] . '<br>';
	$manfact = $products['manufacturers_name'].'<br />'.(MANU_DESCRIPTION == 'true' && $products['manufacturers_description'] ? $manufacturer['manufacturers_description'].'<br />' : '');
	$display = $border;
	for ($disp=0, $n=sizeof($column_list); $disp<$n; $disp++) {
	switch ($column_list[$disp]) {
	  case 'PRODUCT_LIST_IMAGE':
				  $display .= $image;
		break;
				case 'PRODUCT_LIST_NAME':
		$display .= $name;
		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;	
				}
	}
$display .= $borderend . $button;	
return($display);
}// thumb function end

function list_box_head($column_list) {

 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 = '';
	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;
  // START: display min. order. qty. mod
  case 'PRODUCT_LIST_MIN_ORDER_QTY':
	$lc_align = 'center';
	$lc_text = ' ' . TABLE_HEADING_MIN_ORDER_QTY . ' ';
	break;
  // END: display min. order. qty. mod
  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 = (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"','text' => ' ' . $lc_text . ' ');
 }
 return ($list_box_contents);
}
// function list_head end	

function list_box_data($listing, $column_list,$PHP_SELF) {
				$currencies = new currencies();
			if (!strstr(PRODUCT_THUMBNAIL_VIEW, 'block'))	{			
			for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
	$lc_align = '';

	switch ($column_list[$col]) {
	  case 'PRODUCT_LIST_MODEL':
		$lc_align = 'center';
		$lc_text = ' ' . $listing['products_model'] . ' ';
		break;
case 'PRODUCT_LIST_NAME':
		$lc_align = '';
		if (isset($HTTP_GET_VARS['manufacturers_id'])) {
		  $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . ' ' .  $category['categories_keyword'] .  '</a>';
		} else {
		 $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . ' ' . $category['categories_product_title'] .  '</a> ';
		}
if (PRODUCT_LIST_DESCRIPTION && $listing['products_description'] && PRODUCT_LIST_DESCRIPTION_MAX_LENGTH)
		$lc_text .= '<br><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td class="productDesc">' . tep_flatten_product_description($listing['products_description'],  ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . TEXT_MORE . '</a>') . '</td></tr></table>';
		break;
	  case 'PRODUCT_LIST_MANUFACTURER':
		$lc_align = '';
		$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';
		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>';

} else {
		  $lc_text = ' ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '  <br><span class="productPriceEX">(' . $currencies->display_price_ex($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ex.vat)</span>';
					  }
		break;
	  case 'PRODUCT_LIST_QUANTITY':
		$lc_align = 'right';
		$lc_text = ' ' . $listing['products_quantity'] . ' ';
		break;
	  // START: display min. order. qty. mod
	  case 'PRODUCT_LIST_MIN_ORDER_QTY':
		$lc_align = '';
		$lc_text = ' ' . $listing['products_min_order_qty'] . ' ';
		break;
	  // END: display min. order. qty. mod
	  case 'PRODUCT_LIST_WEIGHT':
		$lc_align = 'right';
		$lc_text = ' ' . $listing['products_weight'] . ' ';
		break;
	  case 'PRODUCT_LIST_IMAGE':
		$lc_align = 'center';
		if (isset($_GET['manufacturers_id'])) {
		  $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $_GET['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
		} else {
		  $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
		}
		break;
	  case 'PRODUCT_LIST_BUY_NOW':
$lc_align = 'center';
if ($listing['products_free_shipping'] == true) {			 
$lc_text  = '<input type="text" STYLE="text-align:center" name="add_id['.$number_of_products.']" value="0" size="1"> ' . FREE_SHIPPING_FOR_THIS_PRODUCT . '';
		$lc_text .= '<input type="hidden" name="products_id['.$number_of_products.']" value="'.$listing['products_id'].'">';

} else {
$lc_text  = '<input type="text" name="add_id['.$number_of_products.']" value="0" size="1">';
		$lc_text .= '<input type="hidden" name="products_id['.$number_of_products.']" value="'.$listing['products_id'].'">';
	   }
		break;
	}
			$list_box_temp[] = array('align' => $lc_align,
							 'params' => 'class="productListing-data" width="'.($column_list).'%" ',
							 'text'  => $lc_text);
  }
	} else {  // block listing 
	$list_box_temp = array();
	if (PRODUCT_LIST_IMAGE) { $list_box_temp[] = array('align' => 'center',
																	   'params' => 'class="productListing-data" ',
							 											 'text'  => (isset($_GET['manufacturers_id']) ? '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $_GET['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>' : '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>' ));   }
		 $display ='';
	for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
	switch ($column_list[$col]) {
	  case 'PRODUCT_LIST_MODEL':
		$display .= $listing['products_model'] . '<br>';
		break;
	  case 'PRODUCT_LIST_NAME':
		if (isset($_GET['manufacturers_id'])) {
		   $display .= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . 
$_GET['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '"><b><u>' . $listing['products_name'] . '</u></b></a><br>' . ($listing['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? '<span class="short">' . $listing['short_desc'] . '</span><br>' : '');
			} else {
		   $display .= '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . 
$listing['products_id']) . '"><b><u>' . $listing['products_name'] . '</u></b></a><br>' . ($listing['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? '<span class="short">' . $listing['short_desc'] . '</span><br>' : '');}
	   break;
	  case 'PRODUCT_LIST_MANUFACTURER':
		$display .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a><br>';
		break;
	  case 'PRODUCT_LIST_PRICE':
				  $display .= '<br>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'])) {
		  $display .= '<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>';
		} else {
					   $display .= ($listing['products_price'] > 0 ? '' . $price : '' . TEXT_POA); 
if (function_exists(tep_get_att_price)) $display .= (tep_get_att_price($listing['products_id']) > 0 ? '+' : ' '); 
						 $display .= '<br>'; 
		}
		break;
	  case 'PRODUCT_LIST_QUANTITY':
		$display .=  ($listing['products_quantity'] ? 'Stock = ' . $listing['products_quantity'] : 'Out of Stock') . '<br>';
		break;
	  case 'PRODUCT_LIST_WEIGHT':
		$display .= 'Weight = ' . $listing['products_weight'] . '<br>';
		break;
			}
		}	
$list_box_temp[] = array('align' => 'left',
						 'params' => 'class="main" valign="top"',
						 'text'  => $display);
	if (PRODUCT_LIST_BUY_NOW) {
		$buypic = (LISTING_BUTTON == 'buy now' ? 'button_in_cart.gif' : 'button_buy_now.gif');
	  $button = (LISTING_BUTTON == 'buy now & details' ? '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button($buypic, IMAGE_BUTTON_BUY_NOW, 'class="thm_buy_now"') . '</a> <span class="buy_now">|</span> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . tep_image_button('button_details_small.gif', IMAGE_BUTTON_DETAILS, 'class="thm_buy_now"') . '</a><br><br>' : (strstr(LISTING_BUTTON, 'buy now') ? '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button($buypic, IMAGE_BUTTON_BUY_NOW) . '</a><br><br>' : '<br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . tep_image_button('button_details.gif', IMAGE_BUTTON_DETAILS) . '</a><br><br>' )); 
	$list_box_temp[] = array('align' => 'left',
						 'params' => 'class="productListing-data" width="'.(100/4).'%" ',
						 'text'  => $button);
			}
	}
	return 	($list_box_temp);	
}
// function list_box_data end	

// set initial values	
$thumbnail_view = (isset($HTTP_GET_VARS['list']) ? $HTTP_GET_VARS['list'] : PRODUCT_THUMBNAIL_VIEW); 
$empty_list=false;
$grid = strstr(PRODUCT_THUMBNAIL_VIEW, 'grid');
$gborders = function_exists(mws_boxHeader);
$Tborder = (!$gborders ? '<table class="infoBoxList" width="100%"><tr><td>' : mws_boxHeader ());
$Tborderend = (!$gborders ? '</td></tr></table>' : mws_boxFooter ());
$border2 = (!$gborders ? '<table class="infoBoxList" width="100%"><tr><td>' : ($graphic_bord == 'yes' ? mws_boxHeader() : ''));  
$border2end = (!$gborders ? '</td></tr></table>' : ($graphic_bord == 'yes' ? mws_boxFooter() : ''));		


// output selected display
if (strstr($thumbnail_view, 'thumbnails')) {  //thumbnail
 $row = 0;
 $col = 0;
 $border = (!$grid ? '<table class="infoBoxProducts" cellpadding="4" width="'.PRODUCT_LIST_WIDTH.'" height="'.PRODUCT_LIST_HEIGHT.'"><tr><td>' : '<br>');
$borderend = (!$grid ? '</td></tr></table>' : '');
$style = (!$grid ? 'class="smallText"' : 'class="infoBoxGrid"');
$info_box_contents = array();
if ($listing_split->number_of_rows > 0) {   $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 ? (100/PRODUCTS_PER_ROW) : '').'%" valign="top"',
									   'text' =>  ' ');  
																				 echo $Tborder;$row ++;
				   }
	 $info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => $style . ' width="'.(PRODUCTS_PER_ROW ? (100/PRODUCTS_PER_ROW) : '').'%" valign="top"',
									   'text' => thumbnail($products, '',$column_list,$border,$borderend,$PHP_SELF));
	$col ++;
if ($col > PRODUCTS_PER_ROW-1) {
  $col = 0;
  $row ++;
}
}  // prod loop
} else {$empty_list=true; }// no products!!
// got display
if ($row) { $col = 0;$row ++;$info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'class="smallText" width="'.(PRODUCTS_PER_ROW ? (100/PRODUCTS_PER_ROW) : '').'%" ',
									   'text' =>  ' ');
if ($gborders && class_exists(noborderBox)) new noborderBox($info_box_contents); else new contentBox($info_box_contents);
echo $Tborderend;
							} else {$empty_list=true; }
} elseif (strstr($thumbnail_view, 'manufacturer')) {  //manufacturer

$row = 0;$col = 0;

if (!isset($_GET['manufacturers_id'])) {
$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");
}else{$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 . "'");}
if (tep_db_num_rows($filterlist_sql)) { 	 
			echo tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART, 'align="right"');

			while ($manufacturer = tep_db_fetch_array($filterlist_sql)) {	 		
			$info_box_heading = array();
	echo $border2; 
	$info_box_heading[0] = array('text' => '' .$category['categories_keyword']. ' • '.$manufacturer['manufacturers_name'].' <br />'.(MANU_DESCRIPTION == 'true' ? $manufacturer['manufacturers_description'].'<br />' : ''));
	new infoBoxHeading($info_box_heading, false, false);	
	echo tep_draw_separator('pixel_trans.gif', '100%', '20');		 
  $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);} else {
	$listing_query = tep_db_query($listing_sql); }
while ($listing = tep_db_fetch_array($listing_query)) {
	if ($listing['manufacturers_id'] != $manufacturer['manufacturers_id']) continue;
  $rows++;

  $list_box_contents[] = (($rows/2) == floor($rows/2) ? array('params' => 'class="productListing-even"') : array('params' => 'class="productListing-odd"'));
  $cur_row = sizeof($list_box_contents) - 1;
		$list_box_contents[$cur_row] =	list_box_data($listing, $column_list,$PHP_SELF);  
  }
  if (!$rows && isset($_GET['manufacturers_id'])) {
  $list_box_contents = array();
$list_box_contents[0] = array('params' => 'class="productListing-odd"');
$list_box_contents[0][] = array('params' => 'class="productListing-data"',
							   'text' => TEXT_NO_PRODUCTS); $rows++; }
  if ($rows) new productListingBox($list_box_contents); 
echo $border2end . tep_draw_separator('pixel_trans.gif', '100%', '4');

echo tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART,'align="right"');
}   // man loop;
	$col = 0;$row ++;$info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'class="smallText" width="33%" valign="top"',
									   'text' =>  ' ');
} else {$empty_list=true; }  // no manufacturers!!
}
if ((!strstr($thumbnail_view, 'thumbnails') && !strstr($thumbnail_view, 'manufacturer')) || $empty_list) {   //default listing

  $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)) {
  $rows++;

 $list_box_contents[] = (($rows/2) == floor($rows/2) ? array('params' => 'class="productListing-even"') : array('params' => 'class="productListing-odd"'));
 $cur_row = sizeof($list_box_contents) - 1;

		$list_box_contents[$cur_row] =	list_box_data($listing, $column_list,$PHP_SELF);  
}
new productListingBox($list_box_contents);
 } else {
$list_box_contents = array();

$list_box_contents[0] = array('params' => 'class="productListing-odd"');
$list_box_contents[0][] = array('params' => 'class="productListing-data"',
							   'text' => TEXT_NO_PRODUCTS);
new productListingBox($list_box_contents);
 }


 }
	   if ( ($listing_split->number_of_rows > (int)MAX_DISPLAY_SEARCH_RESULTS) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td align="right" class="main"><?php echo tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>
 </tr>
</table>
<?php echo tep_draw_separator('pixel_trans.gif', '100%', '20');?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr>
<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
</tr>
</table>

</form>
<?php
 }
echo tep_draw_separator('pixel_trans.gif', '100%', '100');					
if (!strstr(PRODUCT_THUMBNAIL_VIEW, 'list') && LISTING_SWITCH != 'false') echo '<br><span class="smalltext"><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('list')). 'list='.($thumbnail_view == 'thumbnails' ? 'manufacturer' : 'thumbnails')) . '">' . ($thumbnail_view == 'thumbnails' ? 'List View' : 'Thumbnail View').'</a></span><br /><br />';


?>

 

Thanks.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...