I am currently developing a product page that involves a selection of options that will impact the pricing of the items. The primary option allows users to choose a material, which then influences the available set of options.
Within the database, there is a table containing approximately 2000 rows detailing the final products along with their respective prices. Each row includes product ID, code, price, size, option, and color.
For example:
product_id / code / price / size / option / color
1 ABC 20$ 1 3 5
2 DEF 30$ 2 4 5
3 FFF 30$ 3 4 5
This system functions through AJAX calls, allowing for dynamic price updates based on selected options. Each time an option is changed, a query is made to the database to retrieve the corresponding product and display its price.
In this particular scenario, would it be advisable to fetch the entire list of products initially (as a single query with around 2000 rows), store it as a JavaScript object, and then filter it as needed?
Just to note, I am utilizing MySQL for this project.