本文整理汇总了PHP中CSaleOrderPropsValue::Delete方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleOrderPropsValue::Delete方法的具体用法?PHP CSaleOrderPropsValue::Delete怎么用?PHP CSaleOrderPropsValue::Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleOrderPropsValue
的用法示例。
在下文中一共展示了CSaleOrderPropsValue::Delete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$order[ $code ] = $arUpdateProps[$optionsOrderProps[$arFields['PERSON_TYPE_ID']][$code]]['VALUE'];
}
}
}
//update ordertype
CSaleOrder::Update($order['externalId'], array('PERSON_TYPE_ID' => $optionsOrderTypes[ $order['orderType'] ]));
$arProp = CSaleOrderProps::GetList(array(), array('PERSON_TYPE_ID' => $optionsOrderTypes[ $order['orderType'] ]));
$typeParam = array();
while ($ar = $arProp->Fetch()) {
$typeParam[ $ar['CODE'] ] = $ar['CODE'];
}
foreach (array_diff_key($arUpdateProps, $typeParam) as $code => $param) {
if (isset($arUpdateProps[$code])) {
CSaleOrderPropsValue::Delete($param['ID']);
}
}
$arFields['PERSON_TYPE_ID'] = $optionsOrderTypes[ $order['orderType'] ];
}
array_walk_recursive(
ICrmOrderActions::clearArr($order),
'ICrmOrderActions::recursiveUpdate',
array(
'update' => $arUpdateProps,
'type' => $arFields['PERSON_TYPE_ID'],
'options' => $optionsOrderProps,
'orderId' => $order['externalId']
)
);
示例2: 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);
}
}
示例3: 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);
}
}
示例4: orderHistory
//.........这里部分代码省略.........
}
$LID = $arFields['LID'];
$userId = $arFields['USER_ID'];
if (isset($order['customer']['externalId']) && !is_null($order['customer']['externalId'])) {
$userId = $order['customer']['externalId'];
}
$rsOrderProps = CSaleOrderPropsValue::GetList(array(), array('ORDER_ID' => $arFields['ID']));
$arUpdateProps = array();
while ($ar = $rsOrderProps->Fetch()) {
$prop = CSaleOrderProps::GetByID($ar['ORDER_PROPS_ID']);
$arUpdateProps[$ar['CODE']] = array('ID' => $ar['ID'], 'TYPE' => $prop['TYPE'], 'VALUE' => $ar['VALUE']);
}
$order['fio'] = trim(implode(' ', array(isset($order['lastName']) ? $order['lastName'] : '', isset($order['firstName']) ? $order['firstName'] : '', isset($order['patronymic']) ? $order['patronymic'] : '')));
if (isset($order['delivery']['address']['city'])) {
$order['location'] = $order['delivery']['address']['city'];
}
if (isset($order['orderType']) && isset($optionsOrderTypes[$order['orderType']])) {
if (isset($optionsOrderProps[$arFields['PERSON_TYPE_ID']])) {
foreach ($optionsOrderProps[$arFields['PERSON_TYPE_ID']] as $code => $value) {
if (in_array($code, array_keys($order)) === false && isset($optionsOrderProps[$optionsOrderTypes[$order['orderType']]][$code])) {
$order[$code] = $arUpdateProps[$optionsOrderProps[$arFields['PERSON_TYPE_ID']][$code]]['VALUE'];
}
}
}
//update ordertype
CSaleOrder::Update($order['externalId'], array('PERSON_TYPE_ID' => $optionsOrderTypes[$order['orderType']]));
$arProp = CSaleOrderProps::GetList(array(), array('PERSON_TYPE_ID' => $optionsOrderTypes[$order['orderType']]));
$typeParam = array();
while ($ar = $arProp->Fetch()) {
$typeParam[$ar['CODE']] = $ar['CODE'];
}
foreach (array_diff_key($arUpdateProps, $typeParam) as $code => $param) {
if (isset($arUpdateProps[$code])) {
CSaleOrderPropsValue::Delete($param['ID']);
}
}
$arFields['PERSON_TYPE_ID'] = $optionsOrderTypes[$order['orderType']];
}
array_walk_recursive(self::clearArr($order), 'self::recursiveUpdate', array('update' => $arUpdateProps, 'type' => $arFields['PERSON_TYPE_ID'], 'options' => $optionsOrderProps, 'orderId' => $order['externalId']));
foreach ($order['items'] as $item) {
if (isset($item['deleted']) && $item['deleted']) {
if ($p = CSaleBasket::GetList(array(), array('ORDER_ID' => $order['externalId'], 'PRODUCT_ID' => $item['id']))->Fetch()) {
if (!CSaleBasket::Delete($p['ID'])) {
self::eventLog('ICrmOrderActions::orderHistory', 'CSaleBasket::Delete', 'Error element delete');
}
} else {
$prp = CSaleBasket::GetPropsList(array(), array("ORDER_ID" => $order['externalId'], "CODE" => 'ID', "VALUE" => $item['id']))->Fetch();
if (!CSaleBasket::Delete($prp['BASKET_ID'])) {
self::eventLog('ICrmOrderActions::orderHistory', 'CSaleBasket::Delete', 'Error castom element delete');
}
}
continue;
}
if (isset($item['offer']) === false && isset($item['offer']['externalId']) === false) {
continue;
}
$res = CIBlockElement::GetByID($item['offer']['externalId'])->Fetch();
if ($res) {
$p = CSaleBasket::GetList(array(), array('ORDER_ID' => $order['externalId'], 'PRODUCT_ID' => $item['offer']['externalId']))->Fetch();
if ($p == false) {
$p = CIBlockElement::GetByID($item['offer']['externalId'])->GetNext();
$iblock = CIBlock::GetByID($p['IBLOCK_ID'])->Fetch();
$p['CATALOG_XML_ID'] = $iblock['XML_ID'];
$p['PRODUCT_XML_ID'] = $p['XML_ID'];
unset($p['XML_ID']);
} elseif ($propResult = CSaleBasket::GetPropsList(array(''), array('BASKET_ID' => $p['ID']))) {