The problem is the following table (price) where the goods come with the following values

  1. sell by the piece (unit), in packs, in thousands.
  2. product weight pcs / kg, 1000 pcs / kg, packaging / kg
  3. the price also comes in different ways per piece, 1000 pieces, per package

write to the database in the following form

  1. unit of measure (units) - in which (units / thousand / unitary enterprise)
  2. unit weight
  3. unit price

As you understand, if you sculpt a separate rendering method for each variant, we get the "combinatorial boom". Especially if options are added. To draw dependency tables / read everything to everything, and then substitute the necessary ones with a performance loss.

In other words, we need advice on where to dig, how to deal with it, or which template will help solve this.

Apparently vaguely explained the problem: The thing is that a unit of goods can come in one form (unit of measurement) pcs, the price of 5 thousand pcs is 700r, the weight of goods in another ratio is 2.7 kg per package, the weight either per 1000 or per piece or packaging.

  • it is not clear why the options are needed, you wrote everything. Store units with text / enum, and do not give them any value. There is a unit price (kg, 100pcs, packaging, it does not matter), there is weight. Or is it possible to print packaging for sale? Let's say 10 pencils cost 15 rubles. Can I order 7 pcs.? - vp_arth
  • if there is an opportunity to sell the same product in different forms - you need to start them as different goods. Packages separately, pieces separately. There is such a term as the article, the accounting unit of the goods. - vp_arth
  • one
    If you want a template, then the factory is quite suitable for you - Orange_shadow

0