Let me preface this by saying I know I used the word "product" in the title despite this being about "services", I feel the concept and what I'm trying to implement is the same as the approach for product options and every one can relate easier than if I were to use "service options" in the title.
I'm building a database for my new auto repair business' website. I'm struggling with a way to store options for the various services I offer. For example:
A customer goes online and asks for the front brake calipers to be replaced. In this scenario the service is "Brake Caliper Replacement" and the service option is "Front". I store these in a table:
Services
| ID | Service Name |
----------------------------------
| 1 | Brake Caliper Replacement |
| 2 | Oil Change |
I have a second table that stores all of the potential options for each service and indicates if the option is required or optional. I use these fields on the site during the quote process to make sure that they pick one of the options that are required.
Service Options
| ID | Service_Id | Service Option | Required | Optional |
----------------------------------------------------------
| 1 | 1 | Front | 1 | 0 |
| 2 | 1 | Rear | 1 | 0 |
| 3 | 1 | Pad Replacement| 0 | 1 |
Now when they fill out the rest of the quote and select the service with the options they want, I'm struggling with how to store the relationships.
Here's how I currently have it setup:
Quote
| ID | Customer Id | Vehicle Id |
---------------------------------
| 1 | 1 | 2 |
Quote Service
| Quote Id | Service Id | Service Option Id |
---------------------------------------------
| 1 | 1 | 1 |
| 1 | 1 | 3 |
| 1 | 2 | null |
Not all services will have required or optional options though. But I'm trying to determine the best way to store all of this data for generating quotes. Can anyone provide some assistance on if this design makes sense or perhaps a different way of looking at things that I may not have thought of?