Jump to content

Search Term failing when 2 terms used, on pagination


Recommended Posts

Hello,

i think i posted this in the wrong forum the other day so please delete that one as i cant see how to.

I have been experiencing a problem with the search in 2 shops i run using prestashop.

 

The search works fine when one word is used... however when 2 words are used the search works for page 1 , but then the pagination shows a page not found.

 

I have found the problem being that the 2 search terms are getting a + between them where the space should be

 

search?controller=search&orderby=position&orderway=desc&search_query=search+term

 

if i replace this to 

 

search?controller=search&orderby=position&orderway=desc&search_query=search&20term

 

pagination works fine...

I also found this is only happening now since friendly urls are turned on.

 

So i was wondering what is removing my space in the search and replacing it with a +

I have found this in searchengine.php line 62

 

$str = urldecode(str_replace('+', ' ', ltrim(substr(rtrim($array[0], '&'), strlen($varname) + 1), '=')));

 

i thought this could be it? but it doesnt seem to change anything.

 

so then i looked at what i could do to make the search url work without changing the +

i was finding that it wasnt putting in controller=search at the front only

search?&orderby=position&orderway=desc&search_query=search+term

 

if i add controller=search? before the url it works fine... so i was thinking do i need to define something in .htaccess... so i tried this:

RewriteCond %{QUERY_STRING} ^(.*)search?orderby=position(.*)$
RewriteRule /search /search?%1controller=search&orderby=position%2 [QSA,L]
 
so i was trying to replace anything that had search?orderby=position with search?controller=search before it...
but it wouldnt work and when i turned off caching and tried it was giving me compilation errors in smarty which i cant understand.

 

please help... replacing the + with a _ would be the easiest option for me now!

Oliver

 

Server information: Windows NT build 7600 (Windows Server 2008 R2 Standard Edition) i586

Server software version: Microsoft-IIS/7.5

PHP version: 5.4.32

Memory limit: 256M

Max execution time: 60

Database information

MySQL version: 5.1.56-community

MySQL engine: InnoDB

Tables prefix: prstshp_

Store information

Prestashop version: 1.5.3.1

Link to comment
Share on other sites

×
×
  • Create New...