Post by chris.dempsey » Thu Feb 08, 2018 12:31 am

Environment
  • OC 2.3.0.2
  • VQmod 2.6.2
  • PHP 5.6.3.3
  • Default Template
I am convinced the Search function worked previously but it now returns no results when searching product names either for exact or partial match. This occurs whether the search term entered in the search bar on header or on search page. Same behaviour if search submitted by mouse click or enter button.

UPDATE: the site originally ran on OC 1.5 and, if I remember correctly, was updated to 2.3.0.2 using the regular install process.

Example searches are
  • Cutting Knife (exact product name)
  • Brush (partial product name)
Stuff I've tried to resolve
  • There are no search related extensions installed and I have uninstalled all other extensions and OCmod and VQmod modifications
  • I've tried all flavours of PHP available on the server from 5.4 through to 7.0
  • No errors are logged either by PHP. OCmod or VQmod
  • I can't find anything to help in Google and Forum searches or in GitHub issues
  • One thread I found suggested database user permissions. My user has the full set of Structure and Data access permissions
  • I cleared /system/storage/cache and /vqmod/cache manually after each adjustment to settings
  • Replaced all the core files with the originals from the install process in case any were accidentally changed
Can anyone suggest what might be causing the issue?

Staging site is available at http://oc2.allscotltd.co.uk

Thanks,

Chris

EDIT: post updated with site url and more development history
Last edited by chris.dempsey on Thu Feb 08, 2018 9:17 pm, edited 4 times in total.

New member

Posts

Joined
Wed Apr 04, 2012 6:43 pm

Post by simonpieman » Thu Feb 08, 2018 2:19 am

Does the page switch to the results page. but empty?or does it not change?

Go the All Blacks!


Active Member

Posts

Joined
Thu Jul 02, 2015 8:58 am
Location - NZ - Auckland

Post by chris.dempsey » Thu Feb 08, 2018 2:33 am

Posts to results page /index.php?route=product/search&search=Brush

Displays default no results message:

Products meeting the search criteria
There is no product that matches the search criteria.

Any ideas?

New member

Posts

Joined
Wed Apr 04, 2012 6:43 pm

Post by chris.dempsey » Thu Feb 08, 2018 2:36 am

Should also mention site is on staging server with password protection.

Could make public if it would help.

New member

Posts

Joined
Wed Apr 04, 2012 6:43 pm

Post by paulfeakins » Thu Feb 08, 2018 6:40 pm

This should serve as an example of how to request help on the forum, lots of info, great description and a list of what you've already tried!

And yes I think providing a link would help ...

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by chris.dempsey » Thu Feb 08, 2018 6:53 pm

Staging site is available at http://oc2.allscotltd.co.uk

New member

Posts

Joined
Wed Apr 04, 2012 6:43 pm

Post by chris.dempsey » Thu Feb 08, 2018 7:03 pm

Original post updated with a few more details.

New member

Posts

Joined
Wed Apr 04, 2012 6:43 pm

Post by paulfeakins » Thu Feb 08, 2018 7:06 pm

If you trace the execution path through the controller that's responsible for search, what do you find? Is it getting to the right function? Is it performing the query? Is any data being returned? Is that data being passed to the view?

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by chris.dempsey » Thu Feb 08, 2018 7:19 pm

Will attempt to do this, not sure of the process though. Usually I can work backwards from the error log but all I got right now is silence.

Side note, another thing I tried yesterday was replacing all the core files with the originals from the 2.3.0.2 install process in case any were accidentally changed. Obviously no joy.

New member

Posts

Joined
Wed Apr 04, 2012 6:43 pm

Post by paulfeakins » Thu Feb 08, 2018 7:26 pm

Ok so you can see from the URL:
index.php?route=product/search&search=colour

We're on the front-end so we're looking in /catalog/
Everything goes through a controller so we're looking in /catalog/controller/
The route is product/search so we're looking in /catalog/controller/product for a file called search.php
There is not a third part of the route, so we're looking at the default method which is always "index()"

Now start tracing things in here by dumping out variables to see where it's getting to and with what data.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by chris.dempsey » Thu Feb 08, 2018 8:04 pm

Sorry, when you said trace I thought you meant in an IDE or Xdebug.

Dumping $search returns empty so $this->request->get['search'] is not seeing the &search parameter in the query string...

New member

Posts

Joined
Wed Apr 04, 2012 6:43 pm

Post by paulfeakins » Thu Feb 08, 2018 8:15 pm

Nothing fancy here, just good old fashioned stepping through the code by hand ;)

So it looks like that's your problem, for some reason the URL variables aren't getting in to OpenCart's request variable.

What happens if you dump $_GET["search"] ?

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by chris.dempsey » Thu Feb 08, 2018 8:27 pm

echo $_GET['search']; returns
Undefined index: search

echo print_r($_GET); returns

Array
(
[route] => product/search
)
1

URL definitely has search parameter in query string: /index.php?route=product/search&search=brush

New member

Posts

Joined
Wed Apr 04, 2012 6:43 pm

Post by chris.dempsey » Thu Feb 08, 2018 9:14 pm

<Punches self in face repeatedly>

It was a badly written rewrite rule in the web server config file.

Thanks Paul

New member

Posts

Joined
Wed Apr 04, 2012 6:43 pm

Post by paulfeakins » Thu Feb 08, 2018 9:48 pm

Ah ha, good find, happy to help :)

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Guru Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom
Who is online

Users browsing this forum: No registered users and 183 guests