本文整理汇总了PHP中CSaleOrderProps类的典型用法代码示例。如果您正苦于以下问题:PHP CSaleOrderProps类的具体用法?PHP CSaleOrderProps怎么用?PHP CSaleOrderProps使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSaleOrderProps类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckFields
public static function CheckFields($ACTION, &$arFields, $ID = 0)
{
if ((is_set($arFields, "ORDER_ID") || $ACTION == "ADD") && IntVal($arFields["ORDER_ID"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGOPV_EMPTY_ORDER_ID"), "EMPTY_ORDER_ID");
return false;
}
if ((is_set($arFields, "ORDER_PROPS_ID") || $ACTION == "ADD") && IntVal($arFields["ORDER_PROPS_ID"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGOPV_EMPTY_PROP_ID"), "EMPTY_ORDER_PROPS_ID");
return false;
}
if (is_set($arFields, "ORDER_ID")) {
if (!($arOrder = CSaleOrder::GetByID($arFields["ORDER_ID"]))) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["ORDER_ID"], GetMessage("SKGOPV_NO_ORDER_ID")), "ERROR_NO_ORDER");
return false;
}
}
if (is_set($arFields, "ORDER_PROPS_ID")) {
if (!($arOrder = CSaleOrderProps::GetByID($arFields["ORDER_PROPS_ID"]))) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["ORDER_PROPS_ID"], GetMessage("SKGOPV_NO_PROP_ID")), "ERROR_NO_PROPERY");
return false;
}
if (is_set($arFields, "ORDER_ID")) {
$arFilter = array("ORDER_ID" => $arFields["ORDER_ID"], "ORDER_PROPS_ID" => $arFields["ORDER_PROPS_ID"]);
if (IntVal($ID) > 0) {
$arFilter["!ID"] = $ID;
}
$dbP = CSaleOrderPropsValue::GetList(array(), $arFilter);
if ($arP = $dbP->Fetch()) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGOPV_DUPLICATE_PROP_ID", array("#ID#" => $arFields["ORDER_PROPS_ID"], "#ORDER_ID#" => $arFields["ORDER_ID"])), "ERROR_DUPLICATE_PROP_ID");
return false;
}
}
}
return True;
}
示例2: DoSaveUserProfile
static function DoSaveUserProfile($userId, $profileId, $profileName, $personTypeId, $orderProps, &$arErrors)
{
$profileId = intval($profileId);
$arIDs = array();
if ($profileId > 0) {
$dbProfile = CSaleOrderUserProps::GetList(array(), array("ID" => $profileId), false, false, array("ID", "NAME", "USER_ID", "PERSON_TYPE_ID"));
$arProfile = $dbProfile->Fetch();
if (!$arProfile) {
$arErrors[] = array("CODE" => "PROFILE_NOT_FOUND", "TEXT" => GetMessage('SKGOUP_PROFILE_NOT_FOUND'));
return false;
}
if ($arProfile["USER_ID"] != $userId || $arProfile["PERSON_TYPE_ID"] != $personTypeId) {
$arErrors[] = array("CODE" => "PARAM", "TEXT" => GetMessage('SKGOUP_PARRAMS_ERROR'));
return false;
}
//if (strlen($profileName) > 0 && $profileName != $arProfile["NAME"])
if (strlen($profileName) > 0) {
$arFields = array("NAME" => $profileName, "USER_ID" => $userId);
CSaleOrderUserProps::Update($profileId, $arFields);
}
$dbUserPropsValues = CSaleOrderUserPropsValue::GetList(array(), array("USER_PROPS_ID" => $profileId), false, false, array("ID", "ORDER_PROPS_ID"));
while ($arUserPropsValue = $dbUserPropsValues->Fetch()) {
$arIDs[$arUserPropsValue["ORDER_PROPS_ID"]] = $arUserPropsValue["ID"];
}
}
if (!is_array($orderProps)) {
$dbOrderPropsValues = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => intval($orderProps)), false, false, array("ORDER_PROPS_ID", "VALUE"));
$orderProps = array();
while ($arOrderPropsValue = $dbOrderPropsValues->Fetch()) {
$orderProps[$arOrderPropsValue["ORDER_PROPS_ID"]] = $arOrderPropsValue["VALUE"];
}
}
$dbOrderProperties = CSaleOrderProps::GetList(array(), array("PERSON_TYPE_ID" => $personTypeId, "ACTIVE" => "Y", "UTIL" => "N", "USER_PROPS" => "Y"), false, false, array("ID", "TYPE", "NAME", "CODE"));
while ($arOrderProperty = $dbOrderProperties->Fetch()) {
$curVal = $orderProps[$arOrderProperty["ID"]];
if ($arOrderProperty["TYPE"] == "MULTISELECT" && is_array($curVal)) {
$curVal = implode(",", $curVal);
}
if (strlen($curVal) > 0) {
if ($profileId <= 0) {
if (strlen($profileName) <= 0) {
$profileName = GetMessage("SOA_PROFILE") . " " . Date("Y-m-d");
}
$arFields = array("NAME" => $profileName, "USER_ID" => $userId, "PERSON_TYPE_ID" => $personTypeId);
$profileId = CSaleOrderUserProps::Add($arFields);
}
if (array_key_exists($arOrderProperty["ID"], $arIDs)) {
$arFields = array("NAME" => $arOrderProperty["NAME"], "VALUE" => $curVal);
CSaleOrderUserPropsValue::Update($arIDs[$arOrderProperty["ID"]], $arFields);
unset($arIDs[$arOrderProperty["ID"]]);
} else {
$arFields = array("USER_PROPS_ID" => $profileId, "ORDER_PROPS_ID" => $arOrderProperty["ID"], "NAME" => $arOrderProperty["NAME"], "VALUE" => $curVal);
CSaleOrderUserPropsValue::Add($arFields);
}
}
}
foreach ($arIDs as $id) {
CSaleOrderUserPropsValue::Delete($id);
}
}
示例3: GetOrderPropId
public static function GetOrderPropId($code)
{
$id = 0;
if (CModule::IncludeModule('sale')) {
$db_props = CSaleOrderProps::GetList(array("SORT" => "ASC"), array("CODE" => $code), false, false, array("ID"));
if ($props = $db_props->Fetch()) {
$id = $props["ID"];
}
} else {
Trace("Error: can't include module sale");
}
return $id;
}
示例4: getOrderProps
protected function getOrderProps()
{
if ($this->orderProps === null) {
$this->orderProps = array();
if (isset($this->formData["PERSON_TYPE"])) {
$db_props = CSaleOrderProps::GetList(array(), array("PERSON_TYPE_ID" => $this->formData["PERSON_TYPE"]));
while ($prop = $db_props->Fetch()) {
$this->orderProps[] = $prop;
}
}
}
return $this->orderProps;
}
示例5: translateLocationIDToCode
protected static function translateLocationIDToCode($id, $orderPropId)
{
if (!CSaleLocation::isLocationProMigrated()) {
return $id;
}
$prop = CSaleOrderProps::GetByID($orderPropId);
if (isset($prop['TYPE']) && $prop['TYPE'] == 'LOCATION') {
if ((string) $id === (string) intval($id)) {
return CSaleLocation::tryTranslateIDToCode($id);
}
}
return $id;
}
示例6: Delete
function Delete($ID)
{
global $DB;
$ID = IntVal($ID);
$db_orderProps = CSaleOrderProps::GetList($by = "PROPS_GROUP_ID", $order = "ASC", array("PROPS_GROUP_ID" => $ID));
while ($arOrderProps = $db_orderProps->Fetch()) {
$DB->Query("DELETE FROM b_sale_order_props_variant WHERE ORDER_PROPS_ID = " . $arOrderProps["ID"] . "", true);
$DB->Query("UPDATE b_sale_order_props_value SET ORDER_PROPS_ID = NULL WHERE ORDER_PROPS_ID = " . $arOrderProps["ID"] . "", true);
$DB->Query("DELETE FROM b_sale_user_props_value WHERE ORDER_PROPS_ID = " . $arOrderProps["ID"] . "", true);
}
$DB->Query("DELETE FROM b_sale_order_props WHERE PROPS_GROUP_ID = " . $ID . "", true);
CSaleOrderUserProps::ClearEmpty();
return $DB->Query("DELETE FROM b_sale_order_props_group WHERE ID = " . $ID . "", true);
}
示例7: AddOrderProperty
function AddOrderProperty($prop_id, $value, $order)
{
if (!strlen($prop_id)) {
return false;
}
if (CModule::IncludeModule('sale')) {
if ($arOrderProps = CSaleOrderProps::GetByID($prop_id)) {
$db_vals = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $order, 'ORDER_PROPS_ID' => $arOrderProps['ID']));
if ($arVals = $db_vals->Fetch()) {
return CSaleOrderPropsValue::Update($arVals['ID'], array('NAME' => $arVals['NAME'], 'CODE' => $arVals['CODE'], 'ORDER_PROPS_ID' => $arVals['ORDER_PROPS_ID'], 'ORDER_ID' => $arVals['ORDER_ID'], 'VALUE' => $value));
} else {
return CSaleOrderPropsValue::Add(array('NAME' => $arOrderProps['NAME'], 'CODE' => $arOrderProps['CODE'], 'ORDER_PROPS_ID' => $arOrderProps['ID'], 'ORDER_ID' => $order, 'VALUE' => $value));
}
}
}
}
示例8: getOrderProps
public static function getOrderProps($id = false)
{
static $result = null;
static $resultById = null;
static $resultByCode = null;
if($result === null)
{
$rs = \CSaleOrderProps::GetList(array(), array(), false, false, array('ID', 'NAME', 'CODE'));
while($ar = $rs->GetNext(true, false))
{
$obj = new OrderProp($ar);
$resultById[ $ar['ID'] ] = &$obj;
$resultByCode[ $ar['CODE'] ] = &$obj;
$result[] = &$obj;
unset($obj);
}
}
return $id ? (isset($resultById[$id]) ? $resultById[$id] : (isset($resultByCode[$id]) ? $resultByCode[$id] : false)) : $result;
}
示例9: CheckFields
function CheckFields($ACTION, &$arFields, $ID = 0)
{
global $DB, $USER;
if ((is_set($arFields, "VALUE") || $ACTION == "ADD") && strlen($arFields["VALUE"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGOPV_EMPTY_VAR"), "ERROR_NO_VALUE");
return false;
}
if ((is_set($arFields, "NAME") || $ACTION == "ADD") && strlen($arFields["NAME"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGOPV_EMPTY_NAME"), "ERROR_NO_NAME");
return false;
}
if ((is_set($arFields, "ORDER_PROPS_ID") || $ACTION == "ADD") && IntVal($arFields["ORDER_PROPS_ID"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGOPV_EMPTY_CODE"), "ERROR_NO_ORDER_PROPS_ID");
return false;
}
if (is_set($arFields, "ORDER_PROPS_ID")) {
if (!($arOrder = CSaleOrderProps::GetByID($arFields["ORDER_PROPS_ID"]))) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["ORDER_PROPS_ID"], GetMessage("SKGOPV_NO_PROP")), "ERROR_NO_PROPERY");
return false;
}
}
return True;
}
示例10: array
*/
$userProfile = $arResultProps["USER_PROFILES"];
$arPropValues = array();
$arPropValues = $userProfile[$PROFILE_ID]["VALUES"];
$arFilter = array("PERSON_TYPE_ID" => $PERSON_TYPE, "ACTIVE" => "Y", "UTIL" => "N");
$dbProperties = CSaleOrderProps::GetList(array("SORT" => "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", "CODE", "GROUP_NAME", "GROUP_SORT", "SORT", "USER_PROPS", "IS_ZIP", "INPUT_FIELD_LOCATION", "SUBSCRIBE"));
$locationZipID = "";
$locationID = "";
$profileName = "";
$payerName = "";
$payerEMail = "";
//load location for the index if isset index
$locationForZip = "";
if (isset($_REQUEST["CHANGE_ZIP"]) && $_REQUEST["CHANGE_ZIP"] == "Y") {
$arFilterZip = array("PERSON_TYPE_ID" => $PERSON_TYPE, "IS_ZIP" => "Y", "ACTIVE" => "Y", "UTIL" => "N");
$dbPropertiesZip = CSaleOrderProps::GetList(array("SORT" => "ASC"), $arFilterZip, false, false, array("ID"));
$arPropZip = $dbPropertiesZip->GetNext();
$zipCode = htmlspecialcharsEx($_POST["ORDER_PROP_" . $arPropZip["ID"]]);
$arZip = CSaleLocation::GetByZIP($zipCode);
if (is_array($arZip) && count($arZip) > 1) {
$locationForZip = intval($arZip["ID"]);
}
}
while ($arProperties = $dbProperties->GetNext()) {
if ((isset($_POST["BasketOrder"]) || $requestAjax || $_REQUEST["form"] == "Y") && $PROFILE_ID_OLD == $PROFILE_ID) {
$curVal = htmlspecialcharsEx($_REQUEST["ORDER_PROP_" . $arProperties["ID"]]);
if (intval($_REQUEST["NEW_LOCATION_" . $arProperties["ID"]]) > 0) {
$curVal = intval($_POST["NEW_LOCATION_" . $arProperties["ID"]]);
}
} else {
$curVal = $arPropValues[intval($arProperties["ID"])];
示例11: fGetLocationID
function fGetLocationID($PERSON_TYPE_ID)
{
$arResult = array();
$dbProperties = CSaleOrderProps::GetList(
array("SORT" => "ASC"),
array("PERSON_TYPE_ID" => $PERSON_TYPE_ID),
false,
false,
array("TYPE", "IS_ZIP", "ID", "SORT")
);
while ($arProperties = $dbProperties->Fetch())
{
if ($arProperties["TYPE"] == "TEXT")
{
if ($arProperties["IS_ZIP"] == "Y")
{
$arResult["LOCATION_ZIP_ID"] = $arProperties["ID"];
}
}
elseif ($arProperties["TYPE"] == "LOCATION")
{
$arResult["LOCATION_ID"] = $arProperties["ID"];
}
}
return $arResult;
}
示例12: array
$tabControl->Begin(array("FORM_ACTION" => $APPLICATION->GetCurPage() . "?lang=" . LANG . $urlForm));
//TAB EDIT PROFILE
$tabControl->BeginNextFormTab();
if (!empty($arProfile) && !empty($arUser)) {
$dbPersonType = CSalePersonType::GetList(array(), array("ACTIVE" => "Y", "ID" => $PERSON_TYPE));
$arPersonType = $dbPersonType->GetNext();
$LID = $arPersonType["LID"];
$arFilterProps = array("PERSON_TYPE_ID" => $PERSON_TYPE, "ACTIVE" => "Y");
if ($saleModulePermissions >= "U" && $saleModulePermissions < "W") {
$arFilterProps["USER_PROPS"] = "Y";
$arFilterProps["UTIL"] = "N";
}
$tabControl->AddViewField("CODE_USER", GetMessage("BUYER_PE_USER") . ":", "[<a href=\"/bitrix/admin/user_edit.php?ID=" . $arUser["ID"] . "&lang=" . LANGUAGE_ID . "\">" . $arUser["ID"] . "</a>] (" . $arUser["LOGIN"] . ") " . $userFIO);
$tabControl->AddEditField("CODE_PROFILE_NAME", GetMessage("BUYER_PE_PROFILE_NAME") . ":", false, array("size" => 30, "maxlength" => 255), htmlspecialcharsEx($profileName));
$propertyGroupID = "";
$dbProperties = CSaleOrderProps::GetList(array("GROUP_SORT" => "ASC", "PROPS_GROUP_ID" => "ASC", "SORT" => "ASC", "NAME" => "ASC"), $arFilterProps, false, false, array("*"));
$userProfile = CSaleOrderUserProps::DoLoadProfiles($USER_ID, $PERSON_TYPE);
$curVal = "";
while ($arProperties = $dbProperties->Fetch()) {
$curVal = $userProfile[$ID]["VALUES"][IntVal($arProperties["ID"])];
$fieldValue = $curVal != "" ? $curVal : $arProperties["DEFAULT_VALUE"];
if (IntVal($arProperties["PROPS_GROUP_ID"]) != $propertyGroupID) {
$tabControl->AddSection("SECTION_" . $arProperties["PROPS_GROUP_ID"], $arProperties["GROUP_NAME"]);
}
$shure = false;
if ($arProperties["REQUIED"] == "Y" || $arProperties["IS_PROFILE_NAME"] == "Y" || $arProperties["IS_LOCATION"] == "Y" || $arProperties["IS_LOCATION4TAX"] == "Y" || $arProperties["IS_PAYER"] == "Y" || $arProperties["IS_ZIP"] == "Y") {
$shure = true;
}
/*fields*/
if ($arProperties["TYPE"] == "TEXT") {
$tabControl->AddEditField("CODE_" . IntVal($arProperties["ID"]), $arProperties["NAME"] . ":", $shure, array("size" => 30, "maxlength" => 255), $fieldValue);
示例13: htmlspecialcharsEx
<td valign="middle"><?
$arPersonType = CSalePersonType::GetByID($arOrder["PERSON_TYPE_ID"]);
echo htmlspecialcharsEx($arPersonType["NAME"]);
?>
</td>
</tr>
<?
//disabled town
$arTownOrderProps = array();
$dbProperties = CSaleOrderProps::GetList(
array(),
array(
"ORDER_ID" => $ID,
"PERSON_TYPE_ID" => $arPersonType["ID"],
"ACTIVE" => "Y",
">INPUT_FIELD_LOCATION" => 0
),
false,
false,
array("INPUT_FIELD_LOCATION")
);
while ($arProperties = $dbProperties->Fetch())
$arTownOrderProps[$arProperties["INPUT_FIELD_LOCATION"]] = $arProperties["INPUT_FIELD_LOCATION"];
$arEnableTownProps = array();
$arOrderPropsValue = array();
$dbOrderProps = CSaleOrderPropsValue::GetOrderProps($ID);
while ($arOrderProps = $dbOrderProps->Fetch())
{
$arOrderPropsValue[] = $arOrderProps;
if ($arOrderProps["TYPE"] == "LOCATION" && $arOrderProps["ACTIVE"] == "Y" && $arOrderProps["IS_LOCATION"] == "Y" && in_array($arOrderProps["INPUT_FIELD_LOCATION"], $arTownOrderProps))
示例14: GetRealPath2Report
$val["PRICE"] -= $val["DISCOUNT_RATION_VALUE"];
$arBasket[$key] = $val;
}
return $arBasket;
}
if (CModule::IncludeModule("sale")) {
if ($arOrder = CSaleOrder::GetByID($ORDER_ID)) {
$rep_file_name = GetRealPath2Report($doc . ".php");
if (strlen($rep_file_name) <= 0) {
ShowError("PRINT TEMPLATE NOT FOUND");
die;
}
$arOrderProps = array();
$dbOrderPropVals = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => $ORDER_ID), false, false, array("ID", "CODE", "VALUE", "ORDER_PROPS_ID", "PROP_TYPE"));
while ($arOrderPropVals = $dbOrderPropVals->Fetch()) {
$arCurOrderPropsTmp = CSaleOrderProps::GetRealValue($arOrderPropVals["ORDER_PROPS_ID"], $arOrderPropVals["CODE"], $arOrderPropVals["PROP_TYPE"], $arOrderPropVals["VALUE"], LANGUAGE_ID);
foreach ($arCurOrderPropsTmp as $key => $value) {
$arOrderProps[$key] = $value;
}
}
if (CSaleLocation::isLocationProMigrated()) {
if (strlen($arOrderProps['LOCATION_VILLAGE']) && !strlen($arOrderProps['LOCATION_CITY'])) {
$arOrderProps['LOCATION_CITY'] = $arOrderProps['LOCATION_VILLAGE'];
}
// street added to the beginning of address, as it used to be before
if (strlen($arOrderProps['LOCATION_STREET']) && isset($arOrderProps['ADDRESS'])) {
$arOrderProps['ADDRESS'] = $arOrderProps['LOCATION_STREET'] . (strlen($arOrderProps['ADDRESS']) ? ', ' . $arOrderProps['ADDRESS'] : '');
}
}
$arBasketIDs = array();
$arQuantities = array();
示例15: OnOrderAddHandler
/**
* функция по собыитию изминению закааза
* функция добавляет значения-заглушку в свойство Адрес доставки
*/
function OnOrderAddHandler($ORDER_ID,$arOrder) {
if(CModule::IncludeModule("sale")){
$db_props = CSaleOrderPropsValue::GetOrderProps($ORDER_ID);
while ($arProps = $db_props->Fetch())
{
if($arProps['CODE']=='ADDRESS'){
$address=true;
}
}
if(!$address){
if ($arProp = CSaleOrderProps::GetList(array(), array('ORDER_ID'=>$ORDER_ID,'CODE' => 'ADDRESS'))->Fetch()) {
CSaleOrderPropsValue::Add(array(
'NAME' => $arProp['NAME'],
'CODE' => $arProp['CODE'],
'ORDER_PROPS_ID' => $arProp['ID'],
'ORDER_ID' => $ORDER_ID,
'VALUE' => '777'
));
}
}
}
}