本文整理汇总了PHP中CSaleOrderPropsValue::Update方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleOrderPropsValue::Update方法的具体用法?PHP CSaleOrderPropsValue::Update怎么用?PHP CSaleOrderPropsValue::Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleOrderPropsValue
的用法示例。
在下文中一共展示了CSaleOrderPropsValue::Update方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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));
}
}
}
}
示例2: bxModifySaleMails
//.........这里部分代码省略.........
$arBasket = array();
while ($arBasketItems = $dbBasketItems->GetNext()) {
$strOrderList .= $arBasketItems["NAME"] . " - " . $arBasketItems["QUANTITY"] . " шт на " . SaleFormatCurrency($arBasketItems["PRICE"] * $arBasketItems["QUANTITY"], $arBasketItems["CURRENCY"]);
$strOrderList .= "\n";
$rows['summ']=$summ += roundEx($arBasketItems["PRICE"], SALE_VALUE_PRECISION) * DoubleVal($arBasketItems["QUANTITY"]);
$weight += doubleval($arBasketItems['WEIGHT']);
$arBasket[] = $arBasketItems;
}
$arOrderForDiscount = array(
'SITE_ID' => SITE_ID,
'USER_ID' => $arUser['ID'],
'ORDER_PRICE' => $summ,
'ORDER_WEIGHT' => $weight,
'BASKET_ITEMS' => $arBasket,
);
$arDiscountOptions = array();
$arDiscountErrors = array();
CSaleDiscount::DoProcessOrder($arOrderForDiscount, $arDiscountOptions, $arDiscountErrors);
if($_REQUEST['comment'])
$arOrderForDiscount['COMMENTS'] = $_REQUEST['comment'];
if($arProperties_partners['DOSTAVKA']['VALUE']){
$arOrderForDiscount["PRICE_DELIVERY"] = $arProperties_partners['DOSTAVKA']['VALUE'];
$arOrderForDiscount["DELIVERY_ID"] = 3;
$summ += intval($arProperties_partners['DOSTAVKA']['VALUE']);
$arOrderForDiscount['ORDER_PRICE']=$summ;
}
$arOrderForDiscount['PRICE_BEFORE'] = $summ;
$arOrderForDiscount['PRICE'] = $summ;
$arOrderForDiscount['WEIGHT'] = $arOrderForDiscount['ORDER_WEIGHT'];
/**
* обновляем заказ
*/
if (!CSaleOrder::Update($ORDER_ID, $arOrderForDiscount)) {
$rows['err'] = 'Ошибка расчета цены заказа.';
$fail = true;
}else{
/**
* перезагружаем свойства заказ из старого
*/
$db_props_new = CSaleOrderPropsValue::GetOrderProps($ORDER_ID);
$arFields_props_new = array();
while ($arProps_new = $db_props_new->Fetch())
{
//_debug($arProps_new);
foreach($arFields_props_old as $key_props_old=>$item_props_old){
if($arProps_new['CODE']==$key_props_old){
CSaleOrderPropsValue::Update($arProps_new['ID'], array("VALUE"=>$item_props_old['VALUE']));
unset($arFields_props_old[$key_props_old]);
}
}
}
if(sizeof($arFields_props_old)>0){
foreach($arFields_props_old as $key_props_old2=>$item_props_old2){
CSaleOrderPropsValue::Add(array(
'NAME' => $item_props_old2['NAME'],
'CODE' => $item_props_old2['CODE'],
'ORDER_PROPS_ID' => $item_props_old2['ORDER_PROPS_ID'],
'ORDER_ID' => $ORDER_ID,
'VALUE' => $item_props_old2['VALUE']
));
}
}
/**
示例3: IntVal
$PROPS_GROUP_ID = IntVal($PROPS_GROUP_ID);
if ($PROPS_GROUP_ID <= 0) {
$strError .= GetMessage("ERROR_NO_GROUP") . "<br>";
}
if (strlen($strError) <= 0) {
unset($arFields);
$arFields = array("PERSON_TYPE_ID" => $PERSON_TYPE_ID, "NAME" => $NAME, "TYPE" => $TYPE, "REQUIED" => $REQUIED, "DEFAULT_VALUE" => $DEFAULT_VALUE, "SORT" => $SORT, "CODE" => strlen($CODE) <= 0 ? False : $CODE, "USER_PROPS" => $USER_PROPS, "IS_LOCATION" => $IS_LOCATION, "IS_LOCATION4TAX" => $IS_LOCATION4TAX, "PROPS_GROUP_ID" => $PROPS_GROUP_ID, "SIZE1" => $SIZE1, "SIZE2" => $SIZE2, "DESCRIPTION" => $DESCRIPTION, "IS_EMAIL" => $IS_EMAIL, "IS_PROFILE_NAME" => $IS_PROFILE_NAME, "IS_PAYER" => $IS_PAYER, "IS_FILTERED" => $IS_FILTERED, "IS_ZIP" => $IS_ZIP, "ACTIVE" => $ACTIVE, "UTIL" => $UTIL, "INPUT_FIELD_LOCATION" => $INPUT_FIELD_LOCATION);
if ($ID > 0) {
if (!CSaleOrderProps::Update($ID, $arFields)) {
$strError .= GetMessage("ERROR_EDIT_PROP") . "<br>";
}
if (strlen($strError) <= 0) {
//$db_order_props_tmp = CSaleOrderPropsValue::GetList(($b="NAME"), ($o="ASC"), Array("ORDER_PROPS_ID"=>$ID));
$db_order_props_tmp = CSaleOrderPropsValue::GetList($b = "ID", $o = "ASC", array("ORDER_PROPS_ID" => $ID, "!CODE" => strlen($CODE) <= 0 ? False : $CODE));
while ($ar_order_props_tmp = $db_order_props_tmp->Fetch()) {
CSaleOrderPropsValue::Update($ar_order_props_tmp["ID"], array("CODE" => strlen($CODE) <= 0 ? False : $CODE));
}
}
} else {
$ID = CSaleOrderProps::Add($arFields);
if ($ID <= 0) {
$strError .= GetMessage("ERROR_ADD_PROP") . "<br>";
}
}
}
if (strlen($strError) <= 0) {
if ($TYPE == "SELECT" || $TYPE == "MULTISELECT" || $TYPE == "RADIO") {
$numpropsvals = IntVal($numpropsvals);
for ($i = 0; $i <= $numpropsvals; $i++) {
$strError1 = "";
$CF_ID = IntVal(${"ID_" . $i});
示例4: DoSaveOrderProps
static function DoSaveOrderProps($orderId, $personTypeId, $arOrderProps, &$arErrors)
{
$arIDs = array();
$dbResult = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => $orderId), false, false, array("ID", "ORDER_PROPS_ID"));
while ($arResult = $dbResult->Fetch()) {
$arIDs[$arResult["ORDER_PROPS_ID"]] = $arResult["ID"];
}
$dbOrderProperties = CSaleOrderProps::GetList(array("SORT" => "ASC"), array("PERSON_TYPE_ID" => $personTypeId, "ACTIVE" => "Y"), false, false, array("ID", "TYPE", "NAME", "CODE", "USER_PROPS", "SORT"));
while ($arOrderProperty = $dbOrderProperties->Fetch()) {
$curVal = $arOrderProps[$arOrderProperty["ID"]];
if ($arOrderProperty["TYPE"] == "MULTISELECT" && is_array($curVal)) {
$curVal = implode(",", $curVal);
}
if (strlen($curVal) > 0) {
$arFields = array("ORDER_ID" => $orderId, "ORDER_PROPS_ID" => $arOrderProperty["ID"], "NAME" => $arOrderProperty["NAME"], "CODE" => $arOrderProperty["CODE"], "VALUE" => $curVal);
if (array_key_exists($arOrderProperty["ID"], $arIDs)) {
CSaleOrderPropsValue::Update($arIDs[$arOrderProperty["ID"]], $arFields);
unset($arIDs[$arOrderProperty["ID"]]);
} else {
CSaleOrderPropsValue::Add($arFields);
}
}
}
foreach ($arIDs as $id) {
CSaleOrderPropsValue::Delete($id);
}
}
示例5: DoSaveOrderProps
static function DoSaveOrderProps($orderId, $personTypeId, $arOrderProps, &$arErrors, $paysystemId = 0, $deliveryId = "")
{
$arIDs = array();
$dbResult = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => $orderId), false, false, array("ID", "ORDER_PROPS_ID"));
while ($arResult = $dbResult->Fetch()) {
$arIDs[$arResult["ORDER_PROPS_ID"]] = $arResult["ID"];
}
$arFilter = array("PERSON_TYPE_ID" => $personTypeId, "ACTIVE" => "Y");
if ($paysystemId != 0) {
$arFilter["RELATED"]["PAYSYSTEM_ID"] = $paysystemId;
$arFilter["RELATED"]["TYPE"] = "WITH_NOT_RELATED";
}
if (strlen($deliveryId) > 0) {
$arFilter["RELATED"]["DELIVERY_ID"] = $deliveryId;
$arFilter["RELATED"]["TYPE"] = "WITH_NOT_RELATED";
}
$dbOrderProperties = CSaleOrderProps::GetList(array("SORT" => "ASC"), $arFilter, false, false, array("ID", "TYPE", "NAME", "CODE", "USER_PROPS", "SORT"));
while ($arOrderProperty = $dbOrderProperties->Fetch()) {
$curVal = $arOrderProps[$arOrderProperty["ID"]];
if ($arOrderProperty["TYPE"] == "MULTISELECT" && is_array($curVal)) {
$curVal = implode(",", $curVal);
}
if ($arOrderProperty["TYPE"] == "FILE" && is_array($curVal)) {
$tmpVal = "";
foreach ($curVal as $index => $fileData) {
$bModify = true;
if (isset($fileData["file_id"])) {
if (isset($fileData["del"])) {
$arFile = CFile::MakeFileArray($fileData["file_id"]);
$arFile["del"] = $fileData["del"];
$arFile["old_file"] = $fileData["file_id"];
} else {
$bModify = false;
if (strlen($tmpVal) > 0) {
$tmpVal .= ", " . $fileData["file_id"];
} else {
$tmpVal = $fileData["file_id"];
}
}
} else {
// new file array
$arFile = $fileData;
}
if (isset($arFile["name"]) && strlen($arFile["name"]) > 0 && $bModify) {
$arFile["MODULE_ID"] = "sale";
$fid = CFile::SaveFile($arFile, "sale");
if (intval($fid) > 0) {
if (strlen($tmpVal) > 0) {
$tmpVal .= ", " . $fid;
} else {
$tmpVal = $fid;
}
}
}
}
$curVal = $tmpVal;
}
if (strlen($curVal) > 0) {
$arFields = array("ORDER_ID" => $orderId, "ORDER_PROPS_ID" => $arOrderProperty["ID"], "NAME" => $arOrderProperty["NAME"], "CODE" => $arOrderProperty["CODE"], "VALUE" => $curVal);
if (array_key_exists($arOrderProperty["ID"], $arIDs)) {
CSaleOrderPropsValue::Update($arIDs[$arOrderProperty["ID"]], $arFields);
unset($arIDs[$arOrderProperty["ID"]]);
} else {
CSaleOrderPropsValue::Add($arFields);
}
}
}
foreach ($arIDs as $id) {
CSaleOrderPropsValue::Delete($id);
}
}
示例6: array
}
// prepare property for database & set defaults
$propertyForDB = array();
foreach ($commonSettings + $inputSettings + $stringSettings + $locationSettings as $name => $input) {
$propertyForDB[$name] = Input\Manager::getValue($input, $property[$name]);
}
$propertyForDB['SETTINGS'] = array_intersect_key($propertyForDB, $inputSettings);
$propertyForDB = array_diff_key($propertyForDB, $propertyForDB['SETTINGS']);
// 1. update property
if ($propertyId) {
$update = OrderPropsTable::update($propertyId, array_diff_key($propertyForDB, array('ID' => 1)));
if ($update->isSuccess()) {
$propertyCode = ($v = $property['CODE']) ? $v : false;
$result = CSaleOrderPropsValue::GetList($b = 'ID', $o = 'ASC', array('ORDER_PROPS_ID' => $propertyId, '!CODE' => $propertyCode));
while ($row = $result->Fetch()) {
CSaleOrderPropsValue::Update($row['ID'], array('CODE' => $propertyCode));
}
} else {
$errors[] = loc::getMessage('ERROR_EDIT_PROP') . ': ' . implode(', ', $update->getErrorMessages());
}
} else {
$insert = OrderPropsTable::add($propertyForDB);
if ($insert->isSuccess()) {
$propertyId = $property['ID'] = $insert->getId();
} else {
$errors[] = loc::getMessage('ERROR_ADD_PROP') . ': ' . implode(', ', $insert->getErrorMessages());
}
}
// cleanup files
if ($errors) {
if (isset($savedFiles)) {
示例7: array
'comments',
);
if($json['order']["delivery_address_street"] == NULL){
$json['order']["delivery_address_street"] = $json['order']["delivery_address"];
}
foreach ($gp_prop_list as $v) {
$code = COption::GetOptionString($moduleID, 'match_id_'.$person_type_id.'_'.$v);
$is_code_found = false;
$props3[] = $v;
foreach ($order_props as $prop) {
$props4[] = 'ORDER_PROP_'.$prop['ORDER_PROPS_ID'] . ' || ' . $code;
if ('ORDER_PROP_'.$prop['ORDER_PROPS_ID'] == $code) {
$is_code_found = true;
$props2[] = $prop['VALUE'] . ' | ' . $json['order'][$v];
if ($prop['VALUE'] != $json['order'][$v]) {
if (CSaleOrderPropsValue::Update($prop['ID'], array("ORDER_ID" => $order['ID'], "VALUE" => $json['order'][$v]))) {
$message[] = 'order prop '.$v.' is updated';
} else { $error[] = 'could not update order property for '.$v; }
}
}
}
if (!$is_code_found && $json['order'][$v] && $new_prop_id = intVal(str_replace("ORDER_PROP_", "", $code))) {
$new_prop_res = CSaleOrderProps::GetList(array(), array("ID" => $new_prop_id));
if ($new_prop_ar = $new_prop_res->Fetch()) {
if ($new_prop_add_result = CSaleOrderPropsValue::Add(array("ORDER_ID" => $order['ID'], "ORDER_PROPS_ID" => $new_prop_id, "VALUE" => $json['order'][$v], "NAME" => $new_prop_ar['NAME'], "CODE" => $new_prop_ar['CODE']))) {
$message[] = 'order prop '.$v.' is added';
} else { $error[] = 'could not add order property for '.$v; }
}
}
}
示例8: die
<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();?>
<?
$orderId = htmlspecialchars( $_GET['orderId'] );
$ORDER_ID = (int)$_GET['ORDER_ID'];
if ($arOrder = CSaleOrder::GetByID($ORDER_ID)) {
$res = CSaleOrderProps::GetList(array(), array('CODE'=>CSalePaySystemAction::GetParamValue('ORDER_BANK'), 'PERSON_TYPE_ID'=>$arOrder['PERSON_TYPE_ID']), false, false, array());
if ($ar = $res->GetNext()) {
// запишем orderId
$resProp = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $ORDER_ID, 'CODE'=>CSalePaySystemAction::GetParamValue('ORDER_BANK')), false, false, array());
if ($arProp = $resProp->GetNext()) {
CSaleOrderPropsValue::Update($arProp['ID'], array("VALUE"=>$orderId));
} else {
$arFields = array(
"ORDER_ID" => $ORDER_ID,
"ORDER_PROPS_ID" => $ar['ID'],
"NAME" => $ar['NAME'],
"CODE" => $ar['CODE'],
"VALUE" => $orderId,
);
CSaleOrderPropsValue::Add($arFields);
}
}
$url = CSalePaySystemAction::GetParamValue('URL_API').'getOrderStatus.do?';
$json = file_get_contents( $url.'userName='.urlencode( CSalePaySystemAction::GetParamValue('LOGIN') ).'&password='.urlencode( CSalePaySystemAction::GetParamValue('PASS') ).'&orderId='.urlencode($orderId) );
$obj = json_decode($json);
if($obj->{'errorCode'} == 0 && $obj->{'OrderStatus'} == 2):
CModule::IncludeModule('sale');
// оплачено
CSaleOrder::PayOrder($ORDER_ID, 'Y');
if (CSalePaySystemAction::GetParamValue('STATUS_PAY')) {
示例9: formAndSendDataToGP
//.........这里部分代码省略.........
}
}
}
// send data to GP server
if ($options["URL"]) {
$arConfig = self::$CONFIG;
$stop_send = false;
$ch = curl_init();
if (intVal($_POST[$post_key['gp_order_id']]) == 0) {
$type = "POST";
//$options["URL"] = COption::GetOptionString(self::$MODULE_ID, 'POST_url');
$options["URL"] = COption::GetOptionString(self::$MODULE_ID, 'gp_script_url') . $arConfig["POST_URL"];
}
if ($type == "POST" && !empty($post_data['widget_token'])) {
$post_data['with_draft'] = true;
}elseif($type == "POST" && empty($post_data['widget_token'])){
$post_data['with_draft'] = false;
}
// set data for sending to GP server
$send_data = json_encode($post_data);
if ($type == "POST") {
curl_setopt($ch, CURLOPT_POST, true);
} elseif ($type == "PATCH") {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
} else {
$stop_send = true;
}
curl_setopt($ch, CURLOPT_URL, $options["URL"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, $send_data);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if (!$stop_send) {
$result = json_decode(curl_exec($ch), true);
}
curl_close($ch);
if (is_array($result['error_message']) && count($result['error_message']) == 1) {
$comment = implode("\r\n", $result['error_message']);
$comment = CGPWidget::Translate($comment);
CSaleOrder::SetMark($ID, $comment);
} elseif (is_array($result['error_message']) && count($result['error_message']) > 1) {
$comment = $result['error_message'];
$ar_comment = "";
foreach($comment as $com){
$ar_comment .= CGPWidget::Translate($com).". ";
}
CSaleOrder::SetMark($ID, $ar_comment);
} elseif ($result) {
if ($order_is_marked) {
CSaleOrder::UnsetMark($ID);
}
if (intVal($_POST[$post_key['gp_order_id_0']]) == 0 && $result['id']/* && intVal($_POST[$post_key['gp_order_id']]) != $result['id']*/) {
// $_POST[$post_key['gp_order_id']] = $result['id'];
if ($gp_order_id_prop_id = intVal(str_replace("ORDER_PROP_", "", $post_key['gp_order_id_0']))) {
$gp_order_id_res = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => $ID, "ORDER_PROPS_ID" => $gp_order_id_prop_id));
if ($gp_order_id_ar = $gp_order_id_res->Fetch()) {
$gp_order_id_prop_value_id = $gp_order_id_ar['ID'];
if ($gp_order_id_prop_value_id) {
$gp_order_id_add_result = CSaleOrderPropsValue::Update($gp_order_id_prop_value_id, array("ORDER_ID" => $ID, "VALUE" => $result['id']));
}
} else {
$gp_order_id_prop_res = CSaleOrderProps::GetList(array(), array("ID" => $gp_order_id_prop_id));
if ($gp_order_id_prop_ar = $gp_order_id_prop_res->Fetch()) {
$gp_order_id_add_result = CSaleOrderPropsValue::Add(array("ORDER_ID" => $ID, "ORDER_PROPS_ID" => $gp_order_id_prop_id, "VALUE" => $result['id'], "NAME" => $gp_order_id_prop_ar['NAME'], "CODE" => $gp_order_id_prop_ar['CODE']));
}
}
}
}
}
/*
echo "<pre>";
var_dump($_POST);
var_dump($post_data);
var_dump($result);
echo "</pre>";
die();*/
}
// log everything
$filename = $_SERVER['DOCUMENT_ROOT'] . '/templog.log';
$data = array($type, date('d.m.Y h:i:s'), "ORDER" => $ID, "URL" => $options["URL"], "SEND" => $send_data, "RESULT" => $result, "ARFIELDS" => $arFields);
// $data = array($type, date('d.m.Y h:i:s'), "ORDER" => $ID, "URL" => $options["URL"], "SEND" => $send_data, "gpid" => array('add' => $m, 'res' => $gp_order_id_add_result, '1' => array($gp_order_id_prop_value_id, array("ORDER_ID" => $ID, "VALUE" => $result['id'])), 'ar' => $gp_order_id_ar, 'val' => $gp_order_id_prop_value_id, 'post_gpoid' => $result['id'], "ORDER_ID" => $ID, 'ORDER_PROPS_ID' => str_replace("ORDER_PROP_", "", $post_key['gp_order_id'])), array($_POST[$post_key['gp_order_id']], $post_key['gp_order_id']), "RESULT" => $result);
// $data = array($type, date('d.m.Y h:i:s'), $ID, $send_data, $result, $city_name, $city_id, $post_key, $_POST);
file_put_contents($filename, var_export($data, true), FILE_APPEND | LOCK_EX);
}
示例10: updateProps
protected static function updateProps($value, $code, $param)
{
if ($value == '' || !CModule::IncludeModule('sale')) {
return false;
}
$add = false;
if (isset($param['update'][$param['options'][$param['type']][$code]]) == false) {
if ($arProp = CSaleOrderProps::GetList(array(), array('CODE' => $param['options'][$param['type']][$code]))->Fetch()) {
$param['update'][$param['options'][$param['type']][$code]] = array('NAME' => $arProp['NAME'], 'CODE' => $arProp['CODE'], 'ORDER_PROPS_ID' => $arProp['ID'], 'TYPE' => $arProp['TYPE'], 'ORDER_ID' => $param['orderId'], 'VALUE' => '');
$add = true;
} else {
return false;
}
}
if ($param['update'][$param['options'][$param['type']][$code]]['TYPE'] == 'LOCATION') {
$value = self::getLocation($value);
if ($value == false) {
return false;
}
}
if ($param['update'][$param['options'][$param['type']][$code]]['VALUE'] != $value) {
if ($add === true) {
$param['update'][$param['options'][$param['type']][$code]]['VALUE'] = $value;
CSaleOrderPropsValue::Add($param['update'][$param['options'][$param['type']][$code]]);
} else {
CSaleOrderPropsValue::Update($param['update'][$param['options'][$param['type']][$code]]['ID'], array('VALUE' => $value));
}
}
}