i want to add some data into a table for cms, the data’s output on the frontend is as this:
one year $100
two years $260
three years $350
500 accounts $360/m
1500 accounts $660/m
2500 accounts $960/m
the backend is a form. the price part is inputted by the editor. i want to put the 100,260,350….namely, the price part into a table. but i don’t know how design the table. how to make each price have a relationship with the front label.then in my programme i can invoke them.
The label (product name) and price are obviously related, just like any other product and its price. I would simply make a table called products, which would have the columns ‘id’, ‘product’, ‘price’. Then I’d populate the table with the following:
I’d then let the backend editor simply give admins access to edit that table, and have the frontend to simply list the content of the table.
If the ‘year’ prices are a different type of product that then ‘account’ prices, then i’d consider a ‘category’ column in the ‘product’ table where you could differentiate between products’. So, if you just would like to list ‘year’ prices, you could filter on the ‘category’ column.
Anyway, I’d skip “hardcoding” the labels on the frontend and only store the prices. I’d rather keep the labels and prices together so that it is easier to change. It is so much easier to change the day you would like to introduce a new price level or change an existing one.