Index: branches/5.2.x/units/orders/order_calculator.php =================================================================== diff -u -N -r14796 -r14872 --- branches/5.2.x/units/orders/order_calculator.php (.../order_calculator.php) (revision 14796) +++ branches/5.2.x/units/orders/order_calculator.php (.../order_calculator.php) (revision 14872) @@ -1,6 +1,6 @@ Application->recallObject('kProductOptionsHelper'); /* @var $opt_helper kProductOptionsHelper */ @@ -557,42 +557,41 @@ $parsed = $opt_helper->ExplodeOptionValues($data); - if (!$parsed) { + if ( !$parsed ) { continue; } - $conv_prices = $parsed['Prices']; - $conv_price_types = $parsed['PriceTypes']; - if ( is_array($val) ) { foreach ($val as $a_val) { - $a_val = kUtil::unhtmlentities($a_val); - - if ( isset($conv_prices[$a_val]) && $conv_prices[$a_val] ) { - if ( $conv_price_types[$a_val] == '$' ) { - $addtion += $conv_prices[$a_val]; - } - elseif ($conv_price_types[$a_val] == '%') { - $addtion += $price * $conv_prices[$a_val] / 100; - } - } + $addition += $this->formatPrice($a_val, $price, $parsed); } } else { - $a_val = kUtil::unhtmlentities($val); + $addition += $this->formatPrice($val, $price, $parsed); + } + } - if ( isset($conv_prices[$a_val]) && $conv_prices[$a_val] ) { - if ($conv_price_types[$a_val] == '$') { - $addtion += $conv_prices[$a_val]; - } - elseif ($conv_price_types[$a_val] == '%') { - $addtion += $price * $conv_prices[$a_val] / 100; - } - } + return $addition; + } + + protected function formatPrice($a_val, $price, $parsed) + { + $a_val = kUtil::unhtmlentities($a_val); + + $addition = 0; + $conv_prices = $parsed['Prices']; + $conv_price_types = $parsed['PriceTypes']; + + if ( isset($conv_prices[$a_val]) && $conv_prices[$a_val] ) { + if ($conv_price_types[$a_val] == '$') { + $addition += $conv_prices[$a_val]; } + elseif ($conv_price_types[$a_val] == '%') { + $addition += $price * $conv_prices[$a_val] / 100; + } } - return $addtion; + return $addition; } /**