Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Quote:
Originally Posted by
mikeel100
Price sorter is the sale price...
I see, well I won't be doing that again..
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
The search by date function is broken as well.
In my unmodified cart, I changed the first graphic card due date to a couple of months out and made it zero balance.
It shows up on the Upcoming Products list just fine, but when you search for 03/14/2024 to 05/15/2024, nothing comes back.
It is definitely buggy.
I'll see what I can figure out, but if someone knows the fix for this, I'd appreciate it.
2 Attachment(s)
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
Modifying the includes/modules/pages/search_result/header_php.php file fixed my date search problems and empty breadcrumb issues as well.
Search for "mikeel100" in the attached header_php.zip file and you can see the changes I made.
I also modified includes/init_includes/overrides/init_add_crumbs.php...see the zip file.
Keep in mind, these attached files are from my customized cart where I have added center boxes for All Products, Upcoming, Price Range, Free Shipping, and Best Sellers. All of my center and sideboxes are pulled from a function I developed that totally bypasses modules and modules/sideboxes.
All of the changes I made to these files may not work for you. It's a start though...and I hope it helps someone.
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
This constant, ADVANCED_SEARCH_NEW_PRODUCTS_DATE_FROM, in the init_add_crumbs files has to be in YOUR_TEMPLAGE/lang.english
'ADVANCED_SEARCH_NEW_PRODUCTS_DATE_FROM' => '01/01/1900',
$dfrom = ADVANCED_SEARCH_NEW_PRODUCTS_DATE_FROM has to be set in any link leading to New Products. In my case, it is in my custom function. You should find or put similar code in the modules and sideboxes new products files.
PHP Code:
case ADVANCED_SEARCH_HEADING_NEW_PRODUCTS:
$dto = date('m/d/Y');
if (SHOW_NEW_PRODUCTS_LIMIT == 0) {
$dfrom = ADVANCED_SEARCH_NEW_PRODUCTS_DATE_FROM;
} else {
$dfrom = strtotime ( '-' . SHOW_NEW_PRODUCTS_LIMIT . ' day' , strtotime ( $date ) ) ;
$dfrom = date('m/d/Y', $dfrom );
}
Re: PHP 8.0 - Search function not working properly following upgrade to 1.5.8
In trying fix an issue with the search engine where price from and price to do not go into the text boxes all the time, I've hit a snag that I can't explain and don't understand.
My understanding of the process is that it starts in tpl_search_default.php and uses the $sData values from modules/pages/search/header_php.php...like so.
PHP Code:
$sData['pto'] = (isset($_GET['pto']) ? zen_output_string($_GET['pto']) : '');
For troubleshooting purposes, I changed the above code to the code below...using 1000, '1000', and "1000" at many different points in my testing.
PHP Code:
$sData['pto'] = 1000;
In tpl_search_default.php, line 37, I tested if $sData['pto'] was available and correct...like so.
PHP Code:
<?php print_r('$sData[pto] before sanitizing = ' . $sData['pto'] . '<br>'); //this is not making it's way into zen_draw_input_field('pto', $sData['pto'], 'id="pto"'); below
?>
<div id="searchPriceTo"><label for="pto"><?php echo ENTRY_PRICE_TO; ?></label><?php echo zen_draw_input_field('pto', $sData['pto'], 'id="pto"'); ?></div>
It is available and correct but it is not getting into the text box.
So I moved on to verifying function zen_draw_input_field in the html_output.php file.
Around line 585, I tested for $value ($sData...).
PHP Code:
print_r('VALUE = ' . $value);
$field = '<input type="' . zen_output_string($type) . '" name="' . zen_sanitize_string(zen_output_string($name)) . '"';
if (isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) && $reinsert_value == true) {
$field .= ' value="' . zen_output_string(stripslashes($GLOBALS[$name])) . '"';
} elseif (zen_not_null($value)) {
$field .= ' value="' . zen_output_string($value) . '"';
}
print_r('FIELD = ' . $field . ' | VALUE = ' . $value);
$value is still correct and available but it still isn't inside of the text box...but it should be, right? The empty text box appears at is should...other than being empty.
My confusion comes here while anylizing the above code. Why would you use $name in any part of this if statement below? The goal is to set $field .= ' value=" to the $value...not the $name, right?
PHP Code:
if (isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) && $reinsert_value == true) {
$field .= ' value="' . zen_output_string(stripslashes($GLOBALS[$name])) . '"';
}
So, I changed $name to $value and the text box now has the correct value in it.
Now, I'm reluctant to leave it this way because this function is WIDELY used throughout the programming.
My question, is this a good fix and a BUG?
I have no idea where the search engine NOTIFY system is located nor do I understand how the "watcher class" system works...so I couldn't analyze it.
I would appreciate some insight and help please.