Jump to content

Archived

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

MerDer

1054 - Unknown Column 'p.products_id' In 'on Clause'

Recommended Posts

Hi,

 

I finished setting up a web shop and I keep getting the 1054 - Unknown column 'p.products_id' in 'on clause'

error on my index page.

 

Now I've done multiple searched for this and I've found various codes to replace, did all of that, and it's still there.

I know it's a MySQL 5 fix, but since I've tried all the codes I could find, can anyone help me with this?

 

URL is http://www.loap4u.com

 

Thanks in advance!

Share this post


Link to post
Share on other sites

hi,

 

i got the same error message, how have you fixed the problem ?

 

bg

Michael

Share this post


Link to post
Share on other sites

That fixed the products error.

But now when I click a category, for example Jackets, it shows a lot of clothes mixed up

Share this post


Link to post
Share on other sites

Thanks!

After trying everything I found together, it finally seems to be solved.

 

Cheers everyone!

Share this post


Link to post
Share on other sites
Thanks!

After trying everything I found together, it finally seems to be solved.

 

Cheers everyone!

 

 

Many thanks Ozstar. Your download has saved me hours of trawling through SQL server documentation.

 

Brilliant!

 

:D

Share this post


Link to post
Share on other sites

I have read the topics and found the contribution. I have fixed the text replacement in In catalog/advanced_search_result.php, however it states that I need to replace the following:

 

In Catalog/index.php file..

 

Find this...

 

 

// show the products of a specified manufacturer

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {

// We are asked to show only a specific category

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, 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 from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";

} else {

// We show them all

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, 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 from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";

}

} else {

// show the products in a given categorie

if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {

// We are asked to show only specific catgeory

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, 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 from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

} else {

// We show them all

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, 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 from " . 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 = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

}

}

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

 

and replace with this

 

// show the products of a specified manufacturer

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {

// We are asked to show only a specific category

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, 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 from (" . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c ) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";

} else {

// We show them all

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, 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 from (" . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";

}

} else {

// show the products in a given categorie

if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {

// We are asked to show only specific catgeory

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, 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 from (" . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c) left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

} else {

// We show them all

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, 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 from ((" . 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 = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";

}

}

 

but as you can see below my index does not have the specified code, any ideas?

 

<?php

/*

$Id: index.php,v 1.1 2005/08/11 17:37:59 hpdl Exp $

 

E-Commerce Solutions

 

Copyright © 2005 www.flash-template-design.com

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

// the following cPath references come from application_top.php

$category_depth = 'top';

if (isset($cPath) && tep_not_null($cPath)) {

$categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");

$cateqories_products = tep_db_fetch_array($categories_products_query);

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

$category_depth = 'products'; // display products

} else {

$category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");

$category_parent = tep_db_fetch_array($category_parent_query);

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

$category_depth = 'nested'; // navigate through the categories

} else {

$category_depth = 'products'; // category has no products, but display the 'no products' message

}

}

}

 

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

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<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">-->

<link rel="stylesheet" type="text/css" href="style.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<tr>

<td width="302" height="439" align="left" valign="top"><img src="images/main.jpg" width="302" height="439" alt=""></td>

<td width="410" height="439" bgcolor="#F5F5F5">

<table border="0" width="410" cellpadding="0" cellspacing="0" height="439">

<tr>

<td width="409" height="100%">

<table border="0" width="100%" cellpadding="0" cellspacing="0" height="100%">

<tr>

<td width="100%" height="196" valign="top" >

<table border="0" width="100%" cellpadding="0" cellspacing="0" >

<tr>

<td width="289" height="196" align="center" valign="top" >

<table border="0" width="232" cellpadding="0" cellspacing="0" >

<tr>

<td height="38" valign="top" style="padding-top:20px;"><img src="images/welcome.jpg" width="232" height="24" alt="" /></td>

</tr>

<tr>

<td height="1" background="images/hpoint.gif"><img src="images/hpoint.gif" width="3" height="1"></td>

</tr>

<tr>

<td width="100%" align="left" style="padding-top:8px; padding-bottom:11px;">

<img src="images/str_head.gif" width="9" height="5" hspace="2" vspace="1"/><span class="crimson">Good Vibrationz hits the cyber world.</span>

You've seen the partys, now enjoy shopping from GOOD VIBRATIONZ online. All the same great lines, just more and more special offers and discounts

</td>

</tr>

<tr>

<td height="1" background="images/hpoint.gif"><img src="images/hpoint.gif" width="3" height="1"></td>

</tr>

<tr>

<td height="30" style="padding-top:6px; " align="left"><img src="images/point_crimson.gif" width="4" height="4" vspace="1" alt=""/> <a href="" class="more">more</a> <img src="images/str_more.gif" width="6" height="5" alt="" vspace="1"/></td>

</tr>

</table>

</td>

<td width="92" height="196" style="padding-right:28px; "><img src="images/welcome_girl.jpg" width="92" height="196" alt="" /></td>

</tr>

<tr>

<td colspan="2" height="1" background="images/hpoint.gif" align="left"><img src="images/hpoint.gif" width="3" height="1" alt=""></td>

</tr>

<tr>

<td colspan="2" bgcolor="#F5F5F5" height="2"><img src="images/spacer.gif" width="1" height="1" alt=""></td>

</tr>

<tr>

<td colspan="2" height="1" background="images/hpoint.gif" align="left"><img src="images/hpoint.gif" width="3" height="1" alt=""></td>

</tr>

<tr>

<td colspan="2"><?php include(DIR_WS_MODULES . 'special_products.php'); ?></td>

</tr>

</table>

</td>

</tr>

</table>

</td>

<td width="1" height="100%" background="images/vpoint.gif" valign="top"><img src="images/vpoint.gif" width="1" height="3"></td>

</tr>

</table>

</td>

</tr>

<tr>

<td width="100%" height="2" colspan="2" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1" alt=""></td>

</tr>

<tr>

<td width="302" height="168" valign="top"><?php include(DIR_WS_MODULES . 'new_products.php'); ?> </td>

<td width="410" height="168" bgcolor="#F5F5F5" valign="middle" align="left">

<table width="100%" height="162" border="0" cellpadding="0" cellspacing="6" bgcolor="#F5F5F5">

<tr>

<td rowspan="3" height="61" ><img src="images/girl_links.jpg" width="127" height="154" alt="" /></td>

<td><b>Inim vulputate refoveo</b>, pagus olim, ntosus feugait quidem, decet in. Eros valde vtosus refoveo minim vel te nulla importunus drerit in ille:</td>

</tr>

<tr>

<td height="1" background="images/hpoint.gif" align="left"><img src="images/hpoint.gif" width="3" height="1" alt=""></td>

</tr>

<tr>

<td height="100">

<ul style="list-style-image:url(images/sign_link.jpg); margin-left:25px; ">

<li><a href="" class="crimson">Lorem ipsum dolor sit amet</a></li>

<li><a href="" class="crimson">Consectetuer adipiscing elit. Nunc suscipit.</a></li>

<li><a href="" class="crimson">Suspendisse enim arcu, convallis non</a></li>

<li><a href="" class="crimson">Cursus sed, dignissim et, est.</a></li>

<li><a href="" class="crimson">Aenean semper aliquet libero. </a></li></ul></td>

</tr>

</table>

</td>

</tr>

<tr>

<td width="100%" height="3" colspan="2" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="1" height="1" alt=""></td>

</tr>

 

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

 

 

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Complete Newbie On The Learn - Not A Programmer

But Learning As I Go

Share this post


Link to post
Share on other sites

^Bump^

 

Alternativley can some answer the following:

 

If it os only the latest release of Oscommerce that is compatible with mySQL 5 then does this mean that templates in general will not work unless they are stated to be of the latest release. I have seen many post stating to install the latest patch for osCommerce but the download link is for the whole application, I mean which files would need replacing from the osCommerce original install with the which files from the template? I think that makes sense, so sorry I am just a bit lost with osCommerce (but hey trying to learn)


Complete Newbie On The Learn - Not A Programmer

But Learning As I Go

Share this post


Link to post
Share on other sites
^Bump^

 

Alternativley can some answer the following:

 

If it os only the latest release of Oscommerce that is compatible with mySQL 5 then does this mean that templates in general will not work unless they are stated to be of the latest release. I have seen many post stating to install the latest patch for osCommerce but the download link is for the whole application, I mean which files would need replacing from the osCommerce original install with the which files from the template? I think that makes sense, so sorry I am just a bit lost with osCommerce (but hey trying to learn)

it's simple. First you install the template. Then you download the latest osc and you go through the manual instructions to upgrade it.

Share this post


Link to post
Share on other sites
it's simple. First you install the template. Then you download the latest osc and you go through the manual instructions to upgrade it.

hello i installed the http://www.oscommerce.com/community/contributions,4654 contribution and it fixed the issue with categories having the 1054 - Unknown Column 'p.products_id' In 'on Clause' issue,

But when that was fixed I seen 2 changes my 1. categorie name in the in the address bar to -c-31.html instead of categorie name. 2. when i do a search of my website I get this error now:

 

Products meeting the search criteria

 

 

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

 

select count(distinct p.products_id) as total from products p left join manufacturers m using(manufacturers_id), products_description pd left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%trea%' or p.products_model like '%trea%' or m.manufacturers_name like '%trea%') )

 

[TEP STOP]

Share this post


Link to post
Share on other sites
it's simple. First you install the template. Then you download the latest osc and you go through the manual instructions to upgrade it.

 

Wouldnt that overwrite the template?

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites
Wouldnt that overwrite the template?

 

i've got an old 10700 TemplateMonster OSC template, and I would like to upgrade the "core" into 2.2. How can I make it? What is this "the manual instructions" ?

Share this post


Link to post
Share on other sites

Hi,

 

I also have the exact same error in the BEST SELLERS colums:

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

 

select p.products_image, pd.products_name, p.products_id, p.manufacturers_id, p.products_price, 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 from 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 = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '61' order by p.products_date_added DESC limit 2

 

[TEP STOP]

 

 

Can anyone please help me in fixing this?

 

My url is: http://infinitecoregroup.com/index.php

 

Thnx

Share this post


Link to post
Share on other sites

I followed the first part of the fix, making the changed in the index.php file and that fixed the category listing, however when I came to edit the advanced_search_result.php file I couldnt find the line that was specified. Its just the search function which brings up the error now:

 

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

select count(distinct p.products_id) as total from products p left join manufacturers m using(manufacturers_id), products_description pd left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c where p.products_status = '1' and c.categories_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%fbnfvbn%' or p.products_model like '%fbnfvbn%' or m.manufacturers_name like '%fbnfvbn%') )

 

My file is as follows:

<?php
/*
 $Id: advanced_search_result.php,v 1.2 2003/09/24 15:34:25 wilt Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

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

 // Search enhancement mod start

 if(isset($_GET['keywords']) && $_GET['keywords'] != ''){
  if(!isset($_GET['s'])){
		$pwstr_check = strtolower(substr($_GET['keywords'], strlen($_GET['keywords'])-1, strlen($_GET['keywords'])));
		if($pwstr_check == 's'){
				$pwstr_replace = substr($_GET['keywords'], 0, strlen($_GET['keywords'])-1);
				header('location: ' . tep_href_link( FILENAME_ADVANCED_SEARCH_RESULT , 'search_in_description=1&s=1&keywords=' . urlencode($pwstr_replace) . '' ));
				exit;
		}
	  } 

	 $pw_keywords = explode(' ',stripslashes(strtolower($_GET['keywords'])));
	 $pw_boldwords = $pw_keywords;
	 $sql_words = tep_db_query("SELECT * FROM searchword_swap");
	 $pw_replacement = '';
	 while ($sql_words_result = tep_db_fetch_array($sql_words)) {
	 	   if(stripslashes(strtolower($_GET['keywords'])) == stripslashes(strtolower($sql_words_result['sws_word']))){
	 		   $pw_replacement = stripslashes($sql_words_result['sws_replacement']);
	 		   $pw_link_text = '<b><i>' . stripslashes($sql_words_result['sws_replacement']) . '</i></b>';
	 		   $pw_phrase = 1;
	 		   $pw_mispell = 1;
	 		   break;
	 	   }
		 for($i=0; $i<sizeof($pw_keywords); $i++){
			 if($pw_keywords[$i]  == stripslashes(strtolower($sql_words_result['sws_word']))){
				 $pw_keywords[$i]  = stripslashes($sql_words_result['sws_replacement']);
				 $pw_boldwords[$i] = '<b><i>' . stripslashes($sql_words_result['sws_replacement']) . '</i></b>';
				 $pw_mispell = 1;
				 break;
			 }
		 }	
	 }
	 if(!isset($pw_phrase)){
		 for($i=0; $i<sizeof($pw_keywords); $i++){
			 $pw_replacement .= $pw_keywords[$i]. ' ';
	 		   $pw_link_text   .= $pw_boldwords[$i]. ' ';	
		 }
	 }

	 $pw_replacement = trim($pw_replacement);
	 $pw_link_text   = trim($pw_link_text);
	 $pw_string	  = TEXT_REPLACEMENT_SUGGESTION . '<a href="' . tep_href_link( FILENAME_ADVANCED_SEARCH_RESULT , 'keywords=' . urlencode($pw_replacement) . '&search_in_description=1' ) . '">' . $pw_link_text . '</a>?<br /><br />';
 }
 // Search enhancement mod end

 $error = false;

 if ( (isset($HTTP_GET_VARS['keywords']) && empty($HTTP_GET_VARS['keywords'])) &&
   (isset($HTTP_GET_VARS['dfrom']) && (empty($HTTP_GET_VARS['dfrom']) || ($HTTP_GET_VARS['dfrom'] == DOB_FORMAT_STRING))) &&
   (isset($HTTP_GET_VARS['dto']) && (empty($HTTP_GET_VARS['dto']) || ($HTTP_GET_VARS['dto'] == DOB_FORMAT_STRING))) &&
   (isset($HTTP_GET_VARS['pfrom']) && !is_numeric($HTTP_GET_VARS['pfrom'])) &&
   (isset($HTTP_GET_VARS['pto']) && !is_numeric($HTTP_GET_VARS['pto'])) ) {
$error = true;

$messageStack->add_session('search', ERROR_AT_LEAST_ONE_INPUT);
 } else {
$dfrom = '';
$dto = '';
$pfrom = '';
$pto = '';
$keywords = '';

if (isset($HTTP_GET_VARS['dfrom'])) {
  $dfrom = (($HTTP_GET_VARS['dfrom'] == DOB_FORMAT_STRING) ? '' : $HTTP_GET_VARS['dfrom']);
}

if (isset($HTTP_GET_VARS['dto'])) {
  $dto = (($HTTP_GET_VARS['dto'] == DOB_FORMAT_STRING) ? '' : $HTTP_GET_VARS['dto']);
}

if (isset($HTTP_GET_VARS['pfrom'])) {
  $pfrom = $HTTP_GET_VARS['pfrom'];
}

if (isset($HTTP_GET_VARS['pto'])) {
  $pto = $HTTP_GET_VARS['pto'];
}

if (isset($HTTP_GET_VARS['keywords'])) {
  $keywords = $HTTP_GET_VARS['keywords'];
}

$date_check_error = false;
if (tep_not_null($dfrom)) {
  if (!tep_checkdate($dfrom, DOB_FORMAT_STRING, $dfrom_array)) {
	$error = true;
	$date_check_error = true;

	$messageStack->add_session('search', ERROR_INVALID_FROM_DATE);
  }
}

if (tep_not_null($dto)) {
  if (!tep_checkdate($dto, DOB_FORMAT_STRING, $dto_array)) {
	$error = true;
	$date_check_error = true;

	$messageStack->add_session('search', ERROR_INVALID_TO_DATE);
  }
}

if (($date_check_error == false) && tep_not_null($dfrom) && tep_not_null($dto)) {
  if (mktime(0, 0, 0, $dfrom_array[1], $dfrom_array[2], $dfrom_array[0]) > mktime(0, 0, 0, $dto_array[1], $dto_array[2], $dto_array[0])) {
	$error = true;

	$messageStack->add_session('search', ERROR_TO_DATE_LESS_THAN_FROM_DATE);
  }
}

$price_check_error = false;
if (tep_not_null($pfrom)) {
  if (!settype($pfrom, 'double')) {
	$error = true;
	$price_check_error = true;

	$messageStack->add_session('search', ERROR_PRICE_FROM_MUST_BE_NUM);
  }
}

if (tep_not_null($pto)) {
  if (!settype($pto, 'double')) {
	$error = true;
	$price_check_error = true;

	$messageStack->add_session('search', ERROR_PRICE_TO_MUST_BE_NUM);
  }
}

if (($price_check_error == false) && is_float($pfrom) && is_float($pto)) {
  if ($pfrom >= $pto) {
	$error = true;

	$messageStack->add_session('search', ERROR_PRICE_TO_LESS_THAN_PRICE_FROM);
  }
}

if (tep_not_null($keywords)) {
  if (!tep_parse_search_string($keywords, $search_keywords)) {
	$error = true;

	$messageStack->add_session('search', ERROR_INVALID_KEYWORDS);
  }
}
 }

 if (empty($dfrom) && empty($dto) && empty($pfrom) && empty($pto) && empty($keywords)) {
$error = true;

$messageStack->add_session('search', ERROR_AT_LEAST_ONE_INPUT);
 }

 if ($error == true) {
tep_redirect(tep_href_link(FILENAME_ADVANCED_SEARCH, tep_get_all_get_params(), 'NONSSL', true, false));
 }

 // Search enhancement mod start
			  $search_enhancements_keywords = $_GET['keywords'];
			  $search_enhancements_keywords = strip_tags($search_enhancements_keywords);
			  $search_enhancements_keywords = addslashes($search_enhancements_keywords);				

			  if ($search_enhancements_keywords != $last_search_insert) {
					  tep_db_query("insert into search_queries (search_text)  values ('" .  $search_enhancements_keywords . "')");
					  tep_session_register('last_search_insert');
					  $last_search_insert = $search_enhancements_keywords;
			  }
 // Search enhancement mod end

 $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ADVANCED_SEARCH));
 $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, tep_get_all_get_params(), 'NONSSL', true, false));

 $content = CONTENT_ADVANCED_SEARCH_RESULT;

 require(DIR_WS_TEMPLATES . TEMPLATE_NAME . '/' . TEMPLATENAME_MAIN_PAGE);

 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

Share this post


Link to post
Share on other sites

YAAAYY, thanks so much for this thread and for the contrib Ozstar, it worked, ipowerweb just transferred us over to a new server and messed this up, but now it is fixed thanks to you all and a quick google search to find it. THANKS!!!

Zach

Share this post


Link to post
Share on other sites

I think I'm too code-illiterate for this or something. I get this error on my page...sometimes. I tried the fixes from Ozstar and still have the exact same issues as before. Here's the thing though. From my main website, if I click to get into one of the store categories, I have the problem. But then if I click on the category within oscommerce, from the error page, it works fine. And then EVERYTHING will work fine, including my site's menu. But if I am on the error page, then the site menu won't work, and only the oscommerce menu will. This probably makes no sense, but hopefully someone knows what's going on. The address is http://www.threatclothingco.com

Please help me, this is driving me crazy. ha

Share this post


Link to post
Share on other sites
I think I'm too code-illiterate for this or something. I get this error on my page...sometimes. I tried the fixes from Ozstar and still have the exact same issues as before. Here's the thing though. From my main website, if I click to get into one of the store categories, I have the problem. But then if I click on the category within oscommerce, from the error page, it works fine. And then EVERYTHING will work fine, including my site's menu. But if I am on the error page, then the site menu won't work, and only the oscommerce menu will. This probably makes no sense, but hopefully someone knows what's going on. The address is http://www.threatclothingco.com

Please help me, this is driving me crazy. ha

 

To follow up on this, it is fixed now. I wasted 2 1/2 hours editing my site, only to realize everything I was doing resulted in zero changes, because my web host had updated and all the addresses were different. I'm a smart one, I know.

Share this post


Link to post
Share on other sites

×