Hi, I have the need to build an advance filter/search function.
It needs to be in PHP and pull data from a MySQL table. The table structure is:
id | subject_id | medium_id | size_id | price_id
1 1 2 3 4
2 1 2 3 5
3 1 3 4 2 and so forth
There is a main menu which has multiple categories and dropdowns to multiple subcategories (see attachment-01)
A user can select any subcategory to begin their search. Once they select a subcategory, they are taken to a results page which has a left hand menu showing the subcategories grouped by their category (see attachment-02).
The results page will obviously show only results based on whatever subcategory the user selected (if subject show all results where subject = selected subcategory).
I need the mysql query built to select the records however, the problem here is, a user, once they are on the results page, can select multiple subcategories in the same category group for ALL categories so they query will need to be able to:
SELECT * FROM tbl_name WHERE subject_id = 1 AND medium_id = 1 AND size_id = 2 AND price_id = 3 OR subject_id = 1 AND medium_id = 2 AND size_id = 2 AND price_id = 3 OR subject_id = 1 AND medium_id = 1 AND size_id = 1 AND price_id = 2 OR subject_id = 1 AND medium_id = 3 AND size_id = 1 AND price_id = 1
See my delema? All of this need to be done in a way that if the user hits refresh, the query stays in tack. I was thinking of dumping all the results to the page and then show/hide using jQuery depending on whatever the user selects.
The left menu are href links so these can load a new page with the appended parameters to the current query string.
Basically I need an eBay style filter system. The code written will need to be easily extended as there are many more categories and many many more subcategories.
Confidentiality reasons I cant give too much away but would really appreciate help with this issue.