本文整理汇总了PHP中CSaleBasket::OrderDelivery方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleBasket::OrderDelivery方法的具体用法?PHP CSaleBasket::OrderDelivery怎么用?PHP CSaleBasket::OrderDelivery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleBasket
的用法示例。
在下文中一共展示了CSaleBasket::OrderDelivery方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DeliverOrder
function DeliverOrder($ID, $val, $recurringID = 0, $arAdditionalFields = array())
{
global $DB, $USER;
$ID = IntVal($ID);
$val = $val != "Y" ? "N" : "Y";
$recurringID = IntVal($recurringID);
$NO_CHANGE_STATUS = "N";
if (is_set($arAdditionalFields["NOT_CHANGE_STATUS"]) && $arAdditionalFields["NOT_CHANGE_STATUS"] == "Y") {
$NO_CHANGE_STATUS = "Y";
unset($arAdditionalFields["NOT_CHANGE_STATUS"]);
}
if ($ID <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGO_NO_ORDER_ID"), "NO_ORDER_ID");
return False;
}
$arOrder = CSaleOrder::GetByID($ID);
if (!$arOrder) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $ID, GetMessage("SKGO_NO_ORDER")), "NO_ORDER");
return False;
}
if ($arOrder["ALLOW_DELIVERY"] == $val) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $ID, GetMessage("SKGO_DUB_DELIVERY")), "ALREADY_FLAG");
return False;
}
foreach (GetModuleEvents("sale", "OnSaleBeforeDeliveryOrder", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($ID, $val, $recurringID, $arAdditionalFields)) === false) {
return false;
}
}
$arFields = array("ALLOW_DELIVERY" => $val, "=DATE_ALLOW_DELIVERY" => $DB->GetNowFunction(), "EMP_ALLOW_DELIVERY_ID" => IntVal($USER->GetID()) > 0 ? IntVal($USER->GetID()) : false);
if (count($arAdditionalFields) > 0) {
foreach ($arAdditionalFields as $addKey => $addValue) {
if (!array_key_exists($addKey, $arFields)) {
$arFields[$addKey] = $addValue;
}
}
}
$res = CSaleOrder::Update($ID, $arFields);
unset($GLOBALS["SALE_ORDER"]["SALE_ORDER_CACHE_" . $ID]);
if ($recurringID <= 0) {
if (IntVal($arOrder["RECURRING_ID"]) > 0) {
$recurringID = IntVal($arOrder["RECURRING_ID"]);
}
}
CSaleBasket::OrderDelivery($ID, $val == "Y" ? True : False, $recurringID);
foreach (GetModuleEvents("sale", "OnSaleDeliveryOrder", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID, $val));
}
if ($val == "Y") {
CTimeZone::Disable();
$arOrder = CSaleOrder::GetByID($ID);
CTimeZone::Enable();
if ($NO_CHANGE_STATUS != "Y") {
$orderStatus = COption::GetOptionString("sale", "status_on_allow_delivery", "");
if (strlen($orderStatus) > 0 && $orderStatus != $arOrder["STATUS_ID"]) {
$dbStatus = CSaleStatus::GetList(array("SORT" => "ASC"), array("LID" => LANGUAGE_ID), false, false, array("ID", "SORT"));
while ($arStatus = $dbStatus->GetNext()) {
$arStatuses[$arStatus["ID"]] = $arStatus["SORT"];
}
if ($arStatuses[$orderStatus] >= $arStatuses[$arOrder["STATUS_ID"]]) {
CSaleOrder::StatusOrder($ID, $orderStatus);
}
}
}
$userEMail = "";
$dbOrderProp = CSaleOrderPropsValue::GetList(array(), array("ORDER_ID" => $arOrder["ID"], "PROP_IS_EMAIL" => "Y"));
if ($arOrderProp = $dbOrderProp->Fetch()) {
$userEMail = $arOrderProp["VALUE"];
}
if (strlen($userEMail) <= 0) {
$dbUser = CUser::GetByID($arOrder["USER_ID"]);
if ($arUser = $dbUser->Fetch()) {
$userEMail = $arUser["EMAIL"];
}
}
$eventName = "SALE_ORDER_DELIVERY";
$arFields = array("ORDER_ID" => $ID, "ORDER_DATE" => $arOrder["DATE_INSERT_FORMAT"], "EMAIL" => $userEMail, "SALE_EMAIL" => COption::GetOptionString("sale", "order_email", "order@" . $_SERVER["SERVER_NAME"]));
$bSend = true;
foreach (GetModuleEvents("sale", "OnOrderDeliverSendEmail", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($ID, &$eventName, &$arFields)) === false) {
$bSend = false;
}
}
if ($bSend) {
$event = new CEvent();
$event->Send($eventName, $arOrder["LID"], $arFields, "N");
}
}
//reservation
if (COption::GetOptionString("sale", "product_reserve_condition", "O") == "D") {
if (!CSaleOrder::ReserveOrder($ID, $val)) {
return false;
}
}
//proceed to deduction
if ($val == "Y") {
$allowDeduction = COption::GetOptionString("sale", "allow_deduction_on_delivery", "");
if ($allowDeduction == "Y" && $arOrder["DEDUCTED"] == "N") {
CSaleOrder::DeductOrder($ID, "Y");
}
//.........这里部分代码省略.........
示例2: OrderPayment
function OrderPayment($orderID, $bPaid, $recurringID = 0)
{
CSaleBasket::OrderDelivery($orderID, $bPaid, $recurringID);
}