本文整理汇总了PHP中CSaleOrderProps::DoSaveOrderProps方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleOrderProps::DoSaveOrderProps方法的具体用法?PHP CSaleOrderProps::DoSaveOrderProps怎么用?PHP CSaleOrderProps::DoSaveOrderProps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleOrderProps
的用法示例。
在下文中一共展示了CSaleOrderProps::DoSaveOrderProps方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processOrderStatusRequest
protected function processOrderStatusRequest($arPostData)
{
$arResult = array();
if ($this->checkOrderStatusRequest($arPostData)) {
$dbOrder = CSaleOrder::GetList(array(), array("XML_ID" => self::XML_ID_PREFIX . $arPostData["order"]["id"]));
if ($arOrder = $dbOrder->Fetch()) {
$reason = "";
switch ($arPostData["order"]["status"]) {
case 'PROCESSING':
$locationId = $this->locationMapper->getLocationByCityName($arPostData["order"]["delivery"]["region"]["name"]);
if ($locationId === false) {
$this->log(self::LOG_LEVEL_INFO, "YMARKET_LOCATION_MAPPING", $arPostData["order"]["delivery"]["region"]["name"], GetMessage("SALE_YMH_LOCATION_NOT_FOUND"));
}
$arOrderPropsValues = $this->makeAdditionalOrderProps($arPostData["order"]["delivery"]["address"], $arPostData["order"]["buyer"], isset($this->mapPaySystems[$arPostData["order"]["paymentMethod"]]) ? $this->mapPaySystems[$arPostData["order"]["paymentMethod"]] : "", $arPostData["order"]["delivery"]["id"], $locationId);
$arErrors = array();
CSaleOrderProps::DoSaveOrderProps($arOrder["ID"], $this->personTypeId, $arOrderPropsValues, $arErrors);
$this->sendEmailNewOrder($arOrder["ID"], $arPostData["order"]["buyer"]);
if (!empty($arErrors)) {
$this->log(self::LOG_LEVEL_ERROR, "YMARKET_INCOMING_ORDER_STATUS", $arPostData["order"]["id"], print_r($arErrors, true));
} else {
$this->log(self::LOG_LEVEL_INFO, "YMARKET_INCOMING_ORDER_STATUS", $arPostData["order"]["id"], GetMessage("SALE_YMH_INCOMING_ORDER_STATUS_PROCESSING") . ": " . $arOrder["ID"]);
}
if (isset($arPostData["order"]["paymentMethod"]) && $arPostData["order"]["paymentMethod"] == "YANDEX") {
CSaleOrder::PayOrder($arOrder["ID"], "Y");
}
break;
case 'UNPAID':
case 'DELIVERY':
case 'PICKUP':
case 'DELIVERED ':
break;
case 'CANCELLED':
if (isset($arPostData["order"]["substatus"])) {
$reason = GetMessage("SALE_YMH_SUBSTATUS_" . $arPostData["order"]["substatus"]);
}
break;
default:
$arResult = $this->processError(self::ERROR_STATUS_400, GetMessage("SALE_YMH_ERROR_UNKNOWN_STATUS"));
break;
}
$this->mapYandexStatusToOrder($arOrder, $arPostData["order"]["status"], $reason);
}
} else {
$arResult = $this->processError(self::ERROR_STATUS_400, GetMessage("SALE_YMH_ERROR_BAD_STRUCTURE"));
}
return $arResult;
}
示例2: DoSaveOrder
/**
*
*
*/
public static function DoSaveOrder(&$arOrder, $arAdditionalFields, $orderId, &$arErrors, $arCoupons = array(), $arStoreBarcodeOrderFormData = array(), $bSaveBarcodes = false)
{
global $APPLICATION;
$orderId = (int) $orderId;
$isNew = $orderId <= 0;
$isOrderConverted = \Bitrix\Main\Config\Option::get("main", "~sale_converted_15", 'N');
$arFields = array("ID" => $arOrder["ID"], "LID" => $arOrder["SITE_ID"], "PERSON_TYPE_ID" => $arOrder["PERSON_TYPE_ID"], "PRICE" => $arOrder["PRICE"], "CURRENCY" => $arOrder["CURRENCY"], "USER_ID" => $arOrder["USER_ID"], "PAY_SYSTEM_ID" => $arOrder["PAY_SYSTEM_ID"], "PRICE_DELIVERY" => $arOrder["DELIVERY_PRICE"], "DELIVERY_ID" => strlen($arOrder["DELIVERY_ID"]) > 0 ? $arOrder["DELIVERY_ID"] : false, "DISCOUNT_VALUE" => $arOrder["DISCOUNT_PRICE"], "TAX_VALUE" => $arOrder["TAX_VALUE"], "TRACKING_NUMBER" => $arOrder["TRACKING_NUMBER"]);
if ($arOrder["DELIVERY_PRICE"] == $arOrder["PRICE_DELIVERY"] && isset($arOrder['PRICE_DELIVERY_DIFF']) && floatval($arOrder['PRICE_DELIVERY_DIFF']) > 0) {
$arFields["DELIVERY_PRICE"] = $arOrder['PRICE_DELIVERY_DIFF'] + $arOrder["PRICE_DELIVERY"];
}
if ($orderId <= 0) {
$arFields["PAYED"] = "N";
$arFields["CANCELED"] = "N";
$arFields["STATUS_ID"] = "N";
}
$arFields = array_merge($arFields, $arAdditionalFields);
if (!$arOrder['LOCATION_IN_CODES']) {
// it comes from places like crm_invoice`s Add() and tells us if we need to convert location props from ID to CODE
static::TranslateLocationPropertyValues($arOrder["PERSON_TYPE_ID"], $arOrder["ORDER_PROP"]);
}
unset($arOrder['LOCATION_IN_CODES']);
if ($isOrderConverted == "Y") {
$orderFields = array_merge($arOrder, $arFields, $arAdditionalFields);
if (isset($orderFields['CUSTOM_DISCOUNT_PRICE']) && $orderFields['CUSTOM_DISCOUNT_PRICE'] === true) {
Sale\Compatible\DiscountCompatibility::reInit(Sale\Compatible\DiscountCompatibility::MODE_DISABLED);
}
if (!empty($arStoreBarcodeOrderFormData)) {
$orderFields['BARCODE_LIST'] = $arStoreBarcodeOrderFormData;
}
$orderFields['BARCODE_SAVE'] = $bSaveBarcodes;
if ($orderId > 0) {
$orderFields['ID'] = $orderId;
}
/** @var Sale\Result $r */
$r = Sale\Compatible\OrderCompatibility::modifyOrder(Sale\Compatible\OrderCompatibility::ORDER_COMPAT_ACTION_SAVE, $orderFields);
if ($r->isSuccess()) {
$orderId = $r->getId();
} else {
foreach ($r->getErrorMessages() as $error) {
$arErrors[] = $error;
$APPLICATION->ThrowException($error);
}
return false;
}
} else {
if ($orderId > 0) {
$orderId = CSaleOrder::Update($orderId, $arFields);
} else {
if (COption::GetOptionString("sale", "product_reserve_condition", "O") == "O") {
$arFields["RESERVED"] = "Y";
}
$orderId = CSaleOrder::Add($arFields);
}
$orderId = (int) $orderId;
if ($orderId <= 0) {
if ($ex = $APPLICATION->GetException()) {
$arErrors[] = $ex->GetString();
} else {
$arErrors[] = Loc::getMessage("SOA_ERROR_ORDER");
}
}
if (!empty($arErrors)) {
return null;
}
CSaleBasket::DoSaveOrderBasket($orderId, $arOrder["SITE_ID"], $arOrder["USER_ID"], $arOrder["BASKET_ITEMS"], $arErrors, $arCoupons, $arStoreBarcodeOrderFormData, $bSaveBarcodes);
CSaleTax::DoSaveOrderTax($orderId, $arOrder["TAX_LIST"], $arErrors);
CSaleOrderProps::DoSaveOrderProps($orderId, $arOrder["PERSON_TYPE_ID"], $arOrder["ORDER_PROP"], $arErrors);
Sale\DiscountCouponsManager::finalApply();
Sale\DiscountCouponsManager::saveApplied();
foreach (GetModuleEvents("sale", "OnOrderSave", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($orderId, $arFields, $arOrder, $isNew));
}
}
return $orderId;
}
示例3: DoSaveOrder
/**
*
*
*/
public static function DoSaveOrder(&$arOrder, $arAdditionalFields, $orderId, &$arErrors, $arCoupons = array(), $arStoreBarcodeOrderFormData = array(), $bSaveBarcodes = false)
{
global $APPLICATION;
$orderId = (int) $orderId;
$isNew = $orderId <= 0;
$isOrderConverted = \Bitrix\Main\Config\Option::get("main", "~sale_converted_15", 'N');
$arFields = array("ID" => $arOrder["ID"], "LID" => $arOrder["SITE_ID"], "PERSON_TYPE_ID" => $arOrder["PERSON_TYPE_ID"], "PRICE" => $arOrder["PRICE"], "CURRENCY" => $arOrder["CURRENCY"], "USER_ID" => $arOrder["USER_ID"], "PAY_SYSTEM_ID" => $arOrder["PAY_SYSTEM_ID"], "PRICE_DELIVERY" => $arOrder["DELIVERY_PRICE"], "DELIVERY_ID" => strlen($arOrder["DELIVERY_ID"]) > 0 ? $arOrder["DELIVERY_ID"] : false, "DISCOUNT_VALUE" => $arOrder["DISCOUNT_PRICE"], "TAX_VALUE" => $arOrder["TAX_VALUE"], "TRACKING_NUMBER" => $arOrder["TRACKING_NUMBER"]);
if ($arOrder["DELIVERY_PRICE"] == $arOrder["PRICE_DELIVERY"] && isset($arOrder['PRICE_DELIVERY_DIFF']) && floatval($arOrder['PRICE_DELIVERY_DIFF']) > 0) {
$arFields["DELIVERY_PRICE"] = $arOrder['PRICE_DELIVERY_DIFF'] + $arOrder["PRICE_DELIVERY"];
}
if ($orderId <= 0) {
$arFields["PAYED"] = "N";
$arFields["CANCELED"] = "N";
$arFields["STATUS_ID"] = "N";
}
$arFields = array_merge($arFields, $arAdditionalFields);
if (!$arOrder['LOCATION_IN_CODES']) {
// it comes from places like crm_invoice`s Add() and tells us if we need to convert location props from ID to CODE
static::TranslateLocationPropertyValues($arOrder["PERSON_TYPE_ID"], $arOrder["ORDER_PROP"]);
}
unset($arOrder['LOCATION_IN_CODES']);
if ($isOrderConverted == "Y") {
$orderFields = array_merge($arOrder, $arFields, $arAdditionalFields);
if (!empty($arStoreBarcodeOrderFormData)) {
$orderFields['BARCODE_LIST'] = $arStoreBarcodeOrderFormData;
}
$orderFields['BARCODE_SAVE'] = $bSaveBarcodes;
if ($orderId > 0) {
$orderFields['ID'] = $orderId;
}
/** @var Sale\Result $r */
$r = Sale\Compatible\OrderCompatibility::modifyOrder(Sale\Compatible\OrderCompatibility::ORDER_COMPAT_ACTION_SAVE, $orderFields);
if ($r->isSuccess()) {
$orderId = $r->getId();
} else {
foreach ($r->getErrorMessages() as $error) {
$arErrors[] = $error;
$APPLICATION->ThrowException($error);
}
return false;
}
} else {
if ($orderId > 0) {
$orderId = CSaleOrder::Update($orderId, $arFields);
} else {
if (COption::GetOptionString("sale", "product_reserve_condition", "O") == "O") {
$arFields["RESERVED"] = "Y";
}
$orderId = CSaleOrder::Add($arFields);
}
$orderId = (int) $orderId;
if ($orderId <= 0) {
if ($ex = $APPLICATION->GetException()) {
$arErrors[] = $ex->GetString();
} else {
$arErrors[] = Loc::getMessage("SOA_ERROR_ORDER");
}
}
if (!empty($arErrors)) {
return null;
}
CSaleBasket::DoSaveOrderBasket($orderId, $arOrder["SITE_ID"], $arOrder["USER_ID"], $arOrder["BASKET_ITEMS"], $arErrors, $arCoupons, $arStoreBarcodeOrderFormData, $bSaveBarcodes);
CSaleTax::DoSaveOrderTax($orderId, $arOrder["TAX_LIST"], $arErrors);
CSaleOrderProps::DoSaveOrderProps($orderId, $arOrder["PERSON_TYPE_ID"], $arOrder["ORDER_PROP"], $arErrors);
Sale\DiscountCouponsManager::finalApply();
Sale\DiscountCouponsManager::saveApplied();
foreach (GetModuleEvents("sale", "OnOrderSave", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($orderId, $arFields, $arOrder, $isNew));
}
}
/*
// mail message
if (empty($arResult["ERROR"]))
{
$strOrderList = "";
$dbBasketItems = CSaleBasket::GetList(
array("NAME" => "ASC"),
array("ORDER_ID" => $arResult["ORDER_ID"]),
false,
false,
array("ID", "NAME", "QUANTITY", "PRICE", "CURRENCY")
);
while ($arBasketItems = $dbBasketItems->Fetch())
{
$strOrderList .= $arBasketItems["NAME"]." - ".$arBasketItems["QUANTITY"]." ".Loc::getMessage("SOA_SHT").": ".SaleFormatCurrency($arBasketItems["PRICE"], $arBasketItems["CURRENCY"]);
$strOrderList .= "\n";
}
$arFields = Array(
"ORDER_ID" => $arResult["ORDER_ID"],
"ORDER_DATE" => Date($DB->DateFormatToPHP(CLang::GetDateFormat("SHORT", SITE_ID))),
"ORDER_USER" => ( (strlen($arUserResult["PAYER_NAME"]) > 0) ? $arUserResult["PAYER_NAME"] : $USER->GetFullName() ),
"PRICE" => SaleFormatCurrency($totalOrderPrice, $arResult["BASE_LANG_CURRENCY"]),
"BCC" => COption::GetOptionString("sale", "order_email", "order@".$SERVER_NAME),
"EMAIL" => (strlen($arUserResult["USER_EMAIL"])>0 ? $arUserResult["USER_EMAIL"] : $USER->GetEmail()),
"ORDER_LIST" => $strOrderList,
//.........这里部分代码省略.........
示例4: DoSaveOrder
static function DoSaveOrder(&$arOrder, $arAdditionalFields, $orderId, &$arErrors, $arCoupons = array(), $arStoreBarcodeOrderFormData = array(), $bSaveBarcodes = false)
{
global $APPLICATION;
$orderId = intval($orderId);
$arFields = array("LID" => $arOrder["SITE_ID"], "PERSON_TYPE_ID" => $arOrder["PERSON_TYPE_ID"], "PRICE" => $arOrder["PRICE"], "CURRENCY" => $arOrder["CURRENCY"], "USER_ID" => $arOrder["USER_ID"], "PAY_SYSTEM_ID" => $arOrder["PAY_SYSTEM_ID"], "PRICE_DELIVERY" => $arOrder["DELIVERY_PRICE"], "DELIVERY_ID" => strlen($arOrder["DELIVERY_ID"]) > 0 ? $arOrder["DELIVERY_ID"] : false, "DISCOUNT_VALUE" => $arOrder["DISCOUNT_PRICE"], "TAX_VALUE" => $arOrder["TAX_VALUE"]);
if ($orderId <= 0) {
$arFields["PAYED"] = "N";
$arFields["CANCELED"] = "N";
$arFields["STATUS_ID"] = "N";
}
$arFields = array_merge($arFields, $arAdditionalFields);
if ($orderId > 0) {
$orderId = CSaleOrder::Update($orderId, $arFields);
} else {
if (COption::GetOptionString("sale", "product_reserve_condition", "O") == "O") {
$arFields["RESERVED"] = "Y";
}
$orderId = CSaleOrder::Add($arFields);
}
$orderId = intval($orderId);
if ($orderId <= 0) {
if ($ex = $APPLICATION->GetException()) {
$arErrors[] = $ex->GetString();
} else {
$arErrors[] = GetMessage("SOA_ERROR_ORDER");
}
}
if (count($arErrors) > 0) {
return null;
}
CSaleBasket::DoSaveOrderBasket($orderId, $arOrder["SITE_ID"], $arOrder["USER_ID"], $arOrder["BASKET_ITEMS"], $arErrors, $arCoupons, $arStoreBarcodeOrderFormData, $bSaveBarcodes);
CSaleTax::DoSaveOrderTax($orderId, $arOrder["TAX_LIST"], $arErrors);
CSaleOrderProps::DoSaveOrderProps($orderId, $arOrder["PERSON_TYPE_ID"], $arOrder["ORDER_PROP"], $arErrors);
/*
// mail message
if (empty($arResult["ERROR"]))
{
$strOrderList = "";
$dbBasketItems = CSaleBasket::GetList(
array("NAME" => "ASC"),
array("ORDER_ID" => $arResult["ORDER_ID"]),
false,
false,
array("ID", "NAME", "QUANTITY", "PRICE", "CURRENCY")
);
while ($arBasketItems = $dbBasketItems->Fetch())
{
$strOrderList .= $arBasketItems["NAME"]." - ".$arBasketItems["QUANTITY"]." ".GetMessage("SOA_SHT").": ".SaleFormatCurrency($arBasketItems["PRICE"], $arBasketItems["CURRENCY"]);
$strOrderList .= "\n";
}
$arFields = Array(
"ORDER_ID" => $arResult["ORDER_ID"],
"ORDER_DATE" => Date($DB->DateFormatToPHP(CLang::GetDateFormat("SHORT", SITE_ID))),
"ORDER_USER" => ( (strlen($arUserResult["PAYER_NAME"]) > 0) ? $arUserResult["PAYER_NAME"] : $USER->GetFullName() ),
"PRICE" => SaleFormatCurrency($totalOrderPrice, $arResult["BASE_LANG_CURRENCY"]),
"BCC" => COption::GetOptionString("sale", "order_email", "order@".$SERVER_NAME),
"EMAIL" => (strlen($arUserResult["USER_EMAIL"])>0 ? $arUserResult["USER_EMAIL"] : $USER->GetEmail()),
"ORDER_LIST" => $strOrderList,
"SALE_EMAIL" => COption::GetOptionString("sale", "order_email", "order@".$SERVER_NAME),
"DELIVERY_PRICE" => $arResult["DELIVERY_PRICE"],
);
$eventName = "SALE_NEW_ORDER";
$bSend = true;
foreach(GetModuleEvents("sale", "OnOrderNewSendEmail", true) as $arEvent)
if (ExecuteModuleEventEx($arEvent, Array($arResult["ORDER_ID"], &$eventName, &$arFields))===false)
$bSend = false;
if($bSend)
{
$event = new CEvent;
$event->Send($eventName, SITE_ID, $arFields, "N");
}
}
if(CModule::IncludeModule("statistic"))
{
$event1 = "eStore";
$event2 = "order_confirm";
$event3 = $arResult["ORDER_ID"];
$e = $event1."/".$event2."/".$event3;
if(!is_array($_SESSION["ORDER_EVENTS"]) || (is_array($_SESSION["ORDER_EVENTS"]) && !in_array($e, $_SESSION["ORDER_EVENTS"])))
{
CStatistic::Set_Event($event1, $event2, $event3);
$_SESSION["ORDER_EVENTS"][] = $e;
}
}
$arOrder = CSaleOrder::GetByID($arResult["ORDER_ID"]);
foreach(GetModuleEvents("sale", "OnSaleComponentOrderOneStepComplete", true) as $arEvent)
ExecuteModuleEventEx($arEvent, Array($arResult["ORDER_ID"], $arOrder));
*/
return $orderId;
}