ExecuteModuleEventEx($arEvent, array(&$arResult, &$arUserResult, &$arParams)); } /* Pay Systems End */ /* Order properties related to the pay system and delivery system */ if (count($arResult["ORDER_PROP"]["RELATED"]) == 0) { $arRelFilter = array("PERSON_TYPE_ID" => $arUserResult["PERSON_TYPE_ID"], "ACTIVE" => "Y", "UTIL" => "N"); if (intval($arUserResult["PAY_SYSTEM_ID"]) != 0 && $arUserResult["PAY_CURRENT_ACCOUNT"] != "Y") { $arRelFilter["RELATED"]["PAYSYSTEM_ID"] = $arUserResult["PAY_SYSTEM_ID"]; } if ($arUserResult["DELIVERY_ID"] != false) { $arRelFilter["RELATED"]["DELIVERY_ID"] = $arUserResult["DELIVERY_ID"]; } if (isset($arRelFilter["RELATED"]) && count($arRelFilter["RELATED"]) > 0) { $dbRelatedProps = CSaleOrderProps::GetList(array(), $arRelFilter, false, false, array("*")); while ($arRelatedProps = $dbRelatedProps->GetNext()) { $arRes[] = getOrderPropFormated($arRelatedProps, $arResult, $arUserResult); } $arResult["ORDER_PROP"]["RELATED"] = $arRes; } } /* End of related order properties */ /* New discount */ foreach (GetModuleEvents("sale", "OnSaleComponentOrderOneStepDiscountBefore", true) as $arEvent) { ExecuteModuleEventEx($arEvent, array(&$arResult, &$arUserResult, &$arParams)); } // use later only items not part of the sets foreach ($arResult["BASKET_ITEMS"] as $id => $arItem) { if (CSaleBasketHelper::isSetItem($arItem)) { unset($arResult["BASKET_ITEMS"][$id]); } }
function getFormatedProperties($personTypeId, &$arResult, &$arUserResult, &$params) { $arDeleteFieldLocation = array(); $arFilter = array("PERSON_TYPE_ID" => $personTypeId, "ACTIVE" => "Y", "UTIL" => "N", "RELATED" => false); if(!empty($params["PROP_".$personTypeId])) $arFilter["!ID"] = $params["PROP_".$personTypeId]; $dbProperties = CSaleOrderProps::GetList( array( "GROUP_SORT" => "ASC", "PROPS_GROUP_ID" => "ASC", "USER_PROPS" => "ASC", "SORT" => "ASC", "NAME" => "ASC" ), $arFilter, false, false, array( "ID", "NAME", "TYPE", "REQUIED", "DEFAULT_VALUE", "IS_LOCATION", "PROPS_GROUP_ID", "SIZE1", "SIZE2", "DESCRIPTION", "IS_EMAIL", "IS_PROFILE_NAME", "IS_PAYER", "IS_LOCATION4TAX", "DELIVERY_ID", "PAYSYSTEM_ID", "MULTIPLE", "CODE", "GROUP_NAME", "GROUP_SORT", "SORT", "USER_PROPS", "IS_ZIP", "INPUT_FIELD_LOCATION" ) ); global $USER; $USER_ID = intval($USER->GetID()); $rsUser = CUser::GetByID($USER_ID); $arUser = $rsUser->Fetch(); $propIndex = array(); if(is_array($_REQUEST['LOCATION_ALT_PROP_DISPLAY_MANUAL'])) { foreach($_REQUEST['LOCATION_ALT_PROP_DISPLAY_MANUAL'] as $propId => $switch) { if(intval($propId)) $arResult['LOCATION_ALT_PROP_DISPLAY_MANUAL'][intval($propId)] = !!$switch; } } while ($arProperties = $dbProperties->GetNext()) { $arProperties = getOrderPropFormated($arProperties, $arResult, $arUserResult, $arDeleteFieldLocation); $flag = $arProperties["USER_PROPS"]=="Y" ? 'Y' : 'N'; $arResult["ORDER_PROP"]["USER_PROPS_".$flag][$arProperties["ID"]] = $arProperties; $propIndex[$arProperties["ID"]] =& $arResult["ORDER_PROP"]["USER_PROPS_".$flag][$arProperties["ID"]]; $arResult["ORDER_PROP"]["PRINT"][$arProperties["ID"]] = Array("ID" => $arProperties["ID"], "NAME" => $arProperties["NAME"], "VALUE" => $arProperties["VALUE_FORMATED"], "SHOW_GROUP_NAME" => $arProperties["SHOW_GROUP_NAME"]); if ($arProperties["CODE"] == "NAME" && !empty($arUser["NAME"])) $arResult["ORDER_PROP"]["USER_PROPS_".$flag][$arProperties["ID"]]["VALUE"] = $arUser["NAME"]; if ($arProperties["CODE"] == "LASTNAME" && !empty($arUser["LAST_NAME"])) $arResult["ORDER_PROP"]["USER_PROPS_".$flag][$arProperties["ID"]]["VALUE"] = $arUser["LAST_NAME"]; if ($arProperties["CODE"] == "PHONE" && !empty($arUser["WORK_PHONE"])) $arResult["ORDER_PROP"]["USER_PROPS_".$flag][$arProperties["ID"]]["VALUE"] = $arUser["WORK_PHONE"]; if ($arProperties["CODE"] == "EMAIL" && !empty($arUser["EMAIL"])) $arResult["ORDER_PROP"]["USER_PROPS_".$flag][$arProperties["ID"]]["VALUE"] = $arUser["EMAIL"]; if ($arProperties["CODE"] == "LOCATION") $arResult["LOCATION_PROP_ID"] = $arProperties["ID"]; } // additional city property process foreach($propIndex as $propId => $propDesc) { if(intval($propDesc['INPUT_FIELD_LOCATION']) && isset($propIndex[$propDesc['INPUT_FIELD_LOCATION']])) { $propIndex[$propDesc['INPUT_FIELD_LOCATION']]['IS_ALTERNATE_LOCATION_FOR'] = $propId; $propIndex[$propId]['CAN_HAVE_ALTERNATE_LOCATION'] = $propDesc['INPUT_FIELD_LOCATION']; // more strict condition rather INPUT_FIELD_LOCATION, check if the property really exists } } foreach(GetModuleEvents("sale", "OnSaleComponentOrderOneStepOrderProps", true) as $arEvent) ExecuteModuleEventEx($arEvent, Array(&$arResult, &$arUserResult, &$params)); /* Order Props End */ //delete prop for text location (town) if (count($arDeleteFieldLocation) > 0) { foreach ($arDeleteFieldLocation as $fieldId) unset($arResult["ORDER_PROP"]["USER_PROPS_Y"][$fieldId]); } }