//W. Kaiser - AJAX // Product options names $product_attributes = $product[$attributes_text]; $attributes_exist = isset($product_attributes) ? true : false; if ($attributes_exist) { reset($product_attributes); while (list($option, $value) = each($product_attributes)) { $product_option = $product[$option]; $products_options_value_name = $product_option[$products_options_values_name_text]; if (strpos($products_options_value_name, "Bitte wählen Sie") === false) { if ($do_atribute_stock_check) { $_SESSION[$any_out_of_stock_text] = olc_check_stock_attributes($product_option[$products_attributes_id_text], $products_quantity); } $price = $product_option[$options_values_price_text]; if ($price != 0) { $price = olc_get_products_attribute_price($price, $tax_class = $product[$tax_class_id_text], $price_special = 1, $quantity = $products_quantity, $prefix = trim($product_option[$price_prefix_text])); } else { $price = EMPTY_STRING; } $module_content[$i][$products_attributes_text][] = array($element_text => $i, $big_id_text => $product_option[$products_attributes_id_text], $big_model_text => $product_option[$products_options_model_text], $big_name_text => $product_option[$products_options_name_text], $value_name_text => $products_options_value_name . $attribute_stock_check, $price_text => $price); } } } } //W. Kaiser - AJAX if (CUSTOMER_SHOW_PRICE) { if ($not_show_saved_cart) { $price_raw = $_SESSION['cart']->show_total(); $span_price_start = '<span id="cart_total_price_1">'; } $price = olc_format_price($price_raw, $price_special = 1, $calculate_currencies = false);
function attributes_price($products_id) { if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); while (list($option, $value) = each($this->contents[$products_id]['attributes'])) { $attribute_price_query = olc_db_query("\n\t\t\t\tselect pd.products_tax_class_id, p.options_values_price, p.price_prefix\n\t\t\t\tfrom " . TABLE_PRODUCTS_ATTRIBUTES . " p, " . TABLE_PRODUCTS . " pd\n\t\t\t\twhere p.products_id = '" . $products_id . "'\n\t\t\t\tand p.options_id = '" . $option . "'\n\t\t\t\tand pd.products_id = p.products_id and\n\t\t\t\tp.options_values_id = '" . $value . APOS); $attribute_price = olc_db_fetch_array($attribute_price_query); $options_values_price = $attribute_price['options_values_price']; $products_tax_class_id = $attribute_price['products_tax_class_id']; $products_attribute_price = olc_get_products_attribute_price($options_values_price, $products_tax_class_id, 0, 1, $prefix); $prefix = $attribute_price['price_prefix']; if ($prefix == '+') { $attributes_price += $products_attribute_price; } else { if ($prefix == DASH) { $attributes_price -= $products_attribute_price; } else { if ($prefix == SLASH) { //CB $attributes_price = $this->{$attribute_price} / $products_attribute_price; } } } } } return $attributes_price; }
echo ' <td align="right" valign="top" class="main"> </td>'; } } // elari End CS V3.x if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) { echo ' <td align="right" valign="top" class="main"><b>' . olc_get_products_price($products[$i]['id'], $price_special = 1, $quantity = $products[$i]['quantity']) . HTML_B_END . NEW_LINE; } else { echo ' <td align="right" valign="top" class="main"><b>' . olc_get_products_price($products[$i]['id'], $price_special = 1, $quantity = $products[$i]['quantity']) . HTML_B_END . NEW_LINE; } // Product options prices if ($attributes_exist == 1) { reset($products[$i]['attributes']); while (list($option, $value) = each($products[$i]['attributes'])) { if ($products[$i][$option]['options_values_price'] != 0) { if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) { echo '<br/><small><i>' . olc_get_products_attribute_price($products[$i][$option]['options_values_price'], $tax_class = $products[$i]['tax_class_id'], $price_special = 1, $quantity = $products[$i]['quantity'], $prefix = $products[$i][$option]['price_prefix']) . '</i></small>'; } else { echo '<br/><small><i>' . olc_get_products_attribute_price($products[$i][$option]['options_values_price'], $tax_class = $products[$i]['tax_class_id'], $price_special = 1, $quantity = $products[$i]['quantity'], $prefix = $products[$i][$option]['price_prefix']) . '</i></small>'; } } else { // Keep price aligned with corresponding option echo '<br/><small><i> </i></small>'; } } } echo '</td>' . NEW_LINE . ' </tr>' . NEW_LINE; } $module = $module_smarty->fetch(CURRENT_TEMPLATE_MODULE . 'order_details' . HTML_EXT, $cacheid); $smarty->assign('MODULE_order_details', $module); ?> <!-- order_details_eof -->
function get_product_price($product_id) { global $order, $olPrice; $products_id = olc_get_prid($product_id); // products price $qty = $_SESSION['cart']->contents[$product_id]['qty']; $product_query = olc_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id='" . $product_id . APOS); if ($product = olc_db_fetch_array($product_query)) { $products_tax = $olPrice->TAX[$product['products_tax_class_id']]; $prid = $product['products_id']; if ($this->include_tax == TRUE_STRING_S) { if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) { $total_price += olc_get_products_price($product['products_id'], $price_special = 0, $qty) + olc_calculate_tax(olc_get_products_price($product['products_id'], $price_special = 0, $qty), $products_tax); } else { $total_price += olc_get_products_price($product['products_id'], $price_special = 0, $qty); } } else { if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) { $total_price += olc_get_products_price($product['products_id'], $price_special = 0, $qty) - olc_calculate_tax(olc_get_products_price($product['products_id'], $price_special = 0, $qty) / (100 + $products_tax) * 100, $products_tax); } else { $total_price += olc_get_products_price($product['products_id'], $price_special = 0, $qty); } } // attributes price if (isset($_SESSION['cart']->contents[$product_id]['attributes'])) { reset($_SESSION['cart']->contents[$product_id]['attributes']); while (list($option, $value) = each($_SESSION['cart']->contents[$product_id]['attributes'])) { $attribute_price_query = olc_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $prid . "' and options_id = '" . $option . "' and options_values_id = '" . $value . APOS); $attribute_price = olc_db_fetch_array($attribute_price_query); if ($attribute_price['price_prefix'] == '+') { if ($this->include_tax == TRUE_STRING_S) { if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) { $total_price += olc_get_products_attribute_price($attribute_price['options_values_price'], $product['products_tax_class_id'], 0, $qty, $attribute_price['price_prefix']) + olc_calculate_tax(olc_get_products_attribute_price($attribute_price['options_values_price'], $product['products_tax_class_id'], 0, $qty, $attribute_price['price_prefix']), $products_tax); } else { $total_price += olc_get_products_attribute_price($attribute_price['options_values_price'], $product['products_tax_class_id'], 0, $qty, $attribute_price['price_prefix']); } } else { $total_price += olc_get_products_attribute_price($attribute_price['options_values_price'], '', 0, $qty, $attribute_price['price_prefix']); } } else { if ($this->include_tax == TRUE_STRING_S) { if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) { $total_price -= olc_get_products_attribute_price($attribute_price['options_values_price'], $product['products_tax_class_id'], 0, $qty, $attribute_price['price_prefix']) + olc_calculate_tax(olc_get_products_attribute_price($attribute_price['options_values_price'], $product['products_tax_class_id'], 0, $qty, $attribute_price['price_prefix']), $products_tax); } else { $total_price -= olc_get_products_attribute_price($attribute_price['options_values_price'], $product['products_tax_class_id'], 0, $qty, $attribute_price['price_prefix']); } } else { $total_price -= olc_get_products_attribute_price($attribute_price['options_values_price'], '', 0, $qty, $attribute_price['price_prefix']); } } } } } return $total_price; }
$products_options_data = array(); $products_tax_class_id = $product_info['products_tax_class_id']; while ($products_options_name = olc_db_fetch_array($products_options_name_query)) { //$selected = 0; $products_options_array = array(); $products_options_id = $products_options_name[$products_options_id_text]; $products_options_data[$row] = array($NAME_text => $products_options_name[$products_options_name_text], $ID_text => $products_options_id, $DATA_text => EMPTY_STRING); $products_options_sql = str_replace(HASH, $products_id, $products_options_sql0); $products_options_sql = str_replace(ATSIGN, $products_options_id, $products_options_sql); $products_options_query = olc_db_query($products_options_sql); $col = 0; while ($products_options = olc_db_fetch_array($products_options_query)) { $products_options_values_id = $products_options[$products_options_values_id_text]; $roducts_options_values_name = $products_options[$products_options_values_name_text]; $price_prefix = $products_options[$price_prefix_text]; $products_options_array[] = array($id_text => $products_options_values_id, $text_text => $roducts_options_values_name); $options_values_price = (double) $products_options[$options_values_price_text]; if ($options_values_price != 0) { $products_options_array[sizeof($products_options_array) - 1][$text_text] .= BLANK . $price_prefix . BLANK . olc_get_products_attribute_price($options_values_price, $tax_class = $products_tax_class_id, $price_special = 0, $quantity = 1, $prefix = $price_prefix) . BLANK . $currency; $price = olc_format_price(olc_get_products_attribute_price($options_values_price, $tax_class = $products_tax_class_id, $price_special = 0, $quantity = 1, $prefix = $price_prefix), 1, false, 1); $options_have_price = true; } else { $price = EMPTY_STRING; $price_prefix = EMPTY_STRING; } $products_options_data[$row][$DATA_text][$col] = array($ID_text => $products_options_values_id, $TEXT_text => $roducts_options_values_name, $MODEL_text => $products_options[$attributes_model_text], $PRICE_text => $price, $PREFIX_text => $price_prefix); $col++; } $row++; } }