$shipping_time_desc = get_translation($db->f("out_stock_message")); } if (strlen($shipping_time_desc)) { $t->set_var("shipping_time_desc", $shipping_time_desc); $t->parse("ri_availability", false); } else { $t->set_var("ri_availability", ""); } if ($display_products != 2 || strlen($user_id)) { $price = $db->f($price_field); $is_sales = $db->f("is_sales"); $sales_price = $db->f($sales_field); $buying_price = $db->f("buying_price"); $user_price = false; $user_price_action = 0; $q_prices = get_quantity_price($item_id, 1); if ($q_prices) { $user_price = $q_prices[0]; $user_price_action = $q_prices[2]; } $properties_price = $db->f($properties_field); if ($user_price > 0 && ($user_price_action > 0 || !$discount_type)) { if ($is_sales) { $sales_price = $user_price; } else { $price = $user_price; } } $tax_id = $db->f("tax_id"); $tax_free = $db->f("tax_free"); if ($user_tax_free) {
} if (!strlen($sub_credit_reward_type)) { $sub_credit_reward_type = $db->f("type_credit_reward"); $sub_credit_reward_amount = $db->f("type_credit_amount"); } if (!strlen($sub_is_points_price)) { $sub_is_points_price = $points_prices; } if (!strlen($component_price)) { $sub_price = $db->f($price_field); $sub_is_sales = $db->f("is_sales"); $sub_sales = $db->f($sales_field); // check price for selected quantity for current user $sub_user_price = ""; $sub_user_action = 0; $q_prices = get_quantity_price($sub_item_id, $quantity * $sub_quantity); if ($q_prices) { $sub_user_price = $q_prices[0]; $sub_user_action = $q_prices[2]; } $sub_prices = get_product_price($sub_item_id, $sub_price, $sub_buying, $sub_is_sales, $sub_sales, $sub_user_price, $sub_user_action, $user_discount_type, $user_discount_amount); $component_price = $sub_prices["base"]; // update information in the cart as well if ($sub_is_sales && $sub_sales > 0) { $component["base_price"] = $sub_sales; } else { $component["base_price"] = $sub_price; } $component["buying"] = $db->f("buying_price"); $component["user_price"] = $sub_user_price; $component["user_price_action"] = $sub_user_action;
function get_item_info(&$item, $item_id = "", $quantity = "") { global $db, $table_prefix, $site_id; $dbp = new VA_SQL(); $dbp->DBType = $db->DBType; $dbp->DBDatabase = $db->DBDatabase; $dbp->DBHost = $db->DBHost; $dbp->DBPort = $db->DBPort; $dbp->DBUser = $db->DBUser; $dbp->DBPassword = $db->DBPassword; $dbp->DBPersistent = $db->DBPersistent; $item_id = isset($item["ITEM_ID"]) ? $item["ITEM_ID"] : $item_id; $quantity = isset($item["QUANTITY"]) ? $item["QUANTITY"] : $quantity; $is_price_edit = isset($item["PRICE_EDIT"]) ? $item["PRICE_EDIT"] : 0; if (!$is_price_edit) { $quantity_price = get_quantity_price($item_id, $quantity); if (is_array($quantity_price) && sizeof($quantity_price) == 3) { $item["ITEM_ID"] = $item_id; $item["PRICE"] = $quantity_price[0]; $item["PROPERTIES_DISCOUNT"] = $quantity_price[1]; $item["DISCOUNT"] = $quantity_price[2]; } else { // check original price $price_type = get_session("session_price_type"); if ($price_type == 1) { $price_field = "trade_price"; $sales_field = "trade_sales"; $additional_price_field = "trade_additional_price"; } else { $price_field = "price"; $sales_field = "sales_price"; $additional_price_field = "additional_price"; } $sql = " SELECT " . $price_field . "," . $sales_field . ",is_sales "; $sql .= " FROM " . $table_prefix . "items "; $sql .= " WHERE item_id=" . $dbp->tosql($item_id, INTEGER); $dbp->query($sql); if ($dbp->next_record()) { $product_price = calculate_price($dbp->f($price_field), $dbp->f("is_sales"), $dbp->f($sales_field)); } else { $product_price = isset($item["PRICE"]) ? $item["PRICE"] : ""; } $item["ITEM_ID"] = $item_id; $item["PRICE"] = $product_price; $item["PROPERTIES_DISCOUNT"] = 0; $item["DISCOUNT"] = 1; // discount applicable } } }
$item_type_id = $db->f("item_type_id"); $supplier_id = $db->f("supplier_id"); $component_price = $db->f("component_price"); $buying_price = $db->f("buying_price"); $item_price = $db->f($price_field); $is_sales = $db->f("is_sales"); $sales_price = $db->f($sales_field); if ($quantity_action == 2) { $component_quantity = $sub_quantity; } else { $component_quantity = $quantity * $sub_quantity; } $user_price = false; $properties_discount = 0; $user_action = 0; $quantity_prices = get_quantity_price($sub_item_id, $component_quantity); if ($quantity_prices) { $user_price = $quantity_prices[0]; $properties_discount = $quantity_prices[1]; $user_action = $quantity_prices[2]; } $discount_applicable = $user_action == 2 ? 1 : 0; $properties_discount = $db->f("properties_discount"); // points data $is_points_price = $db->f("is_points_price"); $points_price = $db->f("points_price"); $reward_type = $db->f("reward_type"); $reward_amount = $db->f("reward_amount"); $credit_reward_type = $db->f("credit_reward_type"); $credit_reward_amount = $db->f("credit_reward_amount"); if (!strlen($reward_type)) {