function vam_get_products_stock($products_id) { $products_id = vam_get_prid($products_id); $stock_query = vam_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . $products_id . "'"); $stock_values = vam_db_fetch_array($stock_query); return $stock_values['products_quantity']; }
function vam_get_uprid($prid, $params) { if (is_numeric($prid)) { $uprid = $prid; if (is_array($params) && sizeof($params) > 0) { $attributes_check = true; $attributes_ids = ''; reset($params); while (list($option, $value) = each($params)) { if (is_numeric($option) && is_numeric($value)) { $attributes_ids .= '{' . (int) $option . '}' . (int) $value; } else { $attributes_check = false; break; } } if ($attributes_check == true) { $uprid .= $attributes_ids; } } } else { $uprid = vam_get_prid($prid); if (is_numeric($uprid)) { if (strpos($prid, '{') !== false) { $attributes_check = true; $attributes_ids = ''; $attributes = explode('{', substr($prid, strpos($prid, '{') + 1)); for ($i = 0, $n = sizeof($attributes); $i < $n; $i++) { $pair = explode('}', $attributes[$i]); if (is_numeric($pair[0]) && is_numeric($pair[1])) { $attributes_ids .= '{' . (int) $pair[0] . '}' . (int) $pair[1]; } else { $attributes_check = false; break; } } if ($attributes_check == true) { $uprid .= $attributes_ids; } } } else { return false; } } return $uprid; }
function vam_get_products($session) { if (!is_array($session)) { return false; } $products_array = array(); reset($session); if (is_array($session['cart']->contents)) { while (list($products_id, ) = each($session['cart']->contents)) { $products_query = vam_db_query("select p.products_id, pd.products_name,p.products_image, p.products_model, p.products_price, p.products_discount_allowed, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id='" . vam_get_prid($products_id) . "' and pd.products_id = p.products_id and pd.language_id = '" . $_SESSION['languages_id'] . "'"); if ($products = vam_db_fetch_array($products_query)) { $prid = $products['products_id']; // dirty workaround $vamPrice = new vamPrice($session['currency'], $session['customers_status']['customers_status_id'], $_SESSION['customer_id'] ? $_SESSION['customer_id'] : ""); $products_price = $vamPrice->GetPrice($products['products_id'], $format = false, $session['cart']->contents[$products_id]['qty'], $products['products_tax_class_id'], $products['products_price']); $products_array[] = array('id' => $products_id, 'name' => $products['products_name'], 'model' => $products['products_model'], 'image' => $products['products_image'], 'price' => $products_price + attributes_price($products_id, $session), 'quantity' => $session['cart']->contents[$products_id]['qty'], 'weight' => $products['products_weight'], 'final_price' => $products_price + attributes_price($products_id, $session), 'tax_class_id' => $products['products_tax_class_id'], 'attributes' => $session['contents'][$products_id]['attributes']); } } return $products_array; } return false; }
function count_contents_virtual() { // get total number of items in cart disregard gift vouchers $total_items = 0; if (is_array($this->contents)) { reset($this->contents); while (list($products_id, ) = each($this->contents)) { $no_count = false; $gv_query = vam_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . $products_id . "'"); $gv_result = vam_db_fetch_array($gv_query); if (preg_match('/^GIFT/', $gv_result['products_model'])) { $no_count = true; } if (NO_COUNT_ZERO_WEIGHT == 1) { $gv_query = vam_db_query("select products_weight from " . TABLE_PRODUCTS . " where products_id = '" . vam_get_prid($products_id) . "'"); $gv_result = vam_db_fetch_array($gv_query); if ($gv_result['products_weight'] <= MINIMUM_WEIGHT) { $no_count = true; } } if (!$no_count) { $total_items += $this->get_quantity($products_id); } } } return $total_items; }
function before_process() { global $customer_id, $order, $vamPrice, $order_totals, $sendto, $billto, $languages_id, $payment, $currencies, $cart; global ${$payment}; $order_id = substr($_SESSION['cart_yandex_id'], strpos($_SESSION['cart_yandex_id'], '-') + 1); // initialized for the email confirmation $products_ordered = ''; $subtotal = 0; $total_tax = 0; for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) { // Stock Update - Joao Correia if (STOCK_LIMITED == 'true') { if (DOWNLOAD_ENABLED == 'true') { $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename, pad.products_attributes_is_pin \n FROM " . TABLE_PRODUCTS . " p\n LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n ON p.products_id=pa.products_id\n LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n ON pa.products_attributes_id=pad.products_attributes_id\n WHERE p.products_id = '" . vam_get_prid($order->products[$i]['id']) . "'"; // Will work with only one option for downloadable products // otherwise, we have to build the query dynamically with a loop $products_attributes = $order->products[$i]['attributes']; if (is_array($products_attributes)) { $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'"; } $stock_query = vam_db_query($stock_query_raw); } else { $stock_query = vam_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . vam_get_prid($order->products[$i]['id']) . "'"); } if (vam_db_num_rows($stock_query) > 0) { $stock_values = vam_db_fetch_array($stock_query); // do not decrement quantities if products_attributes_filename exists if (DOWNLOAD_ENABLED != 'true' || !$stock_values['products_attributes_filename'] || $stock_values['products_attributes_is_pin'] == 1) { $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty']; } else { $stock_left = $stock_values['products_quantity']; } vam_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . vam_get_prid($order->products[$i]['id']) . "'"); if ($stock_left < 1 && STOCK_ALLOW_CHECKOUT == 'false') { vam_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . vam_get_prid($order->products[$i]['id']) . "'"); } } } // Update products_ordered (for bestsellers list) vam_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . vam_get_prid($order->products[$i]['id']) . "'"); //------insert customer choosen option to order-------- $attributes_exist = '0'; $products_ordered_attributes = ''; if (isset($order->products[$i]['attributes'])) { $attributes_exist = '1'; for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) { if (DOWNLOAD_ENABLED == 'true') { $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename, pad.products_attributes_is_pin\n from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n on pa.products_attributes_id=pad.products_attributes_id\n where pa.products_id = '" . $order->products[$i]['id'] . "'\n and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'\n and pa.options_id = popt.products_options_id\n and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'\n and pa.options_values_id = poval.products_options_values_id\n and popt.language_id = '" . $_SESSION['languages_id'] . "'\n and poval.language_id = '" . $_SESSION['languages_id'] . "'"; $attributes = vam_db_query($attributes_query); } else { $attributes = vam_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $_SESSION['languages_id'] . "' and poval.language_id = '" . $_SESSION['languages_id'] . "'"); } $attributes_values = vam_db_fetch_array($attributes); $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name']; } } //------insert customer choosen option eof ---- $total_weight += $order->products[$i]['qty'] * $order->products[$i]['weight']; $total_tax += vam_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty']; $total_cost += $total_products_price; $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $vamPrice->Format($order->products[$i]['final_price'], true) . $products_ordered_attributes . "\n"; } // initialize templates $vamTemplate = new vamTemplate(); $vamTemplate->assign('address_label_customer', vam_address_format($order->customer['format_id'], $order->customer, 1, '', '<br />')); $vamTemplate->assign('address_label_shipping', vam_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br />')); if ($_SESSION['credit_covers'] != '1') { $vamTemplate->assign('address_label_payment', vam_address_format($order->billing['format_id'], $order->billing, 1, '', '<br />')); } $vamTemplate->assign('csID', $order->customer['csID']); $it = 0; $semextrfields = vamDBquery("select * from " . TABLE_EXTRA_FIELDS . " where fields_required_email = '1'"); while ($dataexfes = vam_db_fetch_array($semextrfields, true)) { $cusextrfields = vamDBquery("select * from " . TABLE_CUSTOMERS_TO_EXTRA_FIELDS . " where customers_id = '" . (int) $_SESSION['customer_id'] . "' and fields_id = '" . $dataexfes['fields_id'] . "'"); $rescusextrfields = vam_db_fetch_array($cusextrfields, true); $extrfieldsinf = vamDBquery("select fields_name from " . TABLE_EXTRA_FIELDS_INFO . " where fields_id = '" . $dataexfes['fields_id'] . "' and languages_id = '" . $_SESSION['languages_id'] . "'"); $extrfieldsres = vam_db_fetch_array($extrfieldsinf, true); $extra_fields .= $extrfieldsres['fields_name'] . ' : ' . $rescusextrfields['value'] . "\n"; $vamTemplate->assign('customer_extra_fields', $extra_fields); } $order_total = $order->getTotalData($order_id); $vamTemplate->assign('order_data', $order->getOrderData($order_id)); $vamTemplate->assign('order_total', $order_total['data']); // assign language to template for caching $vamTemplate->assign('language', $_SESSION['language']); $vamTemplate->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/'); $vamTemplate->assign('logo_path', HTTP_SERVER . DIR_WS_CATALOG . 'templates/' . CURRENT_TEMPLATE . '/img/'); $vamTemplate->assign('oID', $order_id); if ($order->info['payment_method'] != '' && $order->info['payment_method'] != 'no_payment') { include DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_method'] . '.php'; $payment_method = constant(strtoupper('MODULE_PAYMENT_' . $order->info['payment_method'] . '_TEXT_TITLE')); } $vamTemplate->assign('PAYMENT_METHOD', $payment_method); if ($order->info['shipping_method'] != '') { $shipping_method = $order->info['shipping_method']; } $vamTemplate->assign('SHIPPING_METHOD', $shipping_method); $vamTemplate->assign('DATE', vam_date_long($order->info['date_purchased'])); $vamTemplate->assign('NAME', $order->customer['firstname'] . ' ' . $order->customer['lastname']); $vamTemplate->assign('COMMENTS', $order->info['comments']); $vamTemplate->assign('EMAIL', $order->customer['email_address']); $vamTemplate->assign('PHONE', $order->customer['telephone']); // dont allow cache $vamTemplate->caching = false; $html_mail = $vamTemplate->fetch(CURRENT_TEMPLATE . '/mail/' . $_SESSION['language'] . '/order_mail.html'); $txt_mail = $vamTemplate->fetch(CURRENT_TEMPLATE . '/mail/' . $_SESSION['language'] . '/order_mail.txt'); // create subject $order_subject = str_replace('{$nr}', $order_id, EMAIL_BILLING_SUBJECT_ORDER); $order_subject = str_replace('{$date}', strftime(DATE_FORMAT_LONG), $order_subject); $order_subject = str_replace('{$lastname}', $order->customer['lastname'], $order_subject); $order_subject = str_replace('{$firstname}', $order->customer['firstname'], $order_subject); // send mail to admin vam_php_mail(EMAIL_BILLING_ADDRESS, EMAIL_BILLING_NAME, EMAIL_BILLING_ADDRESS, STORE_NAME, EMAIL_BILLING_FORWARDING_STRING, $order->customer['email_address'], $order->customer['firstname'], '', '', $order_subject, $html_mail, $txt_mail); // send mail to customer vam_php_mail(EMAIL_BILLING_ADDRESS, EMAIL_BILLING_NAME, $order->customer['email_address'], $order->customer['firstname'] . ' ' . $order->customer['lastname'], '', EMAIL_BILLING_REPLY_ADDRESS, EMAIL_BILLING_REPLY_ADDRESS_NAME, '', '', $order_subject, $html_mail, $txt_mail); // load the after_process function from the payment modules $this->after_process(); require_once DIR_WS_INCLUDES . 'affiliate_checkout_process.php'; $_SESSION['cart']->reset(true); // unregister session variables used during checkout unset($_SESSION['sendto']); unset($_SESSION['billto']); unset($_SESSION['shipping']); unset($_SESSION['payment']); unset($_SESSION['comments']); unset($_SESSION['cart_yandex_id']); vam_redirect(vam_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL')); }
if (!is_file($image)) { $image = DIR_WS_THUMBNAIL_IMAGES . '../noimage.gif'; } $module_content[$i] = array('PRODUCTS_NAME' => $products[$i]['name'] . $mark_stock, 'PRODUCTS_QTY' => vam_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="2" data-id="' . $products[$i]['id'] . '" class="quantity"') . vam_draw_hidden_field('products_id[]', $products[$i]['id']) . vam_draw_hidden_field('old_qty[]', $products[$i]['quantity']), 'PRODUCTS_MODEL' => $products[$i]['model'], 'PRODUCTS_SHIPPING_TIME' => $products[$i]['shipping_time'], 'PRODUCTS_TAX' => number_format($products[$i]['tax'], TAX_DECIMAL_PLACES), 'PRODUCTS_IMAGE' => $image, 'IMAGE_ALT' => $products[$i]['name'], 'BOX_DELETE' => $products[$i]['id'], 'PRODUCTS_LINK' => vam_href_link(FILENAME_PRODUCT_INFO, vam_product_link($products[$i]['id'], $products[$i]['name'])), 'PRODUCTS_PRICE' => $vamPrice->Format($products[$i]['price'] * $products[$i]['quantity'], true), 'PRODUCTS_SINGLE_PRICE' => $vamPrice->Format($products[$i]['price'], true), 'PRODUCTS_SHORT_DESCRIPTION' => vam_get_short_description($products[$i]['id']), 'ATTRIBUTES' => ''); // Product options names $attributes_exist = isset($products[$i]['attributes']) ? 1 : 0; if ($attributes_exist == 1) { reset($products[$i]['attributes']); while (list($option, $value) = each($products[$i]['attributes'])) { if (ATTRIBUTE_STOCK_CHECK == 'true' && STOCK_CHECK == 'true') { $attribute_stock_check = vam_check_stock_attributes($products[$i][$option]['products_attributes_id'], $products[$i]['quantity']); if ($attribute_stock_check) { $_SESSION['any_out_of_stock'] = 1; } } $module_content[$i]['ATTRIBUTES'][] = array('ID' => $products[$i][$option]['products_attributes_id'], 'MODEL' => vam_get_attributes_model(vam_get_prid($products[$i]['id']), $products[$i][$option]['products_options_values_name'], $products[$i][$option]['products_options_name']), 'NAME' => $products[$i][$option]['products_options_name'], 'VALUE_NAME' => $products[$i][$option]['products_options_values_name'] . $attribute_stock_check); } } } $total_content = ''; $total = $_SESSION['cart']->show_total(); if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount'] != '0.00') { if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) { $price = $total - $_SESSION['cart']->show_tax(false); } else { $price = $total; } $discount = $vamPrice->GetDC($price, $_SESSION['customers_status']['customers_status_ot_discount']); //$total_content = $_SESSION['customers_status']['customers_status_ot_discount'].' % '.SUB_TITLE_OT_DISCOUNT.' -'.vam_format_price($discount, $price_special = 1, $calculate_currencies = false).'<br />'; $total_discount = $discount; }
function get_products() { if (!is_array($this->contents)) { return 0; } $products_array = array(); reset($this->contents); while (list($products_id, ) = each($this->contents)) { $products_query = vam_db_query("select p.products_id, pd.products_name, p.products_model, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id='" . vam_get_prid($products_id) . "' and pd.products_id = p.products_id and pd.language_id = '" . $_SESSION['languages_id'] . "'"); if ($products = vam_db_fetch_array($products_query)) { $prid = $products['products_id']; $products_price = $products['products_price']; $specials_query = vam_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . $prid . "' and status = '1'"); if (vam_db_num_rows($specials_query)) { $specials = vam_db_fetch_array($specials_query); $products_price = $specials['specials_new_products_price']; } $products_array[] = array('id' => $products_id, 'name' => $products['products_name'], 'model' => $products['products_model'], 'price' => $products_price, 'quantity' => $this->contents[$products_id]['qty'], 'weight' => $products['products_weight'], 'final_price' => $products_price + $this->attributes_price($products_id), 'tax_class_id' => $products['products_tax_class_id'], 'attributes' => $this->contents[$products_id]['attributes']); } } return $products_array; }
} } // Update products_ordered (for bestsellers list) vam_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . vam_get_prid($order->products[$i]['id']) . "'"); $sql_data_array = array('orders_id' => $insert_id, 'products_id' => vam_get_prid($order->products[$i]['id']), 'products_model' => $order->products[$i]['model'], 'products_name' => $order->products[$i]['name'], 'products_shipping_time' => $order->products[$i]['shipping_time'], 'products_price' => $order->products[$i]['price'], 'final_price' => $order->products[$i]['final_price'], 'products_tax' => $order->products[$i]['tax'], 'products_discount_made' => $order->products[$i]['discount_allowed'], 'products_quantity' => $order->products[$i]['qty'], 'allow_tax' => $_SESSION['customers_status']['customers_status_show_price_tax']); vam_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array); $order_products_id = vam_db_insert_id(); // Aenderung Specials Quantity Anfang $specials_result = vam_db_query("SELECT products_id, specials_quantity from " . TABLE_SPECIALS . " WHERE products_id = '" . vam_get_prid($order->products[$i]['id']) . "' "); if (vam_db_num_rows($specials_result)) { $spq = vam_db_fetch_array($specials_result); $new_sp_quantity = $spq['specials_quantity'] - $order->products[$i]['qty']; if ($new_sp_quantity >= 1) { vam_db_query("update " . TABLE_SPECIALS . " set specials_quantity = '" . $new_sp_quantity . "' where products_id = '" . vam_get_prid($order->products[$i]['id']) . "' "); } else { vam_db_query("update " . TABLE_SPECIALS . " set status = '0', specials_quantity = '" . $new_sp_quantity . "' where products_id = '" . vam_get_prid($order->products[$i]['id']) . "' "); } } // Aenderung Ende $order_total_modules->update_credit_account($i); // GV Code ICW ADDED FOR CREDIT CLASS SYSTEM //------insert customer choosen option to order-------- $attributes_exist = '0'; $products_ordered_attributes = ''; if (isset($order->products[$i]['attributes'])) { $attributes_exist = '1'; for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) { if (DOWNLOAD_ENABLED == 'true') { $attributes_query = "select popt.products_options_name,\n\t\t\t\t\t\t\t\t poval.products_options_values_name,\n\t\t\t\t\t\t\t\t pa.options_values_price,\n\t\t\t\t\t\t\t\t pa.price_prefix,\n\t\t\t\t\t\t\t\t pad.products_attributes_maxdays,\n\t\t\t\t\t\t\t\t pad.products_attributes_maxcount,\n\t\t\t\t\t\t\t\t pad.products_attributes_filename,\n\t\t\t\t\t\t\t\t pad.products_attributes_is_pin \n\t\t\t\t\t\t\t\t from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n\t\t\t\t\t\t\t\t left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n\t\t\t\t\t\t\t\t on pa.products_attributes_id=pad.products_attributes_id\n\t\t\t\t\t\t\t\t where pa.products_id = '" . $order->products[$i]['id'] . "'\n\t\t\t\t\t\t\t\t and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'\n\t\t\t\t\t\t\t\t and pa.options_id = popt.products_options_id\n\t\t\t\t\t\t\t\t and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'\n\t\t\t\t\t\t\t\t and pa.options_values_id = poval.products_options_values_id\n\t\t\t\t\t\t\t\t and popt.language_id = '" . $_SESSION['languages_id'] . "'\n\t\t\t\t\t\t\t\t and poval.language_id = '" . $_SESSION['languages_id'] . "'"; $attributes = vam_db_query($attributes_query); } else {
function get_product_price($product_id) { global $order, $vamPrice; $products_id = vam_get_prid($product_id); // products price $qty = $_SESSION['cart']->contents[$products_id]['qty']; $product_query = vam_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id='" . $product_id . "'"); if ($product = vam_db_fetch_array($product_query)) { $prid = $product['products_id']; if ($this->include_tax == 'true') { $total_price += $qty * $vamPrice->GetPrice($product['products_id'], $format = false, 1, $product['products_tax_class_id'], $product['products_price'], 1); $_SESSION['total_price'] = $total_price; } else { $total_price += $qty * $vamPrice->GetPrice($product['products_id'], $format = false, 1, 0, $product['products_price'], 1); } // 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 = vam_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 . "'"); $attribute_price = vam_db_fetch_array($attribute_price_query); if ($attribute_price['price_prefix'] == '+') { if ($this->include_tax == 'true') { $total_price += $qty * ($attribute_price['options_values_price'] + vam_calculate_tax($attribute_price['options_values_price'], $products_tax)); } else { $total_price += $qty * $attribute_price['options_values_price']; } } else { if ($this->include_tax == 'true') { $total_price -= $qty * ($attribute_price['options_values_price'] + vam_calculate_tax($attribute_price['options_values_price'], $products_tax)); } else { $total_price -= $qty * $attribute_price['options_values_price']; } } } } } if ($this->include_shipping == 'true') { $total_price += $order->info['shipping_cost']; } return $total_price; }