Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

osCommerce Novice: 1054 - Unknown column Error


Guest

Recommended Posts

Hello all. First let me begin by saying that this is my first time posting here, and I don't know if I'm posting in the right location. Anyhow my problem began right after the version of mySQL changed from 4 to 5. When going to My Website and then finding an item to click on (one of the fish for example) it gives me this big long error. I have spent a few hours reading posts on here on how to fix it, but to be honest, I tried doing a few of the changes, but there is just so much custom coding in there that I can't seem to fix it. Thanks.

 

J

Link to comment
Share on other sites

Hello all. First let me begin by saying that this is my first time posting here, and I don't know if I'm posting in the right location. Anyhow my problem began right after the version of mySQL changed from 4 to 5. When going to My Website and then finding an item to click on (one of the fish for example) it gives me this big long error. I have spent a few hours reading posts on here on how to fix it, but to be honest, I tried doing a few of the changes, but there is just so much custom coding in there that I can't seem to fix it. So I guess what I'm looking for is for someone to fix it for me and let me know how much they will do it for. Thanks.

 

J

 

Post the contents of your product_info.php here.

Link to comment
Share on other sites

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

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

require('includes/application_top.php');

// Begin - seo tags - meta_tags.php
$content = CONTENT_PRODUCT_INFO;
// End - seo tags - meta_tags.php

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

// jr - begin - product additional fields - include fields if it exists
if (file_exists(DIR_WS_ADDITIONAL_FIELDS . '_product_add_fields_variables_always.php')) {
include(DIR_WS_ADDITIONAL_FIELDS . '_product_add_fields_variables_always.php'); }
else {	$select_product_add_fields = " from "; }
// jr - end - product additional fields - include fields if it exists

 $pid = $HTTP_GET_VARS['products_id'];
 $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
 $product_check = tep_db_fetch_array($product_check_query);
?>

<?php echo HTML_DOC_TYPE; ?>
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript" src="includes/javascript/popupimage.js"></script>
<script language="javascript" src="includes/javascript/popupimagewatermark.js"></script>
<script language="javascript" src="includes/javascript/formfieldprogressbar.js"></script>

<script language="javascript">
function popupWindow(url) {
 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res
izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le
ft=150')
}


function rowOverEffect(object) {
 if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
 if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}

function quantity_ordered(qty) {
 document.cart_quantity_form.elements['cart_quantity'].value = qty;
}


</script>

</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->


<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?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 //-->


<?php 
// iii 030813 added:  File upload: 'enctype="multipart/form-data"'
// explicitly state post so that the parameters sections can be set
// It might be better to make this dependent on the presence of file fields 
// in the future.
?>
<td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity_form', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product'), 'POST', 'enctype="multipart/form-data"'); ?>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
	<td><?php echo $messageStack->output('upload'); ?></td>
  </tr>

<?php
//echo '<b>env: <br>' . print_r($_ENV);
//echo '<b>pid: ' . $pid;
// echo '<br>In Here: ' . $HTTP_GET_VARS['products_id']; 
 if ($product_check['total'] < 1) {
//	 echo '<br>In Here2: ' . $HTTP_GET_VARS['products_id'];
?>
  <tr>
	<td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
<?php
 } else {
// jr - begin - product additional fields
$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, " . $select_product_add_fields . 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 p.products_id = paf.products_id and pd.language_id = '" . (int)$languages_id . "'");
// jr - end - product additional fields				
$product_info = tep_db_fetch_array($product_info_query);

$prod_type = $product_info['prod_type'];

//echo '<br>HTTP_GET_VARS: ' . $HTTP_GET_VARS['products_id'];

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

// BOF Separate Price per Customer
$lowest_price = get_lowest_price($product_info['products_id'], $product_info['products_price']);
//	$product_info['products_price'] = $lowest_price;
  // EOF Separate Pricing Per Customer 

if (tep_get_products_special_price($product_info['products_id'])) {

 $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($lowest_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
	// EOF Separate Price per Customer
	$products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($lowest_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
}
else {

  $products_price = $currencies->display_price($lowest_price, tep_get_tax_rate($product_info['products_tax_class_id']));
}
$pf->loadProduct((int)$HTTP_GET_VARS['products_id'], (int)$languages_id, $select_product_add_fields);

// jr - add check for prod_type to existing if statement
//	if (tep_not_null($product_info['products_model']) && $product_info['prod_type'] == 'Product') {
if (tep_not_null($product_info['products_model'])) {
  $products_name = $product_info['products_name'] . '<br><span class="smallText">' . $product_info['products_model'] . '</span>';
} else {
  $products_name = $product_info['products_name'];
}
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading" valign="top"><?php echo $products_name; ?></td>
		<td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>

	<td class="main">
<? 
// jr - bof - display the product description in InfoBox format (helps when page has background pic)
if (DISPLAY_PAGE_CONTENT_IN_INFOBOX == "True") {
	echo '<table cellspacing="1" cellpadding="5" class="infoBox" width="100%">';
//		echo '<tr class="InfoBoxPageContent">';
	echo '<tr class="infoBoxContentsLarge">';
	echo '<td class="main">';
}
// jr - eof - display the product description in InfoBox format (helps when page has background pic)
?>

	<table border="0" cellspacing="0" cellpadding="2" align="right">
	  <tr>
		<td align="center" class="smallText">

<?php
	// jr - begin - if prod_type = product allow "click to enlarge" image
	//	$prod_query = tep_db_query("select prod_type from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_info['products_id'] . "'");
	// jr - begin - product additional fields
	$prod_query = tep_db_query("select prod_type from " . TABLE_PRODUCTS_ADD_FIELDS . " where products_id = '" . (int)$product_info['products_id'] . "'");
	$query = tep_db_fetch_array($prod_query);
	// jr - begin - product additional fields	
	//	if ($query['prod_type'] == 'Product') {	// dont enlarge image when not a product
	if (1 == 1) {  // jr - always allow "click to enlarge otherwise uncomment above line and comment this instead
	//jr - begin - orig code


// begin - quantity discount display
if ($product_info['products_price1_qty'] > 0) {
	echo '<table border="0" align="center" >';
//		echo '<tr><td align="center" class="pageHeading">' . TEXT_QUANTITY_DISCOUNT . '</td>';
	echo '</td></tr></table>';
	echo '<table border="1" cellpadding="1" cellspacing="0" align="center">';
//		echo '<tr class="infoBoxContentsLarge">';
	echo '<tr class="QuantityDiscountBox">';
	echo '<td class="tableHeading" align="center">  <b>' . TEXT_QUANTITY_DISCOUNT_QUANTITY . '</b>  </td>';
	echo '<td class="tableHeading" align="center">  <b>' . TEXT_QUANTITY_DISCOUNT_PRICE . '</b>  </td>';		
	echo '</tr>';
	for ($i=1; $i<=6; $i++) {
		if ($product_info['products_price' . $i . '_qty'] > 0) {
			$qty = $product_info['products_price' . $i . '_qty'];
			$on_click = 'onclick="java script:quantity_ordered(' . $qty . ')"';
//				echo '<tr class="moduleRowOver" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)"' . $on_click . '>';
			echo '<tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)"' . $on_click . '>';
			echo '<td class="main" align="center">' . $product_info['products_price' . $i . '_qty'] . '</td>';
			echo '<td class="main" align="center">' . number_format($product_info['products_price' . $i],2) . '</td>';		
			echo '</tr>';
		}
	}
	echo '</table>';
//		if ($product_info['products_qty_blocks'] == '1' && $product_info['products_price1_qty'] > 1) {
	if ($product_info['products_qty_blocks'] == '1') {
		echo TEXT_QUANTITY_BLOCKS . '<br>';
	}
//		echo '<a href="' . tep_href_link(FILENAME_CONTACT_OWNER, tep_get_all_get_params()) . '">' . '<u><font color="' . PAGE_HIGHLIGHT_TEXT_COLOR . '">' . TEXT_QUANTITY_INQUIRY . '</u></font></a>';		
	echo '<a class="orderEdit" href="' . tep_href_link(FILENAME_CONTACT_OWNER, tep_get_all_get_params()) . '">' . '<b>' .  TEXT_QUANTITY_INQUIRY . '</b></a>';		
//		echo TEXT_QUANTITY_INQUIRY;
	echo '<br><br><br>';
}				
// end - quantity discount display



$products_name = $product_info['products_name'];

$tmp_html = '';

//	if (1 == 2)
//	if ($products_image_name == 'no_photo.gif')
//		$tmp_html .= tep_image(DIR_WS_PRODUCT_IMAGES . $products_image_name, $products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, ' hspace="5" vspace="3" class="imageborder" ') . '<br>';


$products_image_name = $product_info['products_image'];
$products_image_name2 = $product_info['products_image2'];
$products_image_name3 = $product_info['products_image3'];
$products_image_name4 = $product_info['products_image4'];


// display the products image(s)
if (($products_image_name != 'no_photo.gif') &&
	 ($products_image_name  ||
	 $products_image_name2 ||
	 $products_image_name3 ||
	 $products_image_name4 ))
   {


	// jr - bof watermark image	
	$watermark_image = 0;
	if (WATERMARK_IMAGE == 'true') {
		if (file_exists(DIR_FS_STORE_OWNER_AREA . 'images/watermark.png'))
			$watermark_image = 1;
			$watermark_param = '&watermark=' . DIR_FS_STORE_OWNER_AREA . 'images/watermark.png&transparency=' . WATERMARK_TRANPARENCY;
	}
	// jr - eof watermark image	

	// build html string
	if ($products_image_name) {
		// jr - bof watermark image	
		if ($watermark_image)
			$on_click = 'onclick="java script:popupImageWatermark(' . "'/watermark_image.php?main=" . DIR_FS_CATALOG . DIR_WS_PRODUCT_IMAGES . $products_image_name . $watermark_param . "','" . $products_name . "')" . '"';
		else		
			$on_click = 'onclick="java script:popupImage(' . "'/" . DIR_WS_PRODUCT_IMAGES . $products_image_name . "','" . $products_name . "')" . '"';
		// jr - eof watermark image
		$on_mouseover = 'onMouseOver="java script:popupImage(' . "'/" . DIR_WS_PRODUCT_IMAGES . $products_image_name . "','" . $products_name . "')" . '"';
		$on_mouseout = 'onMouseOut="java script:imgWin.window.close()"';
		if (PRODUCT_IMAGE_ROLLOVER_DISPLAY == "True")
			$tmp_html .= tep_image(DIR_WS_PRODUCT_IMAGES . $products_image_name, $products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, ' hspace="5" vspace="3" class="imageborder" ' . $on_click.$on_mouseover.$on_mouseout) . '<br>';
		else {
			$tmp_html .= tep_image(DIR_WS_PRODUCT_IMAGES . $products_image_name, $products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, ' hspace="5" vspace="3" class="imageborder" '. $on_click) . '<br>';
		}
	}

	if ($products_image_name2) {
		// jr - bof watermark image
		if ($watermark_image)
			$on_click = 'onclick="java script:popupImageWatermark(' . "'/watermark_image.php?main=" . DIR_FS_CATALOG . DIR_WS_PRODUCT_IMAGES . $products_image_name2 . $watermark_param . "','" . $products_name . "')" . '"';
		else	
			$on_click = 'onclick="java script:popupImage(' . "'/" . DIR_WS_PRODUCT_IMAGES . $products_image_name2 . "','" . $products_name . "')" . '"';
		// jr - eof watermark image
		$on_mouseover = 'onMouseOver="java script:popupImage(' . "'/" . DIR_WS_PRODUCT_IMAGES . $products_image_name2 . "','" . $products_name . "')" . '"';
		$on_mouseout = 'onMouseOut="java script:imgWin.window.close()"';
		if (PRODUCT_IMAGE_ROLLOVER_DISPLAY == "True")
			$tmp_html .= tep_image(DIR_WS_PRODUCT_IMAGES . $products_image_name2, $products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, ' hspace="5" vspace="3" class="imageborder" ' . $on_click.$on_mouseover.$on_mouseout) . '<br>';
		else
			$tmp_html .= tep_image(DIR_WS_PRODUCT_IMAGES . $products_image_name2, $products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, ' hspace="5" vspace="3" class="imageborder" ' . $on_click) . '<br>';

	}

	if ($products_image_name3) {
		// jr - bof watermark image			
		if ($watermark_image)
			$on_click = 'onclick="java script:popupImageWatermark(' . "'/watermark_image.php?main=" . DIR_FS_CATALOG . DIR_WS_PRODUCT_IMAGES . $products_image_name3 . $watermark_param . "','" . $products_name . "')" . '"';
		else	
			$on_click = 'onclick="java script:popupImage(' . "'/" . DIR_WS_PRODUCT_IMAGES . $products_image_name3 . "','" . $products_name . "')" . '"';
		// jr - eof watermark image
		$on_mouseover = 'onMouseOver="java script:popupImage(' . "'/" . DIR_WS_PRODUCT_IMAGES . $products_image_name3 . "','" . $products_name . "')" . '"';
		$on_mouseout = 'onMouseOut="java script:imgWin.window.close()"';
		if (PRODUCT_IMAGE_ROLLOVER_DISPLAY == "True")
			$tmp_html .= tep_image(DIR_WS_PRODUCT_IMAGES . $products_image_name3, $products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, ' hspace="5" vspace="3" class="imageborder" ' . $on_click.$on_mouseover.$on_mouseout) . '<br>';			
		else
			$tmp_html .= tep_image(DIR_WS_PRODUCT_IMAGES . $products_image_name3, $products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, ' hspace="5" vspace="3" class="imageborder" ' . $on_click) . '<br>';			

	}


	if ($products_image_name4) {
		// jr - bof watermark image			
		if ($watermark_image)
			$on_click = 'onclick="java script:popupImageWatermark(' . "'/watermark_image.php?main=" . DIR_FS_CATALOG . DIR_WS_PRODUCT_IMAGES . $products_image_name4 . $watermark_param . "','" . $products_name . "')" . '"';
		else	
			$on_click = 'onclick="java script:popupImage(' . "'/" . DIR_WS_PRODUCT_IMAGES . $products_image_name4 . "','" . $products_name . "')" . '" ';
		// jr - eof watermark image
		$on_mouseover = 'onMouseOver="java script:popupImage(' . "'/" . DIR_WS_PRODUCT_IMAGES . $products_image_name4 . "','" . $products_name . "')" . '" ';
		$on_mouseout = 'onMouseOut="java script:imgWin.window.close()"';
		if (PRODUCT_IMAGE_ROLLOVER_DISPLAY == "True")
			$tmp_html .= tep_image(DIR_WS_PRODUCT_IMAGES . $products_image_name4, $products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, ' hspace="5" vspace="3" class="imageborder" ' . $on_click.$on_mouseover.$on_mouseout) . '<br>';
		else
			$tmp_html .= tep_image(DIR_WS_PRODUCT_IMAGES . $products_image_name4, $products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, ' hspace="5" vspace="3" class="imageborder" ' . $on_click) . '<br>';
	}


if ($products_image_name != 'no_photo.gif')
	$tmp_html .= TEXT_CLICK_TO_ENLARGE;

}


echo $tmp_html;





// jr - end - if prod_type != product do not display or allow "click to enlarge" image
?>
		  </td>
		</tr>
	  </table>
<?php
}
?>

<?php

// jr start - convert /nl, backslashes in description to appropriate chars to display correctly 
// check if the string contains HTML or regular text
// string contains HTML chars
if  ((stristr($product_info['products_description'], '</table>'))  ||
	 (stristr($product_info['products_description'], '</tr>'))	  ||
	 (stristr($product_info['products_description'], '</p>')) 	  ||
	 (stristr($product_info['products_description'], '<br>'))) 	  {
	 $product_info['products_description'] = $product_info['products_description'];
	 }
// string does not contain HTML chars
else {
	 $product_info['products_description'] = nl2br(stripslashes($product_info['products_description']));		
	 }
// jr end - convert /nl and backslashes to appropriate chars to display correctly
?>

	  <p><?php echo stripslashes($product_info['products_description']); ?></p>

<?php



// jr - bof - display the product description in InfoBox format (helps when page has background pic)
if (DISPLAY_PAGE_CONTENT_IN_INFOBOX == "True")
	echo '<table cellspacing="0" cellpadding="5" class="infoBox" width="0%">';





// iii 030813 added: initialize $number_of_uploads
$number_of_uploads = 0;
$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
$products_attributes = tep_db_fetch_array($products_attributes_query);
if ($products_attributes['total'] > 0) {
?>

	  <? //jr - added width ?>

	  <table border="0" cellspacing="0" cellpadding="2"  width="100%" align="left">
		<tr>
		  <? // jr - do not display product options heading ?>
		  <td class="main" colspan="1"><?php // echo TEXT_PRODUCT_OPTIONS; ?></td> 
		</tr>
<?php

		// option_type_feature_v1.7.zip begin to end of program
		//clr 030714 update query to pull option_type
  // jr -stort by atribute sort value
  $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_type, popt.products_options_length, popt.products_options_comment from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' group by patrib.attribute_sort order by patrib.attribute_sort");

  while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {

	  // jr - translate char which cause errors in url. Need after contrib 'optionsTypeFeatures CLR'
	$cart_key = $HTTP_GET_VARS['products_id'];
//		echo '<br>cartKey1=' . $cart_key;
//		$cart_key = href_unsafe($HTTP_GET_VARS['products_id']);
//		$cart_key = $HTTP_GET_VARS['products_id'];
//		echo '<br>cartKey1=' . $cart_key;
//		$cart_key = href_unsafe($HTTP_GET_VARS['products_id']);
//		echo '<br>cartKey2=' . $cart_key;

	//clr 030714 add case statement to check option type
	switch ($products_options_name['products_options_type']) {

	  case PRODUCTS_OPTIONS_TYPE_TEXT:
		//CLR 030714 Add logic for text option
		$products_attribs_query = tep_db_query("select distinct patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'");
		$products_attribs_array = tep_db_fetch_array($products_attribs_query);

		$products = $cart->get_products();
		for ($i=0, $n=sizeof($products); $i<$n; $i++) {
			// Push all attributes information in an array
		  if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
			while (list($option, $value) = each($products[$i]['attributes'])) {
			}}}


		$tmp_html = '<input type="text" name ="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']" size="' . $products_options_name['products_options_length'] .'" maxlength="' . $products_options_name['products_options_length'] . '" value="' . $cart->contents[$cart_key]['attributes_values'][$products_options_name['products_options_id']] .'">  '; 
		$tmp_html .= '<i> ' . $products_options_name['products_options_comment'] . '</i>';
		if ($products_attribs_array['options_values_price'] != 0) {
		  $tmp_html .= '<i> (' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .')</i>';
		}
?>
		<tr>
		  <td class="mainColorBold" width="1%"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
		  <td class="main"><?php echo $tmp_html;  ?></td>
		</tr>
<?php
		break;

	  case PRODUCTS_OPTIONS_TYPE_TEXTAREA:
		//CLR 030714 Add logic for text option
		$products_attribs_query = tep_db_query("select distinct patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'");
		$products_attribs_array = tep_db_fetch_array($products_attribs_query);

		// jr - begin preload field if data previously entered				
		if ($cart->contents[$cart_key]['attributes_values'][$products_options_name['products_options_id']]) {
			$s = $cart->contents[$cart_key]['attributes_values'][$products_options_name['products_options_id']]; }
		else {
			$s = ''; }
		// jr - end preload field if data previously entered				

		// jr - calc text area row height
		$rows = round($products_options_name['products_options_length'] / 75);
		if ($rows > 25) {
			$rows = 25; }

		$tmp_html = '<textarea onKeyDown="textCounter(this,\'progressbar' . $products_options_name['products_options_id'] . '\',' . $products_options_name['products_options_length'] . ')"
							   onKeyUp="textCounter(this,\'progressbar' . $products_options_name['products_options_id'] . '\',' . $products_options_name['products_options_length'] . ')"
							   onFocus="textCounter(this,\'progressbar' . $products_options_name['products_options_id'] . '\',' . $products_options_name['products_options_length'] . ')"
							   wrap="soft"
							   name="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']"
							   rows=" ' . $rows . '"
							   id="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']"
							   >' . $s . '</textarea>
							   <div id="progressbar' . $products_options_name['products_options_id'] . '" class="progress"></div>
							   <script>textCounter(document.getElementById("id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']"),"progressbar' . $products_options_name['products_options_id'] . '",' . $products_options_name['products_options_length'] . ')</script>';	
// <!-- DDB - 041031 - Form Field Progress Bar //-->

		$tmp_html2 = '';
		if ($products_options_name['products_options_comment']) {
			$tmp_html2 .= '<i>' . $products_options_name['products_options_comment'] . '</i> '; }
		if ($products_attribs_array['options_values_price'] != 0) {
			$tmp_html2 .= '<i>(' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . ')</i>'; }
		if ($tmp_html2) {
			$tmp_html2 .= '<br><br>'; }
?>
		<tr>

		  <td class="mainColorBold" valign="center"  width="1%">
		  <?php echo $products_options_name['products_options_name'] . ':'; ?>
		  </td>
		  <td class="main" width="100%"><?php echo $tmp_html . $tmp_html2;  ?></td>
		</tr>
<?php




		break;


	  case PRODUCTS_OPTIONS_TYPE_RADIO:
		//CLR 030714 Add logic for radio buttons
		// jr - add sort by attribute_sort to query
		$tmp_html = '<table>';
		$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "' order by pa.attribute_sort");
		$selected = false;
		// jr - begin if previous selected, load selected
   		if (isset($cart->contents[$cart_key]['attributes'][$products_options_name['products_options_id']])) {
			$selected = $cart->contents[$cart_key]['attributes'][$products_options_name['products_options_id']];
		}
		// jr - end if previous selected, load selected
		while ($products_options_array = tep_db_fetch_array($products_options_query)) {
		  // jr - buttons on single line
		  $tmp_html .= '<td class="main">';
		  // jr -buttons on seperate lines
//			  $tmp_html .= '<tr><td class="main" width="1%">';
			  // jr - begin if previous selected, load selected
		  if ($products_options_array['products_options_values_id'] == $selected) {
			  $checked = true; }
		  else {
			  $checked = false;
		  }
		  // jr - end if previous selected, load selected
		  $tmp_html .= tep_draw_radio_field('id[' . $products_options_name['products_options_id'] . ']', $products_options_array['products_options_values_id'], $checked);
		  $tmp_html .= $products_options_array['products_options_values_name'];
//			  $tmp_html .= ' <i>' . $products_options_name['products_options_comment'] . '</i>';
		  if ($products_options_array['options_values_price'] != 0) {
			$tmp_html .= ' <i>(' . $products_options_array['price_prefix'] . $currencies->display_price($products_options_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .')</i>';
		  }
		  // jr - buttons on single line
		  $tmp_html .= '</td>';
			// jr -buttons on seperate lines
		  //  $tmp_html .= '</tr></td>';
		}
		$tmp_html .= '</table>';
?>
		<tr>
<?			  // jr - buttons on single remove <td valign"top"> or insert for seperate lines ?>
		  <td class="mainColorBold" ><?php echo $products_options_name['products_options_name'] . ':'; ?></td>

		  <td class="main"><?php echo $tmp_html;  ?></td>
		</tr>
<?php
		break;

	  case PRODUCTS_OPTIONS_TYPE_CHECKBOX:
		//CLR 030714 Add logic for checkboxes
		// jr - add sort by attribute_sort to query			
		$products_attribs_query = tep_db_query("select distinct pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "' order by pa.attribute_sort");
//			$products_attribs_query = tep_db_query("select distinct patrib.options_values_id, patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "' order by pa.attribute_sort");
		$products_attribs_array = tep_db_fetch_array($products_attribs_query);

		echo '<tr><td class="mainColorBold" width="1%" >' . $products_options_name['products_options_name'] . ': </td><td class="main">';

		// jr - begin if previous selected, load selected
   		if (isset($cart->contents[$cart_key]['attributes'][$products_options_name['products_options_id']])) {
			$checked = true; }
		else {
			$checked = false; }

		echo tep_draw_checkbox_field('id[' . $products_options_name['products_options_id'] . ']', $products_attribs_array['options_values_id'], $checked);
		// jr - end if previous selected, load selected			
		echo ' <i>' . $products_options_name['products_options_comment'] . '</i>';
		if ($products_attribs_array['options_values_price'] != 0) {
		  echo ' <i>(' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .')</i>';
		}
		echo '</td></tr>';
		break;


// iii 030813 added: support for file fields
	  case PRODUCTS_OPTIONS_TYPE_FILE:
		$number_of_uploads++;
		$products_attribs_query = tep_db_query("select distinct patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'");

		$products_attribs_array = tep_db_fetch_array($products_attribs_query);

		$products = $cart->get_products();
		for ($i=0, $n=sizeof($products); $i<$n; $i++) {
		  // Push all attributes information in an array
		  if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
			while (list($option, $value) = each($products[$i]['attributes'])) {
			}}}


		$tmp_html = '<input type="file" name=id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . '] size="' . $products_options_name['products_options_length'] . '">  ';
		$tmp_html .= tep_draw_hidden_field(UPLOAD_PREFIX . $number_of_uploads, $products_options_name['products_options_id']) . tep_draw_hidden_field(TEXT_PREFIX . UPLOAD_PREFIX . $number_of_uploads, $cart->contents[$cart_key]['attributes_values'][$products_options_name['products_options_id']]);
//			$tmp_html .= tep_draw_hidden_field(UPLOAD_PREFIX . $number_of_uploads, $products_options_name['products_options_id']);
//			$tmp_html .= tep_draw_hidden_field(TEXT_PREFIX . UPLOAD_PREFIX . $number_of_uploads, $cart->contents[$cart_key]['attributes_values'][$products_options_name['products_options_id']]);

		$tmp_html .= '<i> ' . $products_options_name['products_options_comment'] . '  (Types: ' . FILE_UPLOAD_TYPES . '  MaxSize: ' . FILE_UPLOAD_MAX_SIZE . ' bytes)</i>';
		if ($products_attribs_array['options_values_price'] != 0) {
		  $tmp_html .= '<i> (' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .')</i>';
		}

		// jr - if previous filename inputed then display it
		$current_filename_path  = $cart->contents[$cart_key]['attributes_values'][$products_options_name['products_options_id']];
		$current_filename = $current_filename_path;

		// jr - strip off the internal filename number which it is stored on disk as
		if ($current_filename) {
			$found = strpos($current_filename, ' ');
		  if ($found) {
				$current_filename = substr($current_filename, $found);
		  }
		  // jr start - build link for uploaded filename for clivk to view link
		  // jr - get filename number
		  $v = $current_filename_path;
		  $found = strpos($v, '.');
		  if ($found) {
			 $filename_num = substr($v, 0, $found);
			}	
		  // jr - get filename extension
		  $found = strrpos($v, '.');
		  if ($found) {
			 $file_extension = substr($v, $found);
			}			  
		  clearstatcache();
		  $ws_uploaded_file = DIR_WS_UPLOADS . $filename_num .  $file_extension;
		  $fs_uploaded_file = DIR_FS_UPLOADS . $filename_num .  $file_extension;
			$on_click = '"java script:popupImage(' . "'/" . $ws_uploaded_file . "','" . $current_filename . "')" . '"';
		  $tmp_html .= "<br>" . "<a href=" . $on_click. "><font color='#0000FF'><u>" . $current_filename . "</font></u></a>" . "  -  <i>" . CURRENT_UPLOAD . "</i>";
		}
?>
		<tr>
		  <td class="mainColorBold" width="1%"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
		  <td class="main"><?php echo $tmp_html;  ?></td>
		</tr>
<?php
		break;




	  default:
		//clr 030714 default is select list
		//clr 030714 reset selected_attribute variable
		$selected_attribute = false;
   		$products_options_array = array();
	  //jr - clr - order attrubute drop-down menu entries by attribute sort value
 	  $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' order by pa.attribute_sort");
			while ($products_options = tep_db_fetch_array($products_options_query)) {
				  $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
			  if ($products_options['options_values_price'] != 0) {
				$products_options_array[sizeof($products_options_array)-1]['text'] .= '  (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
				  }
			}

			if (isset($cart->contents[$cart_key]['attributes'][$products_options_name['products_options_id']])) {
				  $selected_attribute = $cart->contents[$cart_key]['attributes'][$products_options_name['products_options_id']];
			} else {
				  $selected_attribute = false;
			}
?>
		<tr>
		  <td class="mainColorBold" width="1%"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
		  <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute) . "<i> " . $products_options_name['products_options_comment'];  ?></i></td>

		</tr>
<?php
	}  //clr 030714 end switch
  } //clr 030714 end while

?>
	  </table>

<?php
} //clr 030714 end if
?>
	</td>
  </tr>


<? 


// jr - bof - display the product description in InfoBox format (helps when page has background pic)
if (DISPLAY_PAGE_CONTENT_IN_INFOBOX == "True")
	$s = '<tr class="infoBoxContentsLarge"><td>';
else 
	$s = '<tr class="main"><td>';
echo $s . tep_draw_separator('pixel_trans.gif', '10%', '10') . '</td></tr>';


$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where approved = 1 and products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
$reviews = tep_db_fetch_array($reviews_query);


//jr - start - always display reviews count
// orig	if ($reviews['count'] > 0) {
if ($reviews['count'] > -1) {

	// jr - bof - display the product description in InfoBox format (helps when page has background pic)
	if (DISPLAY_PAGE_CONTENT_IN_INFOBOX == "True")
		$s = '<tr class="infoBoxContentsLarge"><td>';
	else
		$s = '<tr class="main"><td>';		
	echo $s . TEXT_CURRENT_REVIEWS . ' ' . $reviews['count'] . '</td></tr>';

	// jr - bof - display the product description in InfoBox format (helps when page has background pic)
	if (DISPLAY_PAGE_CONTENT_IN_INFOBOX == "True")
		$s = '<tr class="infoBoxContentsLarge"><td>';
	else
		$s = '<tr class="main"><td>';		
	echo $s . tep_draw_separator('pixel_trans.gif', '10%', '10') . '</td></tr>';

}  // if ($reviews['count'] > -1) {


if (tep_not_null($product_info['products_url'])) {

	// jr - bof - display the product description in InfoBox format (helps when page has background pic)
	if (DISPLAY_PAGE_CONTENT_IN_INFOBOX == "True")
		$s = '<tr class="infoBoxContentsLarge"><td>';
	else
		$s = '<tr class="main"><td>';		
	echo $s . sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)) . '</td></tr>';

	// jr - bof - display the product description in InfoBox format (helps when page has background pic)
	if (DISPLAY_PAGE_CONTENT_IN_INFOBOX == "True")
		$s = '<tr class="infoBoxContentsLarge"><td>';
	else
		$s = '<tr class="main"><td>';
	echo $s . sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)) . '</td></tr>';

	// jr - bof - display the product description in InfoBox format (helps when page has background pic)
	if (DISPLAY_PAGE_CONTENT_IN_INFOBOX == "True")
		$s = '<tr class="infoBoxContentsLarge"><td>';
	else
		$s = '<tr class="main"><td>';
	echo $s . tep_draw_separator('pixel_trans.gif', '10%', '10') . '</td></tr>'; 

}  //  if (tep_not_null($product_info['products_url'])) {


$s = '';
if ($prod_type == 'Product' && STOCK_CHECK == 'true' && $product_info['products_quantity'] <= 0) {
	// jr - bof - display the product description in InfoBox format (helps when page has background pic)
	if (DISPLAY_PAGE_CONTENT_IN_INFOBOX == "True")
		$s = '<tr class="infoBoxContentsLarge"><td align="left" class="markProductOutOfStock">';
	else
		$s = '<tr class="main"><td align="left" class="markProductOutOfStock">';		
	echo $s . TEXT_OUT_OF_STOCK . '</td></tr>';

	if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
		// jr - bof - display the product description in InfoBox format (helps when page has background pic)
		if (DISPLAY_PAGE_CONTENT_IN_INFOBOX == "True")
			$s = '<tr class="infoBoxContentsLarge"><td align="left" class="stockWarning">';
		else
			$s = '<tr class="main"><td align="left" class="stockWarning">';
		echo $s . sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])) . '</td></tr>';
	} 
}




// jr - bof - display the product description in InfoBox format (helps when page has background pic)
if (DISPLAY_PAGE_CONTENT_IN_INFOBOX == "True")
	$s = '<tr class="infoBoxContentsLarge"><td align="left" class="smallText">';
else
	$s = '<tr class="main"><td align="left" class="smallText">';		
//echo $s . sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])) . '</td></tr>';;





// jr - bof - display the product description in InfoBox format (helps when page has background pic)
if (DISPLAY_PAGE_CONTENT_IN_INFOBOX == "True")
	echo "</table></table>";
// jr - eof - display the product description in InfoBox format (helps when page has background pic)

?>


  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '10%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td>
<?php 
// jr - if product type != product then display Contact Owner button intead of Buy button
			if ($prod_type == 'Product') {
				$align = 'center'; }


// jr bof - remove inquiry button if product_type not a product - for saltwater.com to limit emails.

			else { $align = 'right'; }
?>
<?

			// jr bof - added next line so no inquiry button non-product types. Comment out line to allow iniquiries when product_type='Info'
			if ($prod_type == 'Product') {
?>
				<td class="main" align="<? echo $align; ?>"><?php echo '<a href="' . tep_href_link(FILENAME_CONTACT_OWNER, tep_get_all_get_params()) . '">' . tep_image_button('button_inquiry.gif', IMAGE_BUTTON_CONTACT) . '</a>'; ?></td>

<?
}
// jr eof - remove inquiry button if product_type not a product - for saltwater.com to limit emails.




// jr - start - quantity discount
//				  <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); </td>
?>

<?
// jr add notifdy me button for out-of-stock products


		if ($prod_type == 'Product') {
			if (tep_get_products_stock($product_info['products_id']) <= 0) {
				// display notify button
?>
				<td class="main" align="right"><?php echo '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=notify&products_id=' . $product_info['products_id']) . '">' . tep_image_button('button_email_notify_me.gif', 'Notify me via email when in stock') . '</a>'; ?></td>
<?
			}
			elseif ($product_info['products_price1_qty'] > 0) {
?>
			<td class="main" align="right">
			  <table border="0" align="right" >
				<tr><td align="center" class="infoBoxContentsLarge" style="border-style: solid; border-width: 1px">
				  <?php echo '<b>' . TEXT_ENTER_QUANTITY . ": </b>" . tep_draw_input_field('cart_quantity', $pf->adjustQty(1), 'size="6"'); ?>
				</td></tr>
				<tr><td align="center">
				  <?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?>
				</td></tr>
		 	 </table>
			</td>
<?
			}

			else {
?>
   				<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>
<?			
			}
		}  // if ($prod_type == 'Product') {
?>
<? // jr - end - quantity discount ?>



			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '10%', '10'); ?></td>
  </tr>
  <tr>
	<td>
<?php
if ($product_info['prod_type'] == 'Product' ) {
	if ((USE_CACHE == 'true') && empty($SID)) {
	  echo tep_cache_also_purchased(3600);
	} 
	else {
	  echo '<br>';
	  include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
	}
}
 }
// iii 030813 added: File Uploading: hidden field carrying number of upload info to next file
?>
	</td>
  </tr>
  <tr>
	<td><?php echo tep_draw_hidden_field('number_of_uploads', $number_of_uploads); ?></td>
  </tr>
</table></form></td>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
 </tr>
</table>
<!-- body_eof //-->

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

Link to comment
Share on other sites

We need to find the file that contains this code

 

select pd.products_name, p.products_model, p.products_image, p.products_id, p.manufacturers_id, p.products_price, p.products_weight, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price,paf.products_image2, paf.products_image3, paf.products_image4, paf.prod_type, paf.customers_id, paf.direct_contact, paf.products_qty_blocks, paf.products_price1, paf.products_price2, paf.products_price3, paf.products_price4, paf.products_price5, paf.products_price6, paf.products_price1_qty, paf.products_price2_qty, paf.products_price3_qty, paf.products_price4_qty, paf.products_price5_qty, paf.products_price6_qty, paf.products_id_source, paf.products_source_price, paf.products_source_price_multiplier, paf.products_notification_code from products_add_fields paf, products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = '62' and p.products_id = paf.products_id and pd.products_id = '62' and pd.language_id = '1'

 

I thought it may be product_info.php, but its not. Do you perhaps have a featured.php normally in catalog\includes\modules\

Link to comment
Share on other sites

We need to find the file that contains this code

 

select pd.products_name, p.products_model, p.products_image, p.products_id, p.manufacturers_id, p.products_price, p.products_weight, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price,paf.products_image2, paf.products_image3, paf.products_image4, paf.prod_type, paf.customers_id, paf.direct_contact, paf.products_qty_blocks, paf.products_price1, paf.products_price2, paf.products_price3, paf.products_price4, paf.products_price5, paf.products_price6, paf.products_price1_qty, paf.products_price2_qty, paf.products_price3_qty, paf.products_price4_qty, paf.products_price5_qty, paf.products_price6_qty, paf.products_id_source, paf.products_source_price, paf.products_source_price_multiplier, paf.products_notification_code from products_add_fields paf, products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = '62' and p.products_id = paf.products_id and pd.products_id = '62' and pd.language_id = '1'

 

I thought it may be product_info.php, but its not. Do you perhaps have a featured.php normally in catalog\includes\modules\

 

Actually looking at the code it must be another modification that is causing the error. If you can find the file post it here.

Link to comment
Share on other sites

We need to find the file that contains this code

 

select pd.products_name, p.products_model, p.products_image, p.products_id, p.manufacturers_id, p.products_price, p.products_weight, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price,paf.products_image2, paf.products_image3, paf.products_image4, paf.prod_type, paf.customers_id, paf.direct_contact, paf.products_qty_blocks, paf.products_price1, paf.products_price2, paf.products_price3, paf.products_price4, paf.products_price5, paf.products_price6, paf.products_price1_qty, paf.products_price2_qty, paf.products_price3_qty, paf.products_price4_qty, paf.products_price5_qty, paf.products_price6_qty, paf.products_id_source, paf.products_source_price, paf.products_source_price_multiplier, paf.products_notification_code from products_add_fields paf, products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = '62' and p.products_id = paf.products_id and pd.products_id = '62' and pd.language_id = '1'

 

I thought it may be product_info.php, but its not. Do you perhaps have a featured.php normally in catalog\includes\modules\

 

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

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License

 Featured Products V1.1
 Displays a list of featured products, selected from admin
 For use as an Infobox instead of the "New Products" Infobox  
*/
?>
<!-- featured_products //-->
<?php

// get all featured proucts

// get featured products in current and below cats
// jr - start - get all subcategories products
$subcategories_array = array();
tep_get_subcategories($subcategories_array, $new_products_category_id);

if ($new_products_category_id) {
	$products_category_id_list = $new_products_category_id;
}
else {
	$products_category_id_list = '0';
}
for ($i=0, $n=sizeof($subcategories_array); $i<$n; $i++ ) {
	$products_category_id_list .= ',' . $subcategories_array[$i];
}

// BOF Separate Pricing per Customer
global $sppc_customer_group_id;
if(!tep_session_is_registered('sppc_customer_group_id')) {
	$customer_group_id = '0'; }
else { $customer_group_id = $sppc_customer_group_id; }
// BOF Separate Pricing per Customer	


 // BOF Separate Pricing per Customer
 // jr bof - category disable
$featured_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, p.products_price as products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_FEATURED . " f, " . TABLE_CATEGORIES . " c where categories_status = '1' and p.products_id = f.products_id and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id  in (" . $products_category_id_list . ") and  p.products_status = '1' order by rand() desc limit ". MAX_DISPLAY_FEATURED);
//	$featured_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, p.products_price as products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_FEATURED . " f, " . TABLE_CATEGORIES . " c where p.products_id = f.products_id and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id  in (" . $products_category_id_list . ") and  p.products_status = '1' order by rand() desc limit ". MAX_DISPLAY_FEATURED);
 // jr eof - category disable
 $row = 0;
 $col = 0; 
 $num = 0;

 // calc exact column width to support number of columns defined in admin area
 $col_width = round(100/LARGEINFOBOX_COLUMNS);

 $info_box_contents = array();

 while ($products = tep_db_fetch_array($featured_products_query)) {
$num ++; 

$products['products_name'] = tep_get_products_name($products['products_id']);

$lowest_price = get_lowest_price($products['products_id'], $products['products_price']);

if(tep_get_products_special_price($products['products_id'])) {
  $info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'class="smallText" width="' . $col_width . '%"valign="top"',
									   'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . tep_image(DIR_WS_PRODUCT_IMAGES . $products['products_image'], $products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=imageborder') . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . $products['products_name'] . '</a><br><s>' . $currencies->display_price($products['products_price'], tep_get_tax_rate($products['products_tax_class_id'])) . '</s>  <span class="productSpecialPriceInfoBox">' . $currencies->display_price($lowest_price, tep_get_tax_rate($products['products_tax_class_id'])) . '</span>');
 } // end if

  else {
  $info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'class="smallText" width="' . $col_width . '%"valign="top"',
									   'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . tep_image(DIR_WS_PRODUCT_IMAGES . $products['products_image'], $products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=imageborder') . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . $products['products_name'] . '</a><br>' . $currencies->display_price($lowest_price, tep_get_tax_rate($products['products_tax_class_id'])));
}	

$col ++;
if ($col > LARGEINFOBOX_COLUMNS-1) {  // display this many columns which defined in admin section
	$col = 0;
	  $row ++;
	}
 } // end while

// display the results
 $displayed_box = 0;	
 if($num) {
  $displayed_box = 1;

  $info_box_contents_heading[] = array('align' => 'left', 'text' => '<a class="headerNavigation" href="' . tep_href_link(FILENAME_FEATURED_PRODUCTS, 'categories_id=' . $new_products_category_id) . '">' . TABLE_HEADING_FEATURED_PRODUCTS . '</a>');
  new contentBoxHeading($info_box_contents_heading);
  new contentBox($info_box_contents);
 }


?>
<!-- featured_products_eof //-->

Link to comment
Share on other sites

Actually looking at the code it must be another modification that is causing the error. If you can find the file post it here.

 

 

I've looked through so many files and have used the "Find" feature to look for parts of the code, but nothing. Anyone have any ideas as to what files this might be in? There is just sooo many files to look through. It could be a full time job doing that. :blink: Any more help would be very appreciated. Thanks.

Link to comment
Share on other sites

I've looked through so many files and have used the "Find" feature to look for parts of the code, but nothing. Anyone have any ideas as to what files this might be in? There is just sooo many files to look through. It could be a full time job doing that. :blink: Any more help would be very appreciated. Thanks.

 

More info on how to fix a 1054 error is here

 

How to fix 1054 error

http://addons.oscommerce.com/info/4654

 

Look at the error output and try to figure out which modification of yours it may be that is causing the error. Then search in those files. I suggest looking in includes\modules\

Link to comment
Share on other sites

More info on how to fix a 1054 error is here

 

How to fix 1054 error

http://addons.oscommerce.com/info/4654

 

Look at the error output and try to figure out which modification of yours it may be that is causing the error. Then search in those files. I suggest looking in includes\modules\

 

I'll do that and let you know what I find. Thanks.

Link to comment
Share on other sites

includes/classes/PriceFormatter.php ?

 

 

Jan, YES that is the one. Here it is. Now that I have it though, what should I do?

 

<?php
/*
 $Id: PriceFormatter.php,v 1.6 2003/06/25 08:29:26 petri Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2003 osCommerce

 Released under the GNU General Public License
*/

/*
   PriceFormatter.php - module to support quantity pricing

   Created 2003, Beezle Software based on some code mods by WasaLab Oy (Thanks!)
*/

class PriceFormatter {
 var $hiPrice;
 var $lowPrice;
 var $quantity;
 var $hasQuantityPrice;

 function PriceFormatter($prices=NULL) {
   $this->productsID = -1;

   $this->hasQuantityPrice=false;
   $this->hasSpecialPrice=false;

   $this->hiPrice=-1;
   $this->lowPrice=-1;

   for ($i=1; $i<=6; $i++){
     $this->quantity[$i] = -1;
     $this->prices[$i] = -1;
   }
   $this->thePrice = -1;
   $this->specialPrice = -1;
   $this->qtyBlocks = 1;

   if($prices) {
     $this->parse($prices);
}
 }

 function encode() {
$str = $this->productsID . ":"
       . (($this->hasQuantityPrice == true) ? "1" : "0") . ":"
       . (($this->hasSpecialPrice == true) ? "1" : "0") . ":"
       . $this->quantity[1] . ":"
       . $this->quantity[2] . ":"
       . $this->quantity[3] . ":"
       . $this->quantity[4] . ":"
	   . $this->quantity[5] . ":"
	   . $this->quantity[6] . ":"
       . $this->price[1] . ":"
       . $this->price[2] . ":"
       . $this->price[3] . ":"
       . $this->price[4] . ":"
	   . $this->price[5] . ":"
	   . $this->price[6] . ":"
       . $this->thePrice . ":"
       . $this->specialPrice . ":"
       . $this->qtyBlocks . ":"
       . $this->taxClass . ':'
	   . $this->lowestPrice;
return $str;
 }

 function decode($str) {
list($this->productsID,
     $this->hasQuantityPrice,
     $this->hasSpecialPrice,
     $this->quantity[1],
     $this->quantity[2],
     $this->quantity[3],
     $this->quantity[4],
     $this->quantity[5],
     $this->quantity[6],
     $this->price[1],
     $this->price[2],
     $this->price[3],
     $this->price[4],
     $this->price[5],
     $this->price[6],
     $this->thePrice,
     $this->specialPrice,
     $this->qtyBlocks,
     $this->taxClass) = explode(":", $str);

$this->hasQuantityPrice = (($this->hasQuantityPrice == 1) ? true : false);
$this->hasSpecialPrice = (($this->hasSpecialPrice == 1) ? true : false);

 }

 function parse($prices) {
   $this->productsID = $prices['products_id'];
   $this->hasQuantityPrice=false;
   $this->hasSpecialPrice=false;

   $this->quantity[1]=$prices['products_price1_qty'];
   $this->quantity[2]=$prices['products_price2_qty'];
   $this->quantity[3]=$prices['products_price3_qty'];
   $this->quantity[4]=$prices['products_price4_qty'];
   $this->quantity[5]=$prices['products_price5_qty'];
   $this->quantity[6]=$prices['products_price6_qty'];

   $this->thePrice=$prices['products_price'];
   $this->specialPrice=tep_get_products_special_price($prices['products_id']);
   $this->hasSpecialPrice=tep_not_null($this->specialPrice);

$this->price[1]=$prices['products_price1'];
   $this->price[2]=$prices['products_price2'];
   $this->price[3]=$prices['products_price3'];
   $this->price[4]=$prices['products_price4'];
$this->price[5]=$prices['products_price5'];
$this->price[6]=$prices['products_price6'];

// jr added to support Quantity Priceing and Group Pricing
$this->lowestPrice = get_lowest_price($prices['products_id'], $prices['products_price']);

    /*
      Change support special prices
   If any price level has a price greater than the special
   price lower it to the special price
*/
if ($this->hasSpecialPrice == true) {
	for($i=1; $i<=6; $i++) {
		if ($this->price[$i] > $this->specialPrice)
			$this->price[$i] = $this->specialPrice;
	}
}
//end changes to support special prices

// BOF Separate Pricing per Customer
// global variable (session) $sppc_customer_group_id -> local variable customer_group_id	
//	global $sppc_customer_group_id;

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

// 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') {
//		$customer_group_price_query = tep_db_query("select customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where products_id = '" . $prices['products_id'] ."' and customers_group_id = '".$customer_group_id."'");
//		if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {
//			if ($this->thePrice > $customer_group_price['price']) {
//				$this->thePrice = $customer_group_price['price'];
//			}
//		}	
//	}
// BOF Separate Pricing per Customer


   $this->qtyBlocks=$prices['products_qty_blocks'];

   $this->taxClass=$prices['products_tax_class_id'];

   if ($this->quantity[1] > 0) {
     $this->hasQuantityPrice = true;
     $this->hiPrice = $this->thePrice;
     $this->lowPrice = $this->thePrice;

     for($i=1; $i<=6; $i++) {
	if($this->quantity[$i] > 0) {
	  if ($this->price[$i] > $this->hiPrice) {
    	$this->hiPrice = $this->price[$i];
	  }
	  if ($this->price[$i] < $this->lowPrice) {
    	$this->lowPrice = $this->price[$i];
	  }
    }
     } // end for
   }
 }

 function loadProduct($product_id, $language_id=1)
 {
// jr - begin - product additional fields.
global $select_product_add_fields;
// jr - end - product additional fields.

// jr - begin - product additional fields - include fields if it exists
if (!isset($select_product_add_fields)) {
	if (file_exists(DIR_WS_ADDITIONAL_FIELDS . '_product_add_fields_variables_always.php')) {
		include(DIR_WS_ADDITIONAL_FIELDS . '_product_add_fields_variables_always.php'); }
	else {	$select_product_add_fields = " from "; }
}
// jr - end - product additional fields - include fields if it exists	

   $sql="select pd.products_name, p.products_model, p.products_image, p.products_id," .
       " p.manufacturers_id, p.products_price, p.products_weight," .
       " p.products_tax_class_id," .
       " IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price," .
       " IF(s.status, s.specials_new_products_price, p.products_price) as final_price," . $select_product_add_fields .
       TABLE_PRODUCTS_DESCRIPTION . " pd," .
       "      " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id," .
       "      " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id" .
       " where p.products_status = '1'" .
       "   and p.products_id = '" . (int)$product_id . "'" .
	// jr - start - product additional fields
	"   and p.products_id = paf.products_id  " . 
	// jr - end - product additional fields
       "   and pd.products_id = '" . (int)$product_id . "'" .
       "   and pd.language_id = '". (int)$language_id ."'";

   $product_info_query = tep_db_query($sql);
   $product_info = tep_db_fetch_array($product_info_query);
   $this->parse($product_info);

   return $product_info;
 }

 function computePrice($qty)
 {
$qty = $this->adjustQty($qty);

// Compute base price, taking into account the possibility of a special
$price = ($this->hasSpecialPrice === TRUE) ? $this->specialPrice : $this->thePrice;

for ($i=1; $i<=6; $i++)
	if (($this->quantity[$i] > 0) && ($qty >= $this->quantity[$i]))
		$price = $this->price[$i];

// jr added to support Quantity Priceing and Group Pricing
if ($price > $this->lowestPrice)
	$price = $this->lowestPrice; 

return $price;
 }

 function adjustQty($qty) {
// Force QTY_BLOCKS granularity
$qb = $this->getQtyBlocks();

if ($qty < 1)
	$qty = 1;

// jr - start - mod
if ($qb == 1) {
	for ($i=1; $i<=6; $i++) {
		if ($qty <= $this->quantity[$i]) {
			$qty = $this->quantity[$i];
			$i = 7;
		}
	}
}
// jr - end - mod

return $qty;
 }

 function getQtyBlocks() {
   return $this->qtyBlocks;
 }

 function getPrice() {
   return $this->thePrice;
 }

 function getLowPrice() {
   return $this->lowPrice;
 }

 function getHiPrice() {
   return $this->hiPrice;
 }

 function hasSpecialPrice() {
   return $this->hasSpecialPrice;
 }

 function hasQuantityPrice() {
   return $this->hasQuantityPrice;
 }

 function getPriceString($style='productPriceInBox') {
   global $currencies;

   if ($this->hasSpecialPrice == true) {
   	$lc_text = '<table align="top" border="1" cellspacing="0" cellpadding="0">';
       $lc_text .= '<tr><td align="center" class=' . $style. ' colspan="2">';
      $lc_text .= ' <s>'
	. $currencies->display_price($this->thePrice,
			     tep_get_tax_rate($this->taxClass))
	. '</s>  <span class="productSpecialPrice">'
	. $currencies->display_price($this->specialPrice,
			     tep_get_tax_rate($this->taxClass))
	. '</span> '
	.'</td></tr>';
   }
   else
   {
	$lc_text = '<table align="top" border="1" cellspacing="0" cellpadding="0">';
	$lc_text .= '<tr><td align="center" class=' . $style. ' colspan="2">'
	. $currencies->display_price($this->thePrice,
	tep_get_tax_rate($this->taxClass))
	. '</td></tr>';
   }
     // If you want to change the format of the price/quantity table
     // displayed on the product information page, here is where you do it.

   if($this->hasQuantityPrice == true) {
	for($i=1; $i<=6; $i++) {
		if($this->quantity[$i] > 0) {
			$lc_text .= '<tr><td class='.$style.'>'
			. $this->quantity[$i]
			.'+ </td><td class='.$style.'>'
			. $currencies->display_price($this->price[$i],
			tep_get_tax_rate($this->taxClass))
			.'</td></tr>';
		}
	}

	$lc_text .= '</table>';

     }
     else {
	if ($this->hasSpecialPrice == true) {
		$lc_text = ' <s>'
		  . $currencies->display_price($this->thePrice, tep_get_tax_rate($this->taxClass))
		  . '</s>  <span class="productSpecialPrice">'
		  . $currencies->display_price($this->specialPrice, tep_get_tax_rate($this->taxClass))
		  . '</span> ';
	}
	else {
		$lc_text = ' '
  		. $currencies->display_price($this->thePrice,
			       tep_get_tax_rate($this->taxClass))
  		. ' ';
	}
     	}

   return $lc_text;
 }

 function getPriceStringShort() {
   global $currencies;


$lc_text = '';
   if ($this->hasSpecialPrice == true) {
  	  $lc_text = ' <s>'
  			 . $currencies->display_price($this->thePrice, tep_get_tax_rate($this->taxClass))
			 . '</s>  <span class="productSpecialPrice">'
//			 	 . $currencies->display_price($this->specialPrice, tep_get_tax_rate($this->taxClass))
		 	 . $currencies->display_price($this->lowestPrice, tep_get_tax_rate($this->taxClass))
	 	     . '</span> ';
}
if (!tep_not_null($lc_text)) {
  if($this->hasQuantityPrice == true) {
		$lc_text = ' '
				   . $currencies->display_price($this->lowPrice, tep_get_tax_rate($this->taxClass))
				   . ' - '
			 	   . $currencies->display_price($this->hiPrice, tep_get_tax_rate($this->taxClass))
				   . ' ';
     }

}
if (!tep_not_null($lc_text)) {
	$lc_text = ' '
 			   . $currencies->display_price($this->lowestPrice, tep_get_tax_rate($this->taxClass))
		 	   . ' ';
   }
   return $lc_text;
 }
}

?>

Link to comment
Share on other sites

Hi,

 

I'm having a problem and have please can anyone help me, I have been searching for ages to fix this but without any success. Below is my error, please can someone tell me what it means. I only get this when I click a category that has sub categories.

 

My error is below:

 

1054 - Unknown column 'p.manufacturers_id' in 'on clause'

 

select distinct p.products_id, p.products_image, p.products_model, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price, mnf.manufacturers_name, rvw.reviews_rating from (products p) left join specials s on p.products_id = s.products_id, products_to_categories p2c, categories c left join manufacturers mnf on p.manufacturers_id = mnf.manufacturers_id left join reviews rvw on p.products_id = rvw.products_id where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '42' and p.products_status = '1' order by p.products_date_added desc limit 2

 

[TEP STOP]

 

I can still see the categories and they are clickable and it all works as normal however the box below which usually has new products for that month for example "New products for november" has the error code in it.

 

I hope someone can help me!

Link to comment
Share on other sites

Hi,

 

I'm having a problem and have please can anyone help me, I have been searching for ages to fix this but without any success. Below is my error, please can someone tell me what it means. I only get this when I click a category that has sub categories.

 

My error is below:

 

1054 - Unknown column 'p.manufacturers_id' in 'on clause'

 

select distinct p.products_id, p.products_image, p.products_model, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price, mnf.manufacturers_name, rvw.reviews_rating from (products p) left join specials s on p.products_id = s.products_id, products_to_categories p2c, categories c left join manufacturers mnf on p.manufacturers_id = mnf.manufacturers_id left join reviews rvw on p.products_id = rvw.products_id where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '42' and p.products_status = '1' order by p.products_date_added desc limit 2

 

[TEP STOP]

 

I can still see the categories and they are clickable and it all works as normal however the box below which usually has new products for that month for example "New products for november" has the error code in it.

 

I hope someone can help me!

 

I've noticed that out of the 3 posts you've posted, all 3 have been hijacks. Why not open your own thread asking for help?

Link to comment
Share on other sites

I've noticed that out of the 3 posts you've posted, all 3 have been hijacks. Why not open your own thread asking for help?

 

Sorry I'm new to this, didn't know that I could open a new thread! Apologies. I've managed the sort it by reading the many posts. It seems that my problem lay in my includes/modules/new_products.php file. I have sucessfully modified with all the advice given and now is working like a charm.

 

Thanks

Link to comment
Share on other sites

Sorry I'm new to this, didn't know that I could open a new thread! Apologies. I've managed the sort it by reading the many posts. It seems that my problem lay in my includes/modules/new_products.php file. I have sucessfully modified with all the advice given and now is working like a charm.

 

Thanks

 

 

Glad to hear its working. And, not a problem, just noticed that although our problems looked similair, I believe they are a bit different is all.

Link to comment
Share on other sites

The contents of includes/classes/PriceFormatter.php doesn't match the error output

 

select pd.products_name, p.products_model, p.products_image, p.products_id, p.manufacturers_id, p.products_price, p.products_weight, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price,paf.products_image2, paf.products_image3, paf.products_image4, paf.prod_type, paf.customers_id, paf.direct_contact, paf.products_qty_blocks, paf.products_price1, paf.products_price2, paf.products_price3, paf.products_price4, paf.products_price5, paf.products_price6, paf.products_price1_qty, paf.products_price2_qty, paf.products_price3_qty, paf.products_price4_qty, paf.products_price5_qty, paf.products_price6_qty, paf.products_id_source, paf.products_source_price, paf.products_source_price_multiplier, paf.products_notification_code from products_add_fields paf, products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = '62' and p.products_id = paf.products_id and pd.products_id = '62' and pd.language_id = '1'

 

I don't see that in there.

Link to comment
Share on other sites

I don't see that in there.

I guess it is rather hidden due to the $select_product_add_fields. Looks like a match to me though:

 

	$sql="select pd.products_name, p.products_model, p.products_image, p.products_id," .
	" p.manufacturers_id, p.products_price, p.products_weight," .
	" p.products_tax_class_id," .
	" IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price," .
	" IF(s.status, s.specials_new_products_price, p.products_price) as final_price," . $select_product_add_fields .
	TABLE_PRODUCTS_DESCRIPTION . " pd," .
	"	  " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id," .
	"	  " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id" .
	" where p.products_status = '1'" .
	"   and p.products_id = '" . (int)$product_id . "'" .
		   // jr - start - product additional fields
	 "   and p.products_id = paf.products_id  " . 
		  // jr - end - product additional fields
	"   and pd.products_id = '" . (int)$product_id . "'" .
	"   and pd.language_id = '". (int)$language_id ."'";

Link to comment
Share on other sites

BACKUP YOUR FILE FIRST THEN REPLACE IT COMPLETELY WITH THE CODE BELOW. I ADDED THE BRACKETS ACCORDING TO INSTRUCTION FOR 1054 FIX.

 

 

Jan, YES that is the one. Here it is. Now that I have it though, what should I do?

 

<?php
/*
 $Id: PriceFormatter.php,v 1.6 2003/06/25 08:29:26 petri Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2003 osCommerce

 Released under the GNU General Public License
*/

/*
   PriceFormatter.php - module to support quantity pricing

   Created 2003, Beezle Software based on some code mods by WasaLab Oy (Thanks!)
*/

class PriceFormatter {
 var $hiPrice;
 var $lowPrice;
 var $quantity;
 var $hasQuantityPrice;

 function PriceFormatter($prices=NULL) {
   $this->productsID = -1;

   $this->hasQuantityPrice=false;
   $this->hasSpecialPrice=false;

   $this->hiPrice=-1;
   $this->lowPrice=-1;

   for ($i=1; $i<=6; $i++){
     $this->quantity[$i] = -1;
     $this->prices[$i] = -1;
   }
   $this->thePrice = -1;
   $this->specialPrice = -1;
   $this->qtyBlocks = 1;

   if($prices) {
     $this->parse($prices);
}
 }

 function encode() {
$str = $this->productsID . ":"
       . (($this->hasQuantityPrice == true) ? "1" : "0") . ":"
       . (($this->hasSpecialPrice == true) ? "1" : "0") . ":"
       . $this->quantity[1] . ":"
       . $this->quantity[2] . ":"
       . $this->quantity[3] . ":"
       . $this->quantity[4] . ":"
	   . $this->quantity[5] . ":"
	   . $this->quantity[6] . ":"
       . $this->price[1] . ":"
       . $this->price[2] . ":"
       . $this->price[3] . ":"
       . $this->price[4] . ":"
	   . $this->price[5] . ":"
	   . $this->price[6] . ":"
       . $this->thePrice . ":"
       . $this->specialPrice . ":"
       . $this->qtyBlocks . ":"
       . $this->taxClass . ':'
	   . $this->lowestPrice;
return $str;
 }

 function decode($str) {
list($this->productsID,
     $this->hasQuantityPrice,
     $this->hasSpecialPrice,
     $this->quantity[1],
     $this->quantity[2],
     $this->quantity[3],
     $this->quantity[4],
     $this->quantity[5],
     $this->quantity[6],
     $this->price[1],
     $this->price[2],
     $this->price[3],
     $this->price[4],
     $this->price[5],
     $this->price[6],
     $this->thePrice,
     $this->specialPrice,
     $this->qtyBlocks,
     $this->taxClass) = explode(":", $str);

$this->hasQuantityPrice = (($this->hasQuantityPrice == 1) ? true : false);
$this->hasSpecialPrice = (($this->hasSpecialPrice == 1) ? true : false);

 }

 function parse($prices) {
   $this->productsID = $prices['products_id'];
   $this->hasQuantityPrice=false;
   $this->hasSpecialPrice=false;

   $this->quantity[1]=$prices['products_price1_qty'];
   $this->quantity[2]=$prices['products_price2_qty'];
   $this->quantity[3]=$prices['products_price3_qty'];
   $this->quantity[4]=$prices['products_price4_qty'];
   $this->quantity[5]=$prices['products_price5_qty'];
   $this->quantity[6]=$prices['products_price6_qty'];

   $this->thePrice=$prices['products_price'];
   $this->specialPrice=tep_get_products_special_price($prices['products_id']);
   $this->hasSpecialPrice=tep_not_null($this->specialPrice);

$this->price[1]=$prices['products_price1'];
   $this->price[2]=$prices['products_price2'];
   $this->price[3]=$prices['products_price3'];
   $this->price[4]=$prices['products_price4'];
$this->price[5]=$prices['products_price5'];
$this->price[6]=$prices['products_price6'];

// jr added to support Quantity Priceing and Group Pricing
$this->lowestPrice = get_lowest_price($prices['products_id'], $prices['products_price']);

    /*
      Change support special prices
   If any price level has a price greater than the special
   price lower it to the special price
*/
if ($this->hasSpecialPrice == true) {
	for($i=1; $i<=6; $i++) {
		if ($this->price[$i] > $this->specialPrice)
			$this->price[$i] = $this->specialPrice;
	}
}
//end changes to support special prices

// BOF Separate Pricing per Customer
// global variable (session) $sppc_customer_group_id -> local variable customer_group_id	
//	global $sppc_customer_group_id;

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

// 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') {
//		$customer_group_price_query = tep_db_query("select customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where products_id = '" . $prices['products_id'] ."' and customers_group_id = '".$customer_group_id."'");
//		if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {
//			if ($this->thePrice > $customer_group_price['price']) {
//				$this->thePrice = $customer_group_price['price'];
//			}
//		}	
//	}
// BOF Separate Pricing per Customer


   $this->qtyBlocks=$prices['products_qty_blocks'];

   $this->taxClass=$prices['products_tax_class_id'];

   if ($this->quantity[1] > 0) {
     $this->hasQuantityPrice = true;
     $this->hiPrice = $this->thePrice;
     $this->lowPrice = $this->thePrice;

     for($i=1; $i<=6; $i++) {
	if($this->quantity[$i] > 0) {
	  if ($this->price[$i] > $this->hiPrice) {
    	$this->hiPrice = $this->price[$i];
	  }
	  if ($this->price[$i] < $this->lowPrice) {
    	$this->lowPrice = $this->price[$i];
	  }
    }
     } // end for
   }
 }

 function loadProduct($product_id, $language_id=1)
 {
// jr - begin - product additional fields.
global $select_product_add_fields;
// jr - end - product additional fields.

// jr - begin - product additional fields - include fields if it exists
if (!isset($select_product_add_fields)) {
	if (file_exists(DIR_WS_ADDITIONAL_FIELDS . '_product_add_fields_variables_always.php')) {
		include(DIR_WS_ADDITIONAL_FIELDS . '_product_add_fields_variables_always.php'); }
	else {	$select_product_add_fields = " from (("; }
}
// jr - end - product additional fields - include fields if it exists	

   $sql="select pd.products_name, p.products_model, p.products_image, p.products_id," .
       " p.manufacturers_id, p.products_price, p.products_weight," .
       " p.products_tax_class_id," .
       " IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price," .
       " IF(s.status, s.specials_new_products_price, p.products_price) as final_price," . $select_product_add_fields .
       TABLE_PRODUCTS_DESCRIPTION . " pd," .
       "      " . TABLE_PRODUCTS . " p) left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id," .
       "      " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id" .
       " where p.products_status = '1'" .
       "   and p.products_id = '" . (int)$product_id . "'" .
	// jr - start - product additional fields
	"   and p.products_id = paf.products_id  " . 
	// jr - end - product additional fields
       "   and pd.products_id = '" . (int)$product_id . "'" .
       "   and pd.language_id = '". (int)$language_id ."'";

   $product_info_query = tep_db_query($sql);
   $product_info = tep_db_fetch_array($product_info_query);
   $this->parse($product_info);

   return $product_info;
 }

 function computePrice($qty)
 {
$qty = $this->adjustQty($qty);

// Compute base price, taking into account the possibility of a special
$price = ($this->hasSpecialPrice === TRUE) ? $this->specialPrice : $this->thePrice;

for ($i=1; $i<=6; $i++)
	if (($this->quantity[$i] > 0) && ($qty >= $this->quantity[$i]))
		$price = $this->price[$i];

// jr added to support Quantity Priceing and Group Pricing
if ($price > $this->lowestPrice)
	$price = $this->lowestPrice; 

return $price;
 }

 function adjustQty($qty) {
// Force QTY_BLOCKS granularity
$qb = $this->getQtyBlocks();

if ($qty < 1)
	$qty = 1;

// jr - start - mod
if ($qb == 1) {
	for ($i=1; $i<=6; $i++) {
		if ($qty <= $this->quantity[$i]) {
			$qty = $this->quantity[$i];
			$i = 7;
		}
	}
}
// jr - end - mod

return $qty;
 }

 function getQtyBlocks() {
   return $this->qtyBlocks;
 }

 function getPrice() {
   return $this->thePrice;
 }

 function getLowPrice() {
   return $this->lowPrice;
 }

 function getHiPrice() {
   return $this->hiPrice;
 }

 function hasSpecialPrice() {
   return $this->hasSpecialPrice;
 }

 function hasQuantityPrice() {
   return $this->hasQuantityPrice;
 }

 function getPriceString($style='productPriceInBox') {
   global $currencies;

   if ($this->hasSpecialPrice == true) {
   	$lc_text = '<table align="top" border="1" cellspacing="0" cellpadding="0">';
       $lc_text .= '<tr><td align="center" class=' . $style. ' colspan="2">';
      $lc_text .= ' <s>'
	. $currencies->display_price($this->thePrice,
			     tep_get_tax_rate($this->taxClass))
	. '</s>  <span class="productSpecialPrice">'
	. $currencies->display_price($this->specialPrice,
			     tep_get_tax_rate($this->taxClass))
	. '</span> '
	.'</td></tr>';
   }
   else
   {
	$lc_text = '<table align="top" border="1" cellspacing="0" cellpadding="0">';
	$lc_text .= '<tr><td align="center" class=' . $style. ' colspan="2">'
	. $currencies->display_price($this->thePrice,
	tep_get_tax_rate($this->taxClass))
	. '</td></tr>';
   }
     // If you want to change the format of the price/quantity table
     // displayed on the product information page, here is where you do it.

   if($this->hasQuantityPrice == true) {
	for($i=1; $i<=6; $i++) {
		if($this->quantity[$i] > 0) {
			$lc_text .= '<tr><td class='.$style.'>'
			. $this->quantity[$i]
			.'+ </td><td class='.$style.'>'
			. $currencies->display_price($this->price[$i],
			tep_get_tax_rate($this->taxClass))
			.'</td></tr>';
		}
	}

	$lc_text .= '</table>';

     }
     else {
	if ($this->hasSpecialPrice == true) {
		$lc_text = ' <s>'
		  . $currencies->display_price($this->thePrice, tep_get_tax_rate($this->taxClass))
		  . '</s>  <span class="productSpecialPrice">'
		  . $currencies->display_price($this->specialPrice, tep_get_tax_rate($this->taxClass))
		  . '</span> ';
	}
	else {
		$lc_text = ' '
  		. $currencies->display_price($this->thePrice,
			       tep_get_tax_rate($this->taxClass))
  		. ' ';
	}
     	}

   return $lc_text;
 }

 function getPriceStringShort() {
   global $currencies;


$lc_text = '';
   if ($this->hasSpecialPrice == true) {
  	  $lc_text = ' <s>'
  			 . $currencies->display_price($this->thePrice, tep_get_tax_rate($this->taxClass))
			 . '</s>  <span class="productSpecialPrice">'
//			 	 . $currencies->display_price($this->specialPrice, tep_get_tax_rate($this->taxClass))
		 	 . $currencies->display_price($this->lowestPrice, tep_get_tax_rate($this->taxClass))
	 	     . '</span> ';
}
if (!tep_not_null($lc_text)) {
  if($this->hasQuantityPrice == true) {
		$lc_text = ' '
				   . $currencies->display_price($this->lowPrice, tep_get_tax_rate($this->taxClass))
				   . ' - '
			 	   . $currencies->display_price($this->hiPrice, tep_get_tax_rate($this->taxClass))
				   . ' ';
     }

}
if (!tep_not_null($lc_text)) {
	$lc_text = ' '
 			   . $currencies->display_price($this->lowestPrice, tep_get_tax_rate($this->taxClass))
		 	   . ' ';
   }
   return $lc_text;
 }
}

?>

Link to comment
Share on other sites

BACKUP YOUR FILE FIRST THEN REPLACE IT COMPLETELY WITH THE CODE BELOW. I ADDED THE BRACKETS ACCORDING TO INSTRUCTION FOR 1054 FIX.

 

Ok, after putting that in, I now get a different error. Here it is:

 

 
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products' at line 23

select pd.products_name, p.products_model, p.products_image, p.products_id, p.manufacturers_id, p.products_price, p.products_weight, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price,paf.products_image2, paf.products_image3, paf.products_image4, paf.prod_type, paf.customers_id, paf.direct_contact, paf.products_qty_blocks, paf.products_price1, paf.products_price2, paf.products_price3, paf.products_price4, paf.products_price5, paf.products_price6, paf.products_price1_qty, paf.products_price2_qty, paf.products_price3_qty, paf.products_price4_qty, paf.products_price5_qty, paf.products_price6_qty, paf.products_id_source, paf.products_source_price, paf.products_source_price_multiplier, paf.products_notification_code from products_add_fields paf, products_description pd, products p) left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c) left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = '516' and p.products_id = paf.products_id and pd.products_id = '516' and pd.language_id = '1'

[TEP STOP]

Link to comment
Share on other sites

Ok, after putting that in, I now get a different error. Here it is:

 

 
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products' at line 23

select pd.products_name, p.products_model, p.products_image, p.products_id, p.manufacturers_id, p.products_price, p.products_weight, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price,paf.products_image2, paf.products_image3, paf.products_image4, paf.prod_type, paf.customers_id, paf.direct_contact, paf.products_qty_blocks, paf.products_price1, paf.products_price2, paf.products_price3, paf.products_price4, paf.products_price5, paf.products_price6, paf.products_price1_qty, paf.products_price2_qty, paf.products_price3_qty, paf.products_price4_qty, paf.products_price5_qty, paf.products_price6_qty, paf.products_id_source, paf.products_source_price, paf.products_source_price_multiplier, paf.products_notification_code from products_add_fields paf, products_description pd, products p) left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c) left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = '516' and p.products_id = paf.products_id and pd.products_id = '516' and pd.language_id = '1'

[TEP STOP]

 

Have a look HERE for the 1064 error. Remember to BACKUP before making changes.

Link to comment
Share on other sites

Have a look HERE for the 1064 error. Remember to BACKUP before making changes.

 

 

Well, I gave it a shot. The files are as it says to do in that post and nothing. I believe the error is the same. Here it is:

 

 
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products' at line 23

select pd.products_name, p.products_model, p.products_image, p.products_id, p.manufacturers_id, p.products_price, p.products_weight, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price,paf.products_image2, paf.products_image3, paf.products_image4, paf.prod_type, paf.customers_id, paf.direct_contact, paf.products_qty_blocks, paf.products_price1, paf.products_price2, paf.products_price3, paf.products_price4, paf.products_price5, paf.products_price6, paf.products_price1_qty, paf.products_price2_qty, paf.products_price3_qty, paf.products_price4_qty, paf.products_price5_qty, paf.products_price6_qty, paf.products_id_source, paf.products_source_price, paf.products_source_price_multiplier, paf.products_notification_code from products_add_fields paf, products_description pd, products p) left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c) left join specials s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = '470' and p.products_id = paf.products_id and pd.products_id = '470' and pd.language_id = '1'

[TEP STOP]

 

Would the fact that it says "line 23" and not line 1 have anything to do with it?

Link to comment
Share on other sites

Please post your catalog/includes/classes/split_page_results.php

 

 

<?php
/*
 $Id: split_page_results.php,v 1.15 2003/06/09 22:35:34 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2003 osCommerce

 Released under the GNU General Public License
*/

 class splitPageResults {
   var $sql_query, $number_of_rows, $current_page_number, $number_of_pages, $number_of_rows_per_page, $page_name;

/* class constructor */
   function splitPageResults($query, $max_rows, $count_key = '*', $page_holder = 'page') {
     global $HTTP_GET_VARS, $HTTP_POST_VARS;

     $this->sql_query = $query;
     $this->page_name = $page_holder;

     if (isset($HTTP_GET_VARS[$page_holder])) {
       $page = $HTTP_GET_VARS[$page_holder];
     } elseif (isset($HTTP_POST_VARS[$page_holder])) {
       $page = $HTTP_POST_VARS[$page_holder];
     } else {
       $page = '';
     }

     if (empty($page) || !is_numeric($page)) $page = 1;
     $this->current_page_number = $page;

     $this->number_of_rows_per_page = $max_rows;

     $pos_to = strlen($this->sql_query);
     $pos_from = strpos($this->sql_query, ' from', 0);

     $pos_group_by = strpos($this->sql_query, ' group by', $pos_from);
     if (($pos_group_by < $pos_to) && ($pos_group_by != false)) $pos_to = $pos_group_by;

     $pos_having = strpos($this->sql_query, ' having', $pos_from);
     if (($pos_having < $pos_to) && ($pos_having != false)) $pos_to = $pos_having;

     $pos_order_by = strpos($this->sql_query, ' order by', $pos_from);
     if (($pos_order_by < $pos_to) && ($pos_order_by != false)) $pos_to = $pos_order_by;

     if (strpos($this->sql_query, 'distinct') || strpos($this->sql_query, 'group by')) {
       $count_string = 'distinct ' . tep_db_input($count_key);
     } else {
       $count_string = tep_db_input($count_key);
     }

     $count_query = tep_db_query("select count(" . $count_string . ") as total " . substr($this->sql_query, $pos_from, ($pos_to - $pos_from)));
     $count = tep_db_fetch_array($count_query);

     $this->number_of_rows = $count['total'];

     $this->number_of_pages = ceil($this->number_of_rows / $this->number_of_rows_per_page);

     if ($this->current_page_number > $this->number_of_pages) {
       $this->current_page_number = $this->number_of_pages;
     }

     $offset = ($this->number_of_rows_per_page * ($this->current_page_number - 1));

     $this->sql_query .= " limit " . max($offset, 0) . ", " . $this->number_of_rows_per_page;
   }

/* class functions */

// display split-page-number-links
   function display_links($max_page_links, $parameters = '') {
     global $PHP_SELF, $request_type;

     $display_links_string = '';

     $class = 'class="pageResults"';

     if (tep_not_null($parameters) && (substr($parameters, -1) != '&')) $parameters .= '&';

// previous button - not displayed on first page
     if ($this->current_page_number > 1) $display_links_string .= '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . $this->page_name . '=' . ($this->current_page_number - 1), $request_type) . '" class="pageResults" title=" ' . PREVNEXT_TITLE_PREVIOUS_PAGE . ' "><u>' . PREVNEXT_BUTTON_PREV . '</u></a>  ';

// check if number_of_pages > $max_page_links
     $cur_window_num = intval($this->current_page_number / $max_page_links);
     if ($this->current_page_number % $max_page_links) $cur_window_num++;

     $max_window_num = intval($this->number_of_pages / $max_page_links);
     if ($this->number_of_pages % $max_page_links) $max_window_num++;

// previous window of pages
     if ($cur_window_num > 1) $display_links_string .= '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . $this->page_name . '=' . (($cur_window_num - 1) * $max_page_links), $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_PREV_SET_OF_NO_PAGE, $max_page_links) . ' ">...</a>';

// page nn button
     for ($jump_to_page = 1 + (($cur_window_num - 1) * $max_page_links); ($jump_to_page <= ($cur_window_num * $max_page_links)) && ($jump_to_page <= $this->number_of_pages); $jump_to_page++) {
       if ($jump_to_page == $this->current_page_number) {
         $display_links_string .= ' <b>' . $jump_to_page . '</b> ';
       } else {
         $display_links_string .= ' <a href="' . tep_href_link(basename($PHP_SELF), $parameters . $this->page_name . '=' . $jump_to_page, $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_PAGE_NO, $jump_to_page) . ' "><u>' . $jump_to_page . '</u></a> ';
       }
     }

// next window of pages
     if ($cur_window_num < $max_window_num) $display_links_string .= '<a href="' . tep_href_link(basename($PHP_SELF), $parameters . $this->page_name . '=' . (($cur_window_num) * $max_page_links + 1), $request_type) . '" class="pageResults" title=" ' . sprintf(PREVNEXT_TITLE_NEXT_SET_OF_NO_PAGE, $max_page_links) . ' ">...</a> ';

// next button
     if (($this->current_page_number < $this->number_of_pages) && ($this->number_of_pages != 1)) $display_links_string .= ' <a href="' . tep_href_link(basename($PHP_SELF), $parameters . 'page=' . ($this->current_page_number + 1), $request_type) . '" class="pageResults" title=" ' . PREVNEXT_TITLE_NEXT_PAGE . ' "><u>' . PREVNEXT_BUTTON_NEXT . '</u></a> ';

     return $display_links_string;
   }

// display number of total products found
   function display_count($text_output) {
     $to_num = ($this->number_of_rows_per_page * $this->current_page_number);
     if ($to_num > $this->number_of_rows) $to_num = $this->number_of_rows;

     $from_num = ($this->number_of_rows_per_page * ($this->current_page_number - 1));

     if ($to_num == 0) {
       $from_num = 0;
     } else {
       $from_num++;
     }

     return sprintf($text_output, $from_num, $to_num, $this->number_of_rows);
   }
 }
?>

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...