$price -= round($discount_amount, 2); $sales_price -= round($discount_amount, 2); } elseif ($discount_type == 4) { $price -= round(($price - $buying_price) * $discount_amount / 100, 2); $sales_price -= round(($sales_price - $buying_price) * $discount_amount / 100, 2); } } // add options and components prices $price += $properties_price; $sales_price += $properties_price; if ($sales_price != $price && $is_sales) { set_tax_price($item_id, $item_type_id, $price, 1, $sales_price, $tax_id, $tax_free, "ri_price", "ri_sales_price", "ri_tax_sales", false); $t->sparse("ri_price_block", false); $t->sparse("ri_sales", false); } else { set_tax_price($item_id, $item_type_id, $price, 1, 0, $tax_id, $tax_free, "ri_price", "", "ri_tax_price", false); $t->sparse("ri_price_block", false); $t->set_var("ri_sales", ""); } } if ($new_product_enable) { $new_product_date = $db->f("new_product_date"); $is_new_product = is_new_product($new_product_date); } else { $is_new_product = false; } if ($is_new_product) { $t->set_var("product_new_class", " newProduct"); $t->sparse("product_new_image", false); } else { $t->set_var("product_new_class", "");
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; $shopping_cart[$cart_id]["COMPONENTS"][$property_id][$item_property_id] = $component; } if ($sub_points_price <= 0) { $sub_points_price = $component_price * $points_conversion_rate; } $sub_reward_points = calculate_reward_points($sub_reward_type, $sub_reward_amount, $component_price, $sub_buying, $points_conversion_rate, $points_decimals); $sub_reward_credits = calculate_reward_credits($sub_credit_reward_type, $sub_credit_reward_amount, $component_price, $sub_buying); $component_tax_amount = set_tax_price($sub_item_id, $sub_type_id, $component_price, $component_quantity, 0, $sub_tax_id, $sub_tax_free); if ($tax_prices_type == 1) { $component_incl = $component_price; $component_excl = $component_price - $component_tax_amount; } else { $component_incl = $component_price + $component_tax_amount; $component_excl = $component_price; } if ($component_qty_action == 2) { $components_price += $component_price * $component_quantity / $quantity; $components_incl_tax += $component_incl * $component_quantity / $quantity; $components_excl_tax += $component_excl * $component_quantity / $quantity; $components_tax_amount += $component_tax_amount * $component_quantity / $quantity; $components_total_incl += $component_incl * $component_quantity; $components_total_excl += $component_excl * $component_quantity; $components_total_tax += $component_tax_amount * $component_quantity;
if ($user_tax_free) { $accessory_tax_free = $user_tax_free; } $accessory_price = calculate_price($price, $is_sales, $sales_price); if ($user_price_action != 1) { if ($discount_type == 1 || $discount_type == 3) { $accessory_price -= round($accessory_price * $discount_amount / 100, 2); } elseif ($discount_type == 2) { $accessory_price -= round($discount_amount, 2); } elseif ($discount_type == 4) { $accessory_price -= round(($accessory_price - $buying_price) * $discount_amount / 100, 2); } } // add properties and components prices $accessory_price += $properties_price; set_tax_price($accessory_id, $accessory_type_id, $accessory_price, 1, 0, $accessory_tax_id, $accessory_tax_free, "accessory_price", "", "accessory_tax_price", false, 0, 0, false); $t->set_var("accessory_id", $accessory_id); $t->set_var("accessory_name", $accessory_name); $t->set_var("accessory_a_title", htmlspecialchars($accessory_a_title)); $t->set_var("accessory_description", $accessory_description); if ($display_products != 2 || strlen($user_id)) { $t->set_var("buy_accessory_href", $buy_accessory_href); $t->sparse("accessory_price_block", false); } if (!$allowed_accessories_ids || !in_array($accessory_id, $allowed_accessories_ids)) { $t->set_var("restricted_class", " restrictedItem"); $t->sparse("restricted_image", false); } else { $t->set_var("restricted_class", ""); $t->set_var("restricted_image", ""); }
$t->set_var("save", ""); } elseif ($sales_price != $price && $is_sales) { $discount_percent = round($db->f("discount_percent"), 0); if (!$discount_percent && $price > 0) { $discount_percent = round(($price - $sales_price) / ($price / 100), 0); } $t->set_var("discount_percent", $discount_percent); $t->set_var("old_price", " priceBlockOld"); //Customization by Vital set_tax_price($item_id, $item_type_id, $price, 1, $sales_price + $selected_price, $tax_id, $tax_free, "price", "sales_price", "tax_sales", true, $components_price, $components_tax_price); $t->sparse("price_block", false); $t->sparse("sales", false); $t->sparse("save", false); } else { $product_params["pe"] = 0; set_tax_price($item_id, $item_type_id, $price + $selected_price, 1, 0, $tax_id, $tax_free, "price", "", "tax_price", true, $components_price, $components_tax_price); $t->sparse("price_block", false); $t->set_var("sales", ""); $t->set_var("save", ""); } $t->set_var("old_price", ""); //Customization by Vital $buy_link = $db->f("buy_link"); if ($buy_link) { $t->set_var("buy_href", htmlspecialchars($db->f("buy_link") . $db->f("affiliate_code"))); } elseif ($is_properties || $quantity_control == "LISTBOX" || $quantity_control == "TEXTBOX" || $is_price_edit) { $t->set_var("buy_href", "javascript:document.form_" . $form_id . ".submit();"); $t->set_var("wishlist_href", "javascript:document.form_" . $form_id . ".submit();"); } else { $t->set_var("buy_href", htmlspecialchars($cart_link . "cart=ADD&add_id=" . $item_id . "&rp=" . urlencode($rp) . "#p" . $item_id)); $t->set_var("wishlist_href", htmlspecialchars($cart_link . "cart=WISHLIST&add_id=" . $item_id . "&rp=" . urlencode($rp) . "#p" . $item_id));