• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to Refine Search Results

#1
[eluser]Arun Kris[/eluser]
Hi All,

Iam having a web application in which after basic search the users should be able to filter the results he obtained using some filters.
For example let the user searched for a motor car. Then a list of motor cars will be displayed. Of these the user should be able to filter the cars based on certain criteria like color, place etc also the count of items under specific criteria should be displayed.

How can I implement this using code igniter

#2
[eluser]pistolPete[/eluser]
[quote author="Arun Kris" date="1257262955"]How can I implement this using code igniter[/quote]

The implementation heavily depends on your database layout, have you specified that yet?

BTW: You should really post what you got already, e.g. database layout, controller / model structure etc. I don't think anyone can / will give you a full featured ready-to-use application..

#3
[eluser]GIN[/eluser]
You can use $_GET in url, or you can make urls like /search/what/search_word/sort/name/color/red/ and in your controller you can parse this url into associate array
Code:
$s['what'] = 'search_word';
$s['sort'] = 'name';
$s['color'] = 'red';
etc.

#4
[eluser]Dam1an[/eluser]
I had to do this not so long ago for a hotel search site not so long ago, and what I ended up with is:
1. Have an array in the session for the filters you want to apply, such as city_id, type_id, max_price etc
2. When you want to get all the items that match the filters (hotels in my case) get all the hotel IDs into an array
3. Use this array as part of a WHERE IN clause for the first filter (city_id)
4. Repeat for all your other filters, refining this array of hotel IDs that match all the criteria
5. Get the relevant data for the remaining IDs and display it

Starting off with a base of 75000+ hotels and filters spanning several tables, it performs really well too Smile

#5
[eluser]wiredesignz[/eluser]
[quote author="Dam1an" date="1257267041"]I had to do this not so long ago for a hotel search site not so long ago...[/quote]
So I guess this was quite recently then.

Welcome back Dam1an.

#6
[eluser]Dam1an[/eluser]
[quote author="wiredesignz" date="1257267610"]
So I guess this was quite recently then.

Welcome back Dam1an.[/quote]

Thanks Smile
Although being busy was only part of the reason for my absence (Heck, I'm still busy)
The main reason being that, moving into my flat 4 months ago, I still don't have internet, so when I do have it, I always seem to have more important things to do


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.