I'm setting up an ecommerce site where PHP code looks up products' prices in a MySQL database and displays them on the page accordingly. The site also includes a CMS where the admin can update the database information (change prices, add new products, etc).
It all works OK, but now I've come up against a conceptual stumbling block concerning price options – the way prices can vary according the user's choice of certain options for a product. For instance, a product may have a different price if in "large" size, or if "with gold finish" – or a different price again if say "extra large" AND "gold finish".
I'd be grateful for any tips and advice as to the rationale of building such options into a database so that they can be (a) retrieved and displayed in pages, and (b) inserted in a 'CMS' so that a user can create a fair number of price options.
At first I thought that one approach would be to have different "products" for each different combination of all the price options for a true product entity, but I thought that this approach would make inserting records in a CMS awkward.
How far is any appropriate method usually tailored to the individual site? Is it always very dependent on the values that are likely to fill the particular database, or are there global approaches that meet many scenarios?
Thanks in advance for any tips or pointers to resources.