Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

263
Visualizações
E-commerce Database design: Products with optional variations and scaled prices

For a client, I'm trying to build a minimal e-commerce system. It's going to have products which may have variations (think S, M, L) and every variation may have a scaled price system depending on the amount the client orders:

  • 1 shirt, size L = 10 EUR each
  • 5 shirts, size L = 9 EUR each
  • 1 shirt, size S = 8 EUR each
  • 5 shirts, size S = 7 EUR euch

But there may also be products without variations and a fixed price:

  • n pullovers = 50 EUR each

And products which have no variations but a scaled price system:

  • 1 trouser = 100 EUR each
  • 5 trousers = 90 EUR each

I was thinking about the following db schema:

products

  • id
  • description
  • ...

product_variations

  • id
  • product_id
  • variation_id (table with all possible variations: color, size, etc.)
  • value (l, m, red, green)

product_prices

  • id
  • product_id
  • product_variation_id (can be null, if the price is for the product, not a variation)
  • priceNet
  • tax
  • qualify_amount (minimum number of items the customer has to order to qualify for this price, defaults to 1)

Is it okay to make product_variation_id nullable to achieve the wanted flexibility in combinations between prices and variations without having to add at least one (standard) variation for every product (when the product doesn't have variations)? Any better ideas? :)

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda