本文整理汇总了PHP中Bitrix\Sale\Order::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::delete方法的具体用法?PHP Order::delete怎么用?PHP Order::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitrix\Sale\Order
的用法示例。
在下文中一共展示了Order::delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* Delete the order
* @param int $id Order ID.
* @return Sale\Result
* @throws \Bitrix\Main\ArgumentNullException
*/
public static function delete($id)
{
$result = new Sale\Result();
if (intval($id) <= 0) {
$result->addError(new Sale\ResultError(Main\Localization\Loc::getMessage('SALE_COMPATIBLE_ORDER_ID_NOT_FOUND'), 'SALE_COMPATIBLE_ORDER_ID_NOT_FOUND'));
return $result;
}
$r = Sale\Order::delete($id);
if (!$r->isSuccess()) {
$result->addErrors($r->getErrors());
}
return $result;
}
示例2: delete
/**
* Delete the order
* @param int $id Order ID.
* @return Sale\Result
* @throws \Bitrix\Main\ArgumentNullException
*/
public static function delete($id)
{
$result = new Sale\Result();
if (intval($id) <= 0) {
$result->addError(new Sale\ResultError(Main\Localization\Loc::getMessage('SALE_COMPATIBLE_ORDER_ID_NOT_FOUND'), 'SALE_COMPATIBLE_ORDER_ID_NOT_FOUND'));
return $result;
}
/** @var Sale\Order $order */
if (!($order = Sale\Order::load($id))) {
$result->addError(new Sale\ResultError(Loc::getMessage('SALE_ORDER_ENTITY_NOT_FOUND'), 'SALE_ORDER_ENTITY_NOT_FOUND'));
return $result;
}
/** @var Sale\PaymentCollection $paymentCollection */
if ($paymentCollection = $order->getPaymentCollection()) {
/** @var Sale\Payment $payment */
foreach ($paymentCollection as $payment) {
if ($payment->isPaid()) {
$payment->setPaid('N');
}
}
/** @var Sale\Result $r */
$r = $order->save();
if (!$r->isSuccess()) {
return $r;
}
}
/** @var Sale\Result $r */
$r = Sale\Order::delete($id);
if (!$r->isSuccess()) {
$result->addErrors($r->getErrors());
}
return $result;
}
示例3: str_replace
continue;
}
if (CSaleOrder::IsLocked($ID, $lockedBY, $dateLock) && $_REQUEST['action'] != "unlock") {
$lAdmin->AddGroupError(str_replace("#DATE#", "{$dateLock}", str_replace("#ID#", "{$lockedBY}", Loc::getMessage("SOE_ORDER_LOCKED"))), $ID);
} else {
switch ($_REQUEST['action']) {
case "delete":
if (!($saleOrder = \Bitrix\Sale\Order::load($ID))) {
$lAdmin->AddGroupError(Loc::getMessage("SALE_DELETE_ERROR_CANT_FIND", array("#ID#" => $ID)));
break;
}
if (!CSaleOrder::CanUserDeleteOrder($ID, $arUserGroups, $intUserID)) {
$lAdmin->AddGroupError(Loc::getMessage("SO_NO_PERMS2DEL", array("#ID#" => $ID)), $ID);
break;
}
$res = \Bitrix\Sale\Order::delete($ID);
if (!$res->isSuccess()) {
$lAdmin->AddGroupError(implode("<br>\n", $res->getErrorMessages()));
}
break;
case "unlock":
CSaleOrder::UnLock($ID);
break;
case "cancel":
if (!CSaleOrder::CanUserCancelOrder($ID, $arUserGroups, $intUserID)) {
$lAdmin->AddGroupError(Loc::getMessage("SOA_PERMS_CANCEL_GROUP", array("#ID#" => $ID)), $ID);
break;
}
/** @var \Bitrix\Sale\Order $saleOrder */
if (!($saleOrder = \Bitrix\Sale\Order::load($ID))) {
$lAdmin->AddGroupError(Loc::getMessage("SO_NO_ORDER", array("#ID#" => $ID)), $ID);