Индикация цен опций товара заменена на абсолютную величину (вместо разницы +X руб, -Y руб)

Рецепт ниже.

Вообще-то применять такое изменение можно только в том случае, если ваши товары имеют всего один набор опций, влияющих на цену.

commit 92114e01f55e00e4f1882302e5e7f6b7b1d638e5
Author: Ruslan Brest <rb@labtodo.com>
Date:   Fri Sep 2 17:55:44 2011 +0300
    re #725: Индикация цен опций товара заменена на абсолютную величину (вместо дельты: +X руб, -Y руб)
diff --git a/public_html/catalog/controller/product/product.php b/public_html/catalog/controller/product/product.php
index 5e4bba7..deb52e0 100644
--- a/public_html/catalog/controller/product/product.php
+++ b/public_html/catalog/controller/product/product.php
@@ -252,12 +252,28 @@ class ControllerProductProduct extends Controller {
                    
                    foreach ($option['option_value'] as $option_value) {
                        if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) {
+                           if( $product_info['price'] )
+                           {
+                               $option_value['price_full'] = $product_info['price'];
+                               if( $option_value['price_prefix'] == "+" )
+                                   $option_value['price_full'] = $product_info['price'] + $option_value['price'];
+                               if( $option_value['price_prefix'] == "-" )
+                                   $option_value['price_full'] = $product_info['price'] - $option_value['price'];
+
+                               $option_value['price_full'] = $this->currency->format(
+                                   $this->tax->calculate(
+                                       $option_value['price_full'],
+                                       $product_info['tax_class_id'],
+                                       $this->config->get('config_tax')
+                                       ));
+                           }
                            $option_value_data[] = array(
                                'product_option_value_id' => $option_value['product_option_value_id'],
                                'option_value_id'         => $option_value['option_value_id'],
                                'name'                    => $option_value['name'],
                                'price'                   => (float)$option_value['price'] ? $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))) : false,
-                               'price_prefix'            => $option_value['price_prefix']
+                               'price_prefix'            => $option_value['price_prefix'],
+                               'price_full'              => $option_value['price_full'],
                            );
                        }
                    }
@@ -568,4 +584,4 @@ class ControllerProductProduct extends Controller {
        $this->response->setOutput(Json::encode($json));      
    }
 }
-?>
\ No newline at end of file
+?>
diff --git a/public_html/catalog/view/theme/default/template/product/product.tpl b/public_html/catalog/view/theme/default/template/product/product.tpl
index e7cbf6a..b28db8e 100644
--- a/public_html/catalog/view/theme/default/template/product/product.tpl
+++ b/public_html/catalog/view/theme/default/template/product/product.tpl
@@ -69,7 +69,8 @@
             <?php foreach ($option['option_value'] as $option_value) { ?>
             <option value="<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
             <?php if ($option_value['price']) { ?>
-            (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
+            <!-- (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>) -->
+            (<?php echo $option_value['price_full']; ?>)
             <?php } ?>
             </option>
             <?php } ?>
@@ -87,7 +88,8 @@
           <input type="radio" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" />
           <label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"><?php echo $option_value['name']; ?>
             <?php if ($option_value['price']) { ?>
-            (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
+            <!-- (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>) -->
+            (<?php echo $option_value['price_full']; ?>)
             <?php } ?>
           </label>
           
@@ -105,7 +107,8 @@
           <input type="checkbox" name="option[<?php echo $option['product_option_id']; ?>][]" value="<?php echo $option_value['product_option_value_id']; ?>" id="option-value-<?php echo $option_value['product_option_value_id']; ?>" />
           <label for="option-value-<?php echo $option_value['product_option_value_id']; ?>"> <?php echo $option_value['name']; ?>
             <?php if ($option_value['price']) { ?>
-            (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
+            <!-- (<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>) -->
+            (<?php echo $option_value['price_full']; ?>)
             <?php } ?>
           </label>
           
@@ -433,4 +436,4 @@ $('.datetime').datetimepicker({
 });
 $('.time').timepicker({timeFormat: 'h:m'});
 //--></script> 
-<?php echo $footer; ?>
\ No newline at end of file
+<?php echo $footer; ?>