require_once DIR_FS_INC . 'olc_format_price.inc.php';
$current_product_id = $_POST['current_product_id'];
// I found the easiest way to do this is just delete the current attributes & start over =)
olc_db_query(DELETE_FROM . TABLE_PRODUCTS_ATTRIBUTES . " WHERE products_id = '" . $current_product_id . APOS);
// Simple, yet effective.. loop through the selected Option Values.. find the proper price & prefix.. insert.. yadda yadda yadda.
for ($i = 0; $i < sizeof($_POST['optionValues']); $i++) {
    $optionValues = $_POST['optionValues'][$i];
    $query = "SELECT * FROM " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_values_id = '" . $optionValues . APOS;
    $result = olc_db_query($query);
    $matches = olc_db_num_rows($result);
    while ($line = olc_db_fetch_array($result, olc_db_ASSOC)) {
        $optionsID = $line['products_options_id'];
    }
    $value_price = $_POST[$optionValues . '_price'];
    if (PRICE_IS_BRUTTO == TRUE_STRING_S) {
        $value_price = $value_price / (olc_get_tax_rate(olc_get_tax_class_id($current_product_id)) + 100) * 100;
    }
    $value_price = olc_round($value_price, PRICE_PRECISION);
    $value_prefix = $_POST[$optionValues . '_prefix'];
    $value_sortorder = $_POST[$optionValues . '_sortorder'];
    $value_weight_prefix = $_POST[$optionValues . '_weight_prefix'];
    $value_model = $_POST[$optionValues . '_model'];
    $value_stock = $_POST[$optionValues . '_stock'];
    $value_weight = $_POST[$optionValues . '_weight'];
    $insert_into = INSERT_INTO . TABLE_PRODUCTS_ATTRIBUTES . "(products_id,options_id,options_values_id,options_values_price,price_prefix" . COMMA;
    $comma_blank = "','";
    if ($optionTypeInstalled == '1') {
        $value_type = $_POST[$optionValues . '_type'];
        $value_qty = $_POST[$optionValues . '_qty'];
        $value_order = $_POST[$optionValues . '_order'];
        $value_linked = $_POST[$optionValues . '_linked'];
     $current_value_id_old = $current_value_id;
     $current_value_id = $tempTextID;
     echo '<input type="checkbox" name="optionValuesText[]" value="' . $current_value_id . '"' . $CHECKED . '>&nbsp;&nbsp;' . $current_value_name . '&nbsp;&nbsp;';
     echo '<input type="hidden" name="' . $current_value_id . '_options_id" value="' . $current_product_option_id . '">';
 } else {
     echo "<input type=\"checkbox\" name=\"optionValues[]\" value=\"" . $current_value_id . "\"" . $CHECKED . ">&nbsp;&nbsp;" . $current_value_name . "&nbsp;&nbsp;";
 }
 echo "</td>";
 echo "<td class=\"main\" align=\"left\"><input type=\"text\" name=\"" . $current_value_id . "_sortorder\" value=\"" . $sortorder . "\" size=\"4\"></td>";
 echo "<td class=\"main\" align=\"left\"><input type=\"text\" name=\"" . $current_value_id . "_model\" value=\"" . $attribute_value_model . "\" size=\"15\"></td>";
 echo "<td class=\"main\" align=\"left\"><input type=\"text\" name=\"" . $current_value_id . "_stock\" value=\"" . $attribute_value_stock . "\" size=\"4\"></td>";
 echo "<td class=\"main\" align=\"left\"><input type=\"text\" name=\"" . $current_value_id . "_weight\" value=\"" . $attribute_value_weight . "\" size=\"10\"></td>";
 echo "<td class=\"main\" align=\"left\"><select name=\"" . $current_value_id . "_weight_prefix\"><option value=\"+\"" . $posCheck_weight . ">+<option value=\"-\"" . $negCheck_weight . ">-</SELECT></td>";
 // brutto Admin
 if (PRICE_IS_BRUTTO == TRUE_STRING_S) {
     $attribute_value_price_calculate = olc_format_price(olc_round($attribute_value_price * ((100 + olc_get_tax_rate(olc_get_tax_class_id($_POST['current_product_id']))) / 100), PRICE_PRECISION), false, false);
 } else {
     $attribute_value_price_calculate = olc_round($attribute_value_price, PRICE_PRECISION);
 }
 echo "<td class=\"main\" align=\"left\"><input type=\"text\" name=\"" . $current_value_id . "_price\" value=\"" . $attribute_value_price_calculate . "\" size=\"10\">";
 // brutto Admin
 if (PRICE_IS_BRUTTO == TRUE_STRING_S) {
     echo TEXT_NETTO . HTML_B_START . olc_format_price(olc_round($attribute_value_price, PRICE_PRECISION), true, false) . '</b>  ';
 }
 echo "</td>";
 if ($optionTypeInstalled == '1') {
     extraValues($current_value_id, $_POST['current_product_id']);
     echo "<td class=\"main\" align=\"left\"><input type=\"text\" name=\"" . $current_value_id . "_prefix\" value=\"" . $attribute_prefix . "\" size=\"4\"></td>";
     echo "<td class=\"main\" align=\"left\"><select name=\"" . $current_value_id . "_type\">";
     displayOptionTypes($attribute_type);
     echo "</SELECT></td>";