A Simple example to show how to calculate price per square meters and then add some options from two dropboxes.
The base price of one square meter is stored in product form as “Price” and then we add the selected option’s price, which is stored in each dropbox option (see the real example in our demo store)

First of all we get entered values in some variables in order to perform calculations.
This is a simple example, but you should read how to improve this formula validating those values to avoid out-of-range values, take a look at http://opencartcfo.com/simple-conditionals/

// Get entered values (all options are required in the product form)
$meWidth = {12V};
$meHeight = {14V};
$meSelectedOptionA = {16P};
$meSelectedOptionB = {17P};

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

// Now calculate final price, and add extra options A and B
$FinalPrice = ($SquareMeters * $Price) + $meSelectedOptionA + $meSelectedOptionB;

You can visit this demo in our Demo Store