Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

keyword filters for search box


Guest

Recommended Posts

Posted

presently, if you sell a lot of products with the name 'widgets' and if you have a large inventory, somebody using the keyword 'widget' will cause a database connection error.

 

is it possible to add a filter to disallowed keywords?

Posted

nobody's ever knocked their site down by typing an overly common term??

Posted

1) perhaps you are missing a few indexes to speed up the queries ?

2) perhaps you could limit results ?

 

btw how many products do you have ?

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Posted
1) perhaps you are missing a few indexes to speed up the queries ?

where should the indexes be created and how does one create them?

 

2) perhaps you could limit results ?

how could this be achieved

 

btw how many products do you have ?

1654, not counting offline products.

Posted

For a quick fix, I'd do something like

if ($keywords == 'widgets') {
 $error = true;

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

although I'm pretty certain that that code isn't going to work without some tweaking because my brain's corpsified today. Long-term, I'd probably prettify it up with a sql query to the database and store the list of disallowed words in the database.

Always BACK UP your files and your database before making any changes. Before asking questions, check out the Knowledge Base. Check out the contributions to see if your problem's solved there. Search the forums.

 

Useful threads: Store Speed Optimization How to make a horrible shop Basics for design change How to search the forums

 

Useful contributions: Easypopulate Fast, Easy Checkout Header Tag Controller

Posted

where would i put this? i tried putting it beneath

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

in advanced_search_results.php and it just let it search

Posted

Yeah, it hasn't defined the keyword yet. I'd try placing it after

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

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

 

I'm guessing that'll work better.

Always BACK UP your files and your database before making any changes. Before asking questions, check out the Knowledge Base. Check out the contributions to see if your problem's solved there. Search the forums.

 

Useful threads: Store Speed Optimization How to make a horrible shop Basics for design change How to search the forums

 

Useful contributions: Easypopulate Fast, Easy Checkout Header Tag Controller

Posted

excellent. seems to have done the trick :)

 

now how can i add multiple terms?

i tried:

if ($keywords == 'widgets','poop') {
 $error = true;

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

and just got a parse error

Posted

if ($keywords == 'widgets' || $keywords ==  'poop') {
 $error = true;

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

 

Try that.

Always BACK UP your files and your database before making any changes. Before asking questions, check out the Knowledge Base. Check out the contributions to see if your problem's solved there. Search the forums.

 

Useful threads: Store Speed Optimization How to make a horrible shop Basics for design change How to search the forums

 

Useful contributions: Easypopulate Fast, Easy Checkout Header Tag Controller

Archived

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

×
×
  • Create New...