Forum Moderators: coopster

Message Too Old, No Replies

Create 'refine products' criteria based on results

         

hawk777

1:49 am on Jun 14, 2009 (gmt 0)

10+ Year Member



Hi,
I need to know how you could create a 'Refine Search' criteria based on the search results, much like the 'Choose products' option on the left of this page:
[ciao.co.uk...]

I have a website using PHP5/MySQL with similar products and when a user searches for say 'macs' I need to say 'Your search results contain 5 products with 4 GB memory, 7 products with 2 GB memory' etc. These criteria needs to be based on the results so if a search does not yield any results with 4 GB memory then that refine option won't come up.

I would be grateful if someone could tell me how I can produce this 'refine criteria' based on the search results. The only option I can think of is running multiple COUNT queries but that's not a very efficient way.

-Dan

jatar_k

11:41 am on Jun 15, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld hawk777,

they could be predefined, if you want to count things then at some point you need to run a count() but maybe you only need to do it once a day, or a couple times a day, and store the results

So the criteria for drill down would be decided ahead of time, not random. Maybe they look at the most popular searches and use that data to create standard refine criteria.

just a guess but as you say, if they did those queries every time it would be pretty intensive. Maybe thy could use views for those as well, but that would be a lot of extra tables if there are a lot of criteria.

hawk777

4:57 pm on Jun 15, 2009 (gmt 0)

10+ Year Member



Hi jatar_k, thanks for the warm welcome.

So it seems it's more complicated than it seems. I guess what you mean is that they cache the results and use from that cache.

Is there no other way at all to do this 'live/dynamic' like maybe add the results to an array (mysql_fetch_array) and do an array_count_values or something like that?

jatar_k

5:29 pm on Jun 15, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



sure, that would be a good solution, or use a couple of counters as you are going through the results.

The only problem is, with out doing specific count queries it would force you to process all the results.

A couple of count queries for some predefined criteria that you decide on might be just fine.