Custom calcs is an optional plugin that can be used to calculate a complex manufacturing cost, using all sorts of interesting formulas.
See below an example screenshot for the "making of curtains" that would be used along side a chosen "material" (fabric).
The customer is asked to choose a "pleat style" and "width" and "height" dimensions.
These choices are saved in a "variable name", and those variables become available to the calculations thereafter.
The pricing steps happen in order from top to bottom.
Depending on the type of a step, it may lookup a value, calculate a value, or output a value to be visible to the customer. eg in this case we want the customer to know how much material is consumed. If the material is unknown, we set a default minimum width of 900 for the unknown fabric roll.
The pleat style is convered to 2 different multipliers. One is to determine how much more fabric will be consumed to generate the fullness of the pleat style. The other factor is to consider how much manufacturing/sewing effort will occur.
Once we know the basic dimensions and factors, we can start to calculate the derived variables.
The Drops required is output to the cart, so that the customer can consider if the pleat style or dimension has pushed them to an extra drop. Each extra drop consumes much more fabric.
Once we know the material consumption, we can set the quantity of that item, assuming the fabric is in our cart already (and we have standard approaches to make that possible)
The total cost of manufacture can be used to generate a cost on top of the base unit price, or to override the unit price. In this case, we want the manufacturing priced from: $100. Therefore we are reseting the line item price to be the greater of the cost of manufacture, or 100.. Rather than adding the manufacture cost on top of the $100, which is possible depending on your scenerio.
We also set a special variable called "showCalcDebug". If this variable exists, and has a positive number assigned, then we will output a detailed table showing all the calcs, so that you can work through any debugging issues while you setup your perfect manufacturing product.
MaterialWidthMM | 900 | Equation | greatest(900,material_width * 10) | |
PleatStyleMaterialFactor | 1.2 | Lookup Simple | PleatStyle | |
PleatStyleMakingFactor | 15 | Lookup Simple | PleatStyle | |
TotalWidthRequiredMM | 2700 | Equation | ( WidthMM * PleatStyleMaterialFactor ) + 300 | |
DropsRequired | 3 | Output Result | CEIL(TotalWidthRequiredMM / MaterialWidthMM ) | |
MaterialHeightMeters | 1.2 | Equation | (HeightMM + 200)/1000 | |
MaterialUsageMeters | 3.6 | Set Material Quantity | DropsRequired * MaterialHeightMeters | |
Material Required | 3.6 | Output Result | MaterialUsageMeters | |
TotalCostManufacture | 100 | Set Total Unit Price | greatest(PleatStyleMakingFactor * MaterialUsageMeters,100) | |
showCalcDebug | 1 | Equation | 1 |
There are several lookup approaches.
Converts an answer from a known option list (eg a combo box, button set), into a value for use in calculations. It's very important that your lookup variable is named exactly the same as the equation variable. The result of the lookup will be saved as the "Save variable". Often lookups are used for multiplication factors. If you are using multiplication factors, consider setting the default value to 1, or something that will work if you accidently add options to your option list, but forget to set a multiplication factor.
A lookup table needs 2 variables to check, and these are specified in the equation area separated by a comma. The first value finds a row based on the left column of the table. The second value is finds the desired column based on the value in the top row. It should be noted that the exact match search requires that the row or column values are found successfully, using an exact ext search. So it is possible to search for text...
eg
Equation=RodStyle,RodSize
Equation=B,12
Result = 9
10 | 12 | 16 | |
A | 5 | 6 | 7 |
B | 8 | 9 | 10 |
C | 12 | 13 | 14 |
This works very similar to the lookup table above, however, the variables specified are assumed to be numbers.
The nearest search will find the column or row with an equal or lessor value.
The assumption is that customer values will be "rounded up" to the nearest value.
eg
equation=height,width
equation=190,2200
result = 100
1000 | 2000 | 3000 | |
100 | 50 | 60 | 70 |
200 | 80 | 90 | 100 |
300 | 120 | 130 | 140 |
Most often a customer might fetch their tabular data from excel. Take care with some data sources that formatting may create too much hidden code, and the table won't save properly. Tip: remove all formating from the table prior to pasting it. Or use the cleanup buttons on the toolbar to tidy up the table prior to saving. You can also copy and paste HTML tables from websites, or anything that produces a table in the pasting area.