Search code examples
e-commerceonline-store

E-Commerce Principles - Show Inventory Dynamically or with static pages?


I am curious regarding this. Is it a better practice to have static html pages displaying the current inventory? This would obviously entail having to manually update these pages when items go in/out of stock, adding new items, etc.

Or is it a more common practice to use dynamic pages to load your store's inventory directly from a database?


Solution

  • If your products never change, and you only have a few products, than you can probably get by without using a database. But if you need to update new products every so often, or if you want to add features like filtering, search, sorting, etc., than having a database is the way to go. It also has the added benefit of organizing your product line in a rational way. If you have more than a dozen products though, you'll want to use a database so that you can code one view that populates according to the product selected. Otherwise, if you want to change the layout, you'll have to do with each product.