Abstract
This is a simplified case of an actual product of our store, those are some of the details.
Customers can:
– Enter free width and height in centimeters (with size limitation).
– Select different materials, each one have a price per square meters.

How to detect selected option in a select box for “materials”
This is the first issue, you can use the price of each material but OpenCart will show them at the right of each option.
We cannot use the code below to detect the text in the selected option because, if languague chages or if you accidentally edit the name of the option, your formula will fail.
Let’s say “materials” is option_id {12}

```...
if({12}=="PVC Banner 340 g") {
// Do something
}
...
```

Using the selected index is also not a good idea, because you can accidentally change the order of the options.
So we are going to use a trick to achieve this, we are going to use the field “Points” of each option to store a number and we will indentify each option with that index in the formula.

```...
if({12S}==2) {
// Do something
}
...
```

If you don’t know how to use “Points” please read Price, Quantity, Value, Weight, Points…

```//
// Get entered values (all options are required)
\$meWidth = {12V};
\$meHeight = {14V};
\$meSelectedMaterial = {16S}; // "Points Trick"

//
// Calculate square meters as values are asked in centimeters
\$SquareMeters = (\$meWidth/100) * (\$meHeight/100);

//
// Select price per square meters given the material
switch(\$meSelectedMaterial) {
case "1":
//
// PVC Banner 280 g (Anti Curling)
\$mePricePerSQM = 25;
break;
case "2":
//
// PVC Banner 340 g
\$mePricePerSQM = 28;
break;
case "3":
//
// PVC textured Canvas 380 g
\$mePricePerSQM = 33;
break;
case "4":
//
// Fabric polyester 120 g
\$mePricePerSQM = 38;
break;
default:
//
// Error? (Of course you need to solve and not show to customer)
\$mePricePerSQM = 0;