I'm creating a webshop where I want to show a set of products based on what car is selected, as an addition to the regular product groups.
I now have several tables:
product
group
car_make
car_model
car_filter
session_car_filter
The session_car_filter table have the following coloumns:
car_make, car_model, car_year and session_id
The car_filter table have:
car_make, car_model, from_year, to_year, product_id
The product table have:
product_id, group_id, universal
The group table have
group_id
Now I want to make my website set one or several rows in the session_car_filter which is all good. The filters in the session must match up with the car_filter table and based on that show the products that is ment for this car only. AND if the product has "universal=1" in the table it should show no matter what the filters says. So I want to show all products with universal=1 and the products that match up with the filters.
Don't know if I've explained it good enough, but I've tried playing with joins over and over, but can't seem to figure it out.
Any good ideas?