Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Search Problem


Guest

Recommended Posts

Posted

Hey everyone,

 

I have a bit of custom code for the search box and can't seem to get it to work properly. In fact, when you type a keyword into the field and click enter, it brings up the advanced search page but does not actually search the catalog.

 

Anyway, here is the code. Is there anything obvious that I am missing ?

 

<li><?php

echo "<form name=advanced_search method=post action=../advanced_search.php >";

echo "Search: <input type=text name=keywords size=15>";

echo "<input type=submit value=go >";

echo "</form>"; ?></li>

<li><a href="<?php echo tep_href_link('index.php')?>"><? printf(BOX_MANUFACTURER_INFO_HOMEPAGE,"")?></a></li>

<li><a href="<?php echo tep_href_link('products_new.php')?>"><?php echo BOX_HEADING_WHATS_NEW?></a></li>

 

Any suggestions would be appreciated.

 

 

Chris

Posted

Hey everyone,

 

I have a bit of custom code for the search box and can't seem to get it to work properly. In fact, when you type a keyword into the field and click enter, it brings up the advanced search page but does not actually search the catalog.

 

Anyway, here is the code. Is there anything obvious that I am missing ?

 

<li><?php

echo "<form name=advanced_search method=post action=../advanced_search.php >";

echo "Search: <input type=text name=keywords size=15>";

echo "<input type=submit value=go >";

echo "</form>"; ?></li>

<li><a href="<?php echo tep_href_link('index.php')?>"><? printf(BOX_MANUFACTURER_INFO_HOMEPAGE,"")?></a></li>

<li><a href="<?php echo tep_href_link('products_new.php')?>"><?php echo BOX_HEADING_WHATS_NEW?></a></li>

 

Any suggestions would be appreciated.

 

 

Chris

 

The fundamental problem is that it should be a get form method and not post.

 

The following works if saved as a standalone PHP file in osCommerce root.

 

<?php include_once 'includes/application_top.php' ?>
<div style="padding: 1em;">
<?php
echo ' <form name="advanced_search" method="get" action="' . tep_href_link( FILENAME_ADVANCED_SEARCH_RESULT ) . '">' . PHP_EOL .
	'	Search: <input type="text" name="keywords" size="15">' . PHP_EOL .
	'	<input type="submit" value="go">' . PHP_EOL .
	' </form>' . PHP_EOL .
	' <div><a href="' . tep_href_link( FILENAME_DEFAULT ) . '">' . sprintf( BOX_MANUFACTURER_INFO_HOMEPAGE, "" ) . '</a></div>' . PHP_EOL .
	' <div><a href="' . tep_href_link( FILENAME_PRODUCTS_NEW ) . '">' . BOX_HEADING_WHATS_NEW . '</a></div>' . PHP_EOL;
?>
</div>
<?php include_once DIR_WS_INCLUDES . 'application_bottom.php';

 

Hope that helps Chris

 

Rob

Posted

Hi Robert,

 

Although that helped with the functionality of the search box, it really messed up the template. I will have to tweak it to see if I can't get it to look as well as it works.

 

 

Thanks again

 

 

Chris

Posted

Hi Robert,

 

Although that helped with the functionality of the search box, it really messed up the template. I will have to tweak it to see if I can't get it to look as well as it works.

 

 

Thanks again

 

 

Chris

 

I didn't bother considering the basic HTML. It is just a form within a div.

 

The original code was invalid so I just wrapped it.

Archived

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

×
×
  • Create New...