X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Search queries via a URL in version 4.0.x!! (https://forum.x-cart.com/showthread.php?t=18488)

BCSE 12-06-2005 07:07 PM

Search queries via a URL in version 4.0.x & 4.1.x!!
 
I know a lot of you need to have links to search results (like the old x-cart versions could). Now you can with this very simple mod!

In search.php (in your main X-cart directory, not in the include folder!) Find the following code:
Code:

x_session_register("search_data");

Insert this code AFTER the code you found above:
Code:

# BCSE begin
if($search)
{
        $search_data['products']['substring']=$search;
        $mode="search";
}
# BCSE end


To use this mod just point your browser to urls like this:
http://yourdomain.com/search.php?search=SEARCHQUERYHERE

If you need spaces in the query to include multiple words use + inbetween like this:
http://yourdomain.com/search.php?search=SEARCH+QUERY+HERE

Hope this helps some of you!

Carrie

Note this works in 4.1.x as well!!

balinor 12-07-2005 11:28 AM

Oooooo....nice! This gets asked for all the time....thanks Carrie!!!

More-Japan 12-07-2005 02:41 PM

Thank you very much! I've been recently testing 4.0.17 and noticed that issue. Perfect!

What would be the syntax for searching in specific extra fields?

swordmart 12-13-2005 06:47 AM

Thx
 
Thx, was just what i was looking for.

More-Japan 12-20-2005 12:28 PM

Anyone have an example of the syntax to properly query an extra fields search that is linkable?

search.php?substring=somekindofsearch

i'm thinking it's adding something like:

&in_extrafields=13??

But I don't know...someone, please enlighten me!

swordmart 12-20-2005 01:14 PM

Just a thought but dont some search engines let you have a file in root dir with a list of URL's? Ive seen this on some search engines, but not sure which ones.

Would it be possable to make a huge list of URL's using the new URL's function so i can have many more links on those search engines?

Not sure if im way of mark, just a thought.
Jamie

More-Japan 12-20-2005 02:43 PM

Are you talking about a sitemap?

if so, sitemaps are common and can be beneficial to help the spiders crawl. I know there are a few sitemap mods floating around here.

Latat 12-07-2006 06:04 PM

Re: Search queries via a URL in version 4.0.x!!
 
Hi,

I've just installed and works well. Is there any possibility to use 'OR' separator word in search (as in google and oscommerce)?

Example: http://www.yourdomains.com/search.php?search=tv+or+radio

This way the search result would show products contains word tv in the product name and products contains word radio in the product name.

Regs,

Laszlo

X-cart Gold, 4.019 Linux

Warwick 01-18-2007 05:40 AM

Re: Search queries via a URL in version 4.0.x!!
 
Nice one Carrie; works in 4.1.3 :)

CobaltCat 01-31-2007 12:09 PM

Re: Search queries via a URL in version 4.0.x!!
 
This works great in 4.1.5, thanks!

How do I set up a URL that will search only the keywords field?

connie 02-14-2007 05:06 AM

Re: Search queries via a URL in version 4.0.x!!
 
I use 4.1.2, why it doesn't work?
It still shows
http://www.domainname.com/shop/search.php?mode=search&page=1

CobaltCat 02-14-2007 06:14 PM

Re: Search queries via a URL in version 4.0.x!!
 
Connie -

The link still shows in the browser the same in a straight search, that doesn't change. It's the URL you use in a link that dictates a search. Take a look at the #1 post here, Carrie gives link examples at the bottom of that post.

connie 02-14-2007 07:11 PM

Re: Search queries via a URL in version 4.0.x!!
 
Thanks for your reply.
The problem is if the search result is more than one page, then the 2nd page link shows
http://shop.com/search.php?mode=search&page=2
I have the problem when first search "monkey" , the page 1 is correct, the page 2 is correct.
Then I search for "rabbit", the page 1 is correct, the page 2 shows monkey's items because the page 2 link is the same http://shop.com/search.php?mode=search&page=2
xcart gives the old searched page

connie 02-15-2007 02:04 AM

Re: Search queries via a URL in version 4.0.x!!
 
I think just post the search result link, then the page 2 can't get search string from METHOD="POST" , how to fix this problem?
Thanks!

connie 02-15-2007 09:17 PM

Re: Search queries via a URL in version 4.0.x!!
 
anybody knows "Search queries via a URL" can also use in search result page 2, page 3 in cart version 4.1.x?

stevekem 02-20-2007 01:05 PM

Re: Search queries via a URL in version 4.0.x!!
 
I am having the same problem with 4.1.3 as well. When I use link:

www.domain.com/search.php?search=widget

and it brings back more than 1 page of results & I then use the same link again but change widget to another item that you know will bring back more than 1 page of results, it skips the first page of results on the second search.

brickholio 03-16-2007 07:56 PM

Re: Search queries via a URL in version 4.0.x!!
 
Did anyone figure out how to fix the multiple page issues for the search strings?

Matt

alru111 04-11-2007 01:50 AM

Re: Search queries via a URL in version 4.0.x!!
 
For paginated results
www.domain.com/search.php?search=widget&page=2
www.domain.com/search.php?search=widget&page=3


To display search substring in the page title :


in skin1/customer/home.tpl

add something like this:
{elseif $mode eq "search"}
{$smarty.get.search}

BCSE 04-29-2007 08:17 AM

Re: Search queries via a URL in version 4.0.x!!
 
Quote:

Originally Posted by brickholio
Did anyone figure out how to fix the multiple page issues for the search strings?

Matt



Anyone still having troubles with this for 4.1.x and multiple pages? It just worked for me on a 4.1.3 site using only the code I posted in the original thread.

Let me know!

Thanks,

Carrie

xcart.com@webguydesign.co 05-21-2007 04:15 PM

Re: Search queries via a URL in version 4.0.x!!
 
How do I get the "search=widget" added to the page links?
Also, search results seem to be off. I have fewer results using this method, than the plain search.

TIA, Jerry

BCSE 05-22-2007 09:09 AM

Re: Search queries via a URL in version 4.0.x!!
 
Quote:

Originally Posted by xcart.com@webguydesign.co
How do I get the "search=widget" added to the page links?
Also, search results seem to be off. I have fewer results using this method, than the plain search.

TIA, Jerry



I'm not seeing any difference in the search results on our test sites. Could you provide an example?

Thanks,
Carrie

xcart.com@webguydesign.co 05-22-2007 09:35 AM

Re: Search queries via a URL in version 4.0.x!!
 
Hi Carrie

Late last night I found he solution, I added this to search.php:


Code:

if($search) {
        $smarty->assign("navigation_script","search.php?search=".$search);
}


just before
Code:

func_display("customer/home.tpl",$smarty);

Maybe my search.php file is different than others, see my sig for version.

Thnks, Jerry


All times are GMT -8. The time now is 09:49 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.