I’m trying to wrap my head around this topic but can’t find a simple solution.
- product based on region price.
- regions have one currency per region and stock per region.
- then there are product variations like color and size, color should be special cause I need images for it.
- color and size is depending on stock based on the region.
- product has one price per region
Maybe anyone here has a good idea for this db layout.
edit
products
- id
- name
- identifier
- slug
product_variations
- id
- product_id
- name
- size
- image
product_stocks
- id
- count
- product_variation_id
- region_id
product_prices
- id
- product_id
- region_id
- price
regions
- id
- name
- slug
still the size is tied to the variations..
i need one variation with multiple sizes and stock should also be linkable to size based on region
May be something like:
Products:Id.Name.ProductVariations:Id.ProductId.StockId(color and size is depending on stock based on the region)Colour.SizeCurrencies:Id.Name.Stocks:Id.Name.RegionId.Regions:Id.Name.CurrencyId.StockId.ProductPrices:Id.ProductId-> Products table.RegionId-> Regions table.Price.You might need to tweak this structure a little bit to accommodate:
ProductImages).Update:
In this case you can move
ColourandSizeor thesizeonly as you want to a new table, something like,ProductVariationOptions:ProductVariationOptions:Id.Size.Colour.Then the your
ProductVariationOptionswould be like this:ProductVariations:Id.ProductId.StockId(color and size is depending on stock based on the region)ProductVariationOptionsId->ProductVariationOptions