Distribution by product definition is similar to the by amount distribution, the only difference being that line weights are used. When the additional amount has Based On Lines = True, the distributional coefficients are multiplied by the lines' weights.
The only difference is in the following calculation formula:
[ki] = ([ki] + [line amount i]) * [line weight i].
In addition to Example 3 from Percent value calculation, there's an additional amount commission with input percent of 5 and three lines (line #10 for 150 EUR, line #20 for 40 EUR and line #30 for 69 EUR) which have the following weights:
line #10: weight = 0.00;
line #20: weight = 1.00;
line #30: weight = 1.00.
The commission amount is 5.45 EUR and its distribution is calculated by the following coefficients:
[k1] = [line amount #10] * [line weight #10] = 150 * 0.00 = 0;
[k2] = [line amount #20] * [line weight #20] = 40 * 1.00 = 40;
[k3] = [line amount #30] * [line weight #30] = 69 * 1.00 = 69.
The amount of 5.45 EUR is distributed in 40:69 ratio as follows:
[line #10 commission] = 5.45 EUR * 0 / 109 = 0 EUR;
[line #20 commission] = 5.45 EUR * 40 / 109 = 2 EUR;
[line #30 commission] = 5.45 EUR * 69 / 109 = 3.45 EUR.