marco-pm / zencart_instantsearch

Instant Search plugin for Zen Cart
GNU General Public License v3.0
2 stars 4 forks source link

ajax return of post resulting in http 500 error. #6

Closed proseLA closed 3 years ago

proseLA commented 3 years ago

i have a vanilla dev box running v158. i am getting a 500 error on the post. see:

image

sorry my javascript/jquery debugging is not better.

i tried this on on a v157c dev box that i have running as well. i am getting an error at the same point, although in this case, the return is a 400 (Bad Request). on that box, the i'm running jquery 1.11.1.

the out of the box vanilla v158 runs jquery 3.5.1.

would love to help with this plugin, as i see good potential.

best.

marco-pm commented 3 years ago

For the v157c I think the problem may be the old jquery version.

For both environments (157c and 158) please let me know:

proseLA commented 3 years ago

actually, i made a small error in the 157c install. i had the zcAjaxInstantSearch.php in includes/classes as opposed to includes/classes/ajax. moving it there provides the same http response. and now, of course, i am getting debug files (previously not)

PHP Parse error: syntax error, unexpected 'fn' (T_STRING), expecting :: (T_PAAMAYIM_NEKUDOTAYIM) in /var/www/zcdev/includes/classes/ajax/zcAjaxInstantSearch.php on line 95.

php version is 7.3.27

happens on all searches.

proseLA commented 3 years ago

looks like it might be a minimum of php 7.4. i will confirm....

proseLA commented 3 years ago

yeah, that's confirmed (and right on your readme). will not work without code changes.

my next issue will be better.

proseLA commented 3 years ago

changing this: https://github.com/marco-pm/zencart_instantsearchplus/blob/b10c7f68e78e20907c1081344d29a519d25cd272/INSTALL/includes/classes/ajax/zcAjaxInstantSearch.php#L95-L99

to:

                usort($results, static function($prod1, $prod2) {
                    [$prod2['mtch'], $prod1['fsum'], $prod2['views']]
                    <=>
                    [$prod1['mtch'], $prod2['fsum'], $prod1['views']];
                    }
                );

would make it compatible with php7.3.

considering one has to add sury repos to a debian install to get to php7.4, i would think that making it 7.3 compatible is not a bad idea.