Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Advanced Search - problem


pete2007

Recommended Posts

Hi all,

 

After I use the advanced search feature to find products, a list of products are shown, but after I click on these products it states: 'Product Not Found" does anyone know why this is?

 

I have noticed that the URL has an extra /

 

Example URL using search: http://testing.co.uk/store/osc//testing.php

Correct URL: http://testing.co.uk/store/osc/testing.php

 

Has anyone ever had this error before?

 

Thanks in advance!

Link to comment
Share on other sites

Do you get that extra / on all of your pages? Check you config file.to see if it is in there.

 

Thanks for the response.

 

All my other products listed in the normal store are fine, its just when I search through advanced search feature this happens, I'll checkout the config file, to see if I can find anything...

Link to comment
Share on other sites

You're using a template so a little harder to find. It could be in catalog/includes/modules/product_lidting.php.

Post that code and we can take a look.

Link to comment
Share on other sites

You're using a template so a little harder to find. It could be in catalog/includes/modules/product_lidting.php.

Post that code and we can take a look.

 

Here's the product_listing.php code:

 

<?php
/*
 $Id: product_listing.php,v 1.44 2003/06/09 22:49:59 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
?>

<?php echo tep_draw_title_top();?>

			<?php echo $breadcrumb->trail(' » ')?>

<?php echo tep_draw_title_bottom();?>	

<? tep_draw_heading_top_3();?>

<?php
 $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');

 if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '2') ) ) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="0" class="result">
 <tr>
<td><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
<td class="result_right" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>
 </tr>
</table>

<?php echo tep_draw_result_top(); ?>

<?php
 }

$info_box_contents = array();
 $list_box_contents = array();
$my_row = 0;
$my_col = 0;


 for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {
switch ($column_list[$col]) {
  case 'PRODUCT_LIST_MODEL':
	$lc_text = TABLE_HEADING_MODEL;
	$lc_align = '';
	break;
  case 'PRODUCT_LIST_NAME':
	$lc_text = TABLE_HEADING_PRODUCTS;
	$lc_align = '';
	break;
  case 'PRODUCT_LIST_MANUFACTURER':
	$lc_text = TABLE_HEADING_MANUFACTURER;
	$lc_align = '';
	break;
  case 'PRODUCT_LIST_PRICE':
	$lc_text = TABLE_HEADING_PRICE;
	$lc_align = 'right';
	break;
  case 'PRODUCT_LIST_QUANTITY':
	$lc_text = TABLE_HEADING_QUANTITY;
	$lc_align = 'right';
	break;
  case 'PRODUCT_LIST_WEIGHT':
	$lc_text = TABLE_HEADING_WEIGHT;
	$lc_align = 'right';
	break;
  case 'PRODUCT_LIST_IMAGE':
	$lc_text = TABLE_HEADING_IMAGE;
	$lc_align = 'center';
	break;
  case 'PRODUCT_LIST_BUY_NOW':
	$lc_text = TABLE_HEADING_BUY_NOW;
	$lc_align = 'center';
	break;
}

if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) {
  $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text);
}

$list_box_contents[0][] = array('align' => $lc_align,
								'params' => 'class="productListing-heading"',
								'text' => ' ' . $lc_text . ' ');
 }

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

  if (($rows/2) == floor($rows/2)) {
	$list_box_contents[] = array('params' => 'class="productListing-even"');
  } else {
	$list_box_contents[] = array('params' => 'class="productListing-odd"');
  }

  $cur_row = sizeof($list_box_contents) - 1;

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

	switch ($column_list[$col]) {
	  case 'PRODUCT_LIST_MODEL':
		$lc_align = '';
		$lc_text = ' ' . $listing['products_model'] . ' ';
		break;
	  case 'PRODUCT_LIST_NAME':
		$lc_align = '';
		if (isset($HTTP_GET_VARS['manufacturers_id'])) {
		$p_name = $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';
		} else {
		$p_name = $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';
		}
		break;
	  case 'PRODUCT_LIST_MANUFACTURER':
		$lc_align = '';
		$lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a> ';
		break;
	  case 'PRODUCT_LIST_PRICE':
		$lc_align = 'right';
		if (tep_not_null($listing['specials_new_products_price'])) {
	   $p_price = $lc_text = '<s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>';
		} else {
	   $p_price = $lc_text = '<span class="productSpecialPrice">' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>';
		}
		break;
	  case 'PRODUCT_LIST_QUANTITY':
		$lc_align = 'right';
		$lc_text = ' ' . $listing['products_quantity'] . ' ';
		break;
	  case 'PRODUCT_LIST_WEIGHT':
		$lc_align = 'right';
		$lc_text = ' ' . $listing['products_weight'] . ' ';
		break;
	  case 'PRODUCT_LIST_IMAGE':
		$lc_align = 'center';
		if (isset($HTTP_GET_VARS['manufacturers_id'])) {
		  $p_pic = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
		} else {
		  $p_pic = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
		}
		break;
	  case 'PRODUCT_LIST_BUY_NOW':
		$lc_align = 'center';
		$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
		break;
	}

$product_query = tep_db_query("select products_description, products_id from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$listing['products_id'] . "' and language_id = '" . (int)$languages_id . "'");
  $product = tep_db_fetch_array($product_query);

   	$p_desc = substr($product['products_description'], 0, MAX_DESCR_1);
	$p_id = $product['products_id'];
/*		$list_box_contents[$cur_row][] = array('align' => $lc_align,
										   'params' => '',
										   'text'  => $lc_text); */

}


$info_box_contents[$my_row][$my_col] = array('align' => 'center',
									   'params' => ' style="width:50%;"',
									   'text' => '
	<table cellpadding="0" cellspacing="0" border="0" style="height:264px; background:#FFFFFF" >
		<tr>
			<td>
				<table cellpadding="0" cellspacing="0" border="0" style="height:41px">
					<tr>
						<td>'.tep_image(DIR_WS_IMAGES.'1_q1.gif').'</td>
						<td style="width:100%; background-image:url(images/1_li.gif) " class="vam"><span>'.$p_name.'</span></td>
						<td>'.tep_image(DIR_WS_IMAGES.'1_q2.gif').'</td>
					</tr>
				</table>
				<table cellpadding="0" cellspacing="0" border="0" style="height:213px">
					<tr>
						<td>
							<table cellpadding="0" cellspacing="0" border="0" style="height:120px">
								<tr>
								  <td  align="center">'.$p_pic.'</td>

								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td style="background:url(images/1_line.gif) center top no-repeat;">'.tep_draw_separator('spacer.gif', '1', '1').'</td>
					</tr>
					<tr>
						<td style="padding:10px 20px 0px 20px;">
							<table cellpadding="0" cellspacing="0" border="0" style="height:35px">
								<tr><td>
									'.$p_desc.'</td>																				
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td>
							<table cellpadding="0" cellspacing="0" border="0" style="height:47px">
								<tr>
									<td style="width:45%" class="vam" align="center">'.$p_price.'<br></td>
									<td style="width:55%" class="vam"><a href="'.tep_href_link("products_new.php","action=buy_now&products_id=".$p_id).'">'.tep_image_button('button_add_to_cart1.gif').'</a><br>
									<br style="line-height:4px">
									<a href="' . tep_href_link('product_info.php?products_id='.$p_id) . '">'.tep_image_button("button_details.gif").'</a><br></td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
				<table cellpadding="0" cellspacing="0" border="0">
					<tr>
						<td>'.tep_image(DIR_WS_IMAGES.'1_q4.gif').'</td>
						<td style="width:100%; background: #FFFFFF "></td>
						<td>'.tep_image(DIR_WS_IMAGES.'1_q3.gif').'</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>												
	');

$my_col ++;
if ($my_col > 1) {
  $my_col = 0;
	$my_row ++;
  }
}

new contentBox($info_box_contents); 
//	new productListingBox($list_box_contents);
} else {  ?>



<?php  echo tep_draw_heading_top_1(); ?>


	<table border="0" cellspacing="1" cellpadding="2" class="infoBox box_width_cont">
	  <tr class="infoBoxContents">
		<td>
			<table cellpadding="0" cellspacing="0" class="product">
				<tr><td class="padd_22"><?php echo TEXT_NO_PRODUCTS ?></td></tr>
			</table>
		</td>
	  </tr>
</table>
<br style="line-height:1px;"><br style="line-height:10px;">					
<?php

echo tep_draw_heading_bottom_1();

 }
 if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>

<?php echo tep_draw_result_bottom(); ?>

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

Link to comment
Share on other sites

Well I don't see it in there.

 

Do you have search engine sage url enabled in your admin? If so set it to false.

Are you using one of the seo contribs?

 

I wnt through some of the links on your site and it seems that it is only happening on the advanced_search_result.php page.

 

I did notice there is a problem with the home link on the top left corner. It points to yoursite.com/store/osc/yoursite.com/store/osc. So maybe one more quick check of the config file to make sure. Check the HTTP_SERVER and HTTP_CATALOG. If you hard coded that link redo it using the tep_href function. Should be in includes/header.php.

Link to comment
Share on other sites

Well I don't see it in there.

 

Do you have search engine sage url enabled in your admin? If so set it to false.

Are you using one of the seo contribs?

 

I wnt through some of the links on your site and it seems that it is only happening on the advanced_search_result.php page.

 

I did notice there is a problem with the home link on the top left corner. It points to yoursite.com/store/osc/yoursite.com/store/osc. So maybe one more quick check of the config file to make sure. Check the HTTP_SERVER and HTTP_CATALOG. If you hard coded that link redo it using the tep_href function. Should be in includes/header.php.

 

Hi,

 

I've just looked in the header.php and the code looks ok:

 

<?php echo tep_href_link('http://mysite.co.uk/store/osc/index.php')?>

 

I did have Search Engine Friendly URL's contribution installed, not sure if this the same? So I went ahead and disabled it within admin but I couldn't access any of the products at all, so I enabled it back on... scary...

 

Also checked in the configure.php again and here are the results:

 

  define('DIR_WS_HTTP_CATALOG', '/store/osc/');
 define('DIR_WS_HTTPS_CATALOG', '/store/osc/');
 define('HTTP_SERVER', 'http://mysite.co.uk');
 define('HTTPS_SERVER', 'http://mysite.co.uk');

Link to comment
Share on other sites

Hi,

 

I've just looked in the header.php and the code looks ok:

 

<?php echo tep_href_link('http://mysite.co.uk/store/osc/index.php')?>

Thats wrong. It should be

<?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'includes/languages/english/images/buttons/m1.gif', 'Home') . '</a>'; ?>

 

Well I'm not sure where it is then. I still think it may have something to do with search engine safe urls.

 

If anyone else can help here the problem is on advanced_search_result.php. The details and add to cart button work fine. The product name and the prduct image somehow get an extra " / " added to the url. eg site.com/store/osc// blabla.

 

I checked the form in advanced_search and doesn't seem to be comming from there. Not sure where else to look.

Link to comment
Share on other sites

Thats wrong. It should be

<?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'includes/languages/english/images/buttons/m1.gif', 'Home') . '</a>'; ?>

 

Well I'm not sure where it is then. I still think it may have something to do with search engine safe urls.

 

If anyone else can help here the problem is on advanced_search_result.php. The details and add to cart button work fine. The product name and the prduct image somehow get an extra " / " added to the url. eg site.com/store/osc// blabla.

 

I checked the form in advanced_search and doesn't seem to be comming from there. Not sure where else to look.

 

The search engine friendly url contribution was this one: http://addons.oscommerce.com/info/2796

 

I installed this a full package module, several months ago, so I've started to look through the files which came with it and came across this code within the - includes/classes/url_rewrite.php

 

Here's the code:

 

// Return the converted URL
  if($url_parts['path'] == "/store/osc") $url_parts['path'] = "/store/osc/index";
  return $url_parts['scheme'] . '://' . $url_parts['host'] . $url_parts['path'] . '.html';
}

 

Do you think this is it? Or shall I continue to search through the rest of the files?

 

Thanks again!

Link to comment
Share on other sites

The problem is comming from the stock osc search engine safe urls. I enabled mine and produced the extra " / ". However the product came up when I clecked on it so not sure what is causing yours to fail.

 

Where the problem actualy comes from is when you do not select a manufacturer in the search. Select one and it works fine.

 

For what it's worth, I would get rid of that contrib and set the search safe urls to false. Then get either Ultimate SEO or SEO-G.

Link to comment
Share on other sites

The problem is comming from the stock osc search engine safe urls. I enabled mine and produced the extra " / ". However the product came up when I clecked on it so not sure what is causing yours to fail.

 

Where the problem actualy comes from is when you do not select a manufacturer in the search. Select one and it works fine.

 

For what it's worth, I would get rid of that contrib and set the search safe urls to false. Then get either Ultimate SEO or SEO-G.

 

Thanks again for your help...

 

Which contribution do you think is best for me Ultimate SEO or SEO-G?

Link to comment
Share on other sites

Which ever one you're comfortable installing. I myself use ultimate seo, but as far as I know, seo-g is very good too.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...