Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Advanced Search Error, code looks fine


sidewinder

Recommended Posts

Hello,

 

been testing price searching criteria, and when I enter two equal prices, I get an error which states:

 

Price To must be greater than or equal to Price From.

 

I have checked through the code, and the only piece of code I can see looks fine...

 

catalog/advanced_search.php

 

if ( (pfrom.length > 0) && (pto.length > 0) ) {

if ( (!isNaN(pfrom_float)) && (!isNaN(pto_float)) && (pto_float < pfrom_float) ) {

error_message = error_message + "* <?php echo ERROR_PRICE_TO_LESS_THAN_PRICE_FROM; ?>\n";

error_field = document.advanced_search.pto;

error_found = true;

}

}

 

ALTHOUGH, I have completly removed this code, then uploaded the file, refreshed, and I still get the error so I am a little confused..

 

if I enter say 500 to 501 it works, if I enter 500 to 500 it throws the error...

 

I tried it here

 

http://workshop.hetton-salvage.com/advance...rom=500&pto=500

and as you can see from the url, it sends the right prices....

 

heeeeellllppppp, I am going insane...

 

J.

Link to comment
Share on other sites

found the fix to this myself, wasn't looking in the right place, was in

catalog/advanced_search_result.php

 

code to amend if you have this issue is:

around line 100 (on mine anyway)

 

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);

}

}

 

 

obviously

 

if ($pfrom >= $pto) {

 

is incorrect, it should be

 

if ($pfrom > $pto) {

 

this may help others out...

 

happy days.... :D

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...