$item["name"] = $option["name"]; if ($set_arbitrarily == 0) { $item["variants"] = array(); $variants = schGetVariantsForSearch($categoryID, $option["optionID"]); foreach ($variants as $variant) { $item["variants"][] = array('variantID' => $variant["variantID"], 'value' => $variant["option_value"]); } } $params[] = $item; } } if (isset($_GET["search_name"])) { $smarty->assign("search_name", $_GET["search_name"]); } if (isset($_GET["search_price_from"])) { $smarty->assign("search_price_from", $_GET["search_price_from"]); } if (isset($_GET["search_price_to"])) { $smarty->assign("search_price_to", $_GET["search_price_to"]); } $smarty->assign("categoryID", $categoryID); if (isset($_GET["advanced_search_in_category"])) { $smarty->assign("search_in_subcategory", isset($_GET["search_in_subcategory"])); } else { $smarty->assign("search_in_subcategory", true); } $smarty->assign("show_subcategory_checkbox", 1); $smarty->assign("priceUnit", getPriceUnit()); $smarty->assign("params", $params); } }
function dscCalculateDiscount($orderPrice, $log) { $discount = array("discount_percent" => 0, "discount_standart_unit" => 0, "discount_current_unit" => 0, "rest_standart_unit" => 0, "rest_current_unit" => 0, "priceUnit" => getPriceUnit()); $customerID = (int) regGetIdByLogin($log); switch (CONF_DISCOUNT_TYPE) { // discount is switched off case 1: return $discount; break; // discount is based on customer group // discount is based on customer group case 2: if (!is_bool($customerID = regGetIdByLogin($log))) { $customer_group = GetCustomerGroupByCustomerId($customerID); if ($customer_group) { $discount["discount_percent"] = $customer_group["custgroup_discount"]; } else { $discount["discount_percent"] = 0; } } else { return $discount; } break; // discount is calculated with help general order price // discount is calculated with help general order price case 3: $discount["discount_percent"] = _calculateGeneralPriceDiscount($orderPrice, $log); break; // discount equals to discount is based on customer group plus // discount calculated with help general order price // discount equals to discount is based on customer group plus // discount calculated with help general order price case 4: if (!is_bool($customerID)) { $customer_group = GetCustomerGroupByCustomerId($customerID); if (!$customer_group) { $customer_group = array("custgroup_discount" => 0); } } else { $customer_group["custgroup_discount"] = 0; } $discount["discount_percent"] = $customer_group["custgroup_discount"] + _calculateGeneralPriceDiscount($orderPrice, $log); break; // discount is calculated as MAX( discount is based on customer group, // discount calculated with help general order price ) // discount is calculated as MAX( discount is based on customer group, // discount calculated with help general order price ) case 5: if (!is_bool($customerID)) { $customer_group = GetCustomerGroupByCustomerId($customerID); } else { $customer_group["custgroup_discount"] = 0; } if ($customer_group["custgroup_discount"] >= _calculateGeneralPriceDiscount($orderPrice, $log)) { $discount["discount_percent"] = $customer_group["custgroup_discount"]; } else { $discount["discount_percent"] = _calculateGeneralPriceDiscount($orderPrice, $log); } break; } $discount["discount_standart_unit"] = (double) $orderPrice / 100 * (double) $discount["discount_percent"]; $discount["discount_current_unit"] = show_priceWithOutUnit($discount["discount_standart_unit"]); $discount["rest_standart_unit"] = $orderPrice - $discount["discount_standart_unit"]; $discount["rest_current_unit"] = show_priceWithOutUnit($discount["rest_standart_unit"]); return $discount; }