本文整理汇总了PHP中CSaleOrder::GetByID方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleOrder::GetByID方法的具体用法?PHP CSaleOrder::GetByID怎么用?PHP CSaleOrder::GetByID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleOrder
的用法示例。
在下文中一共展示了CSaleOrder::GetByID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckFields
public static function CheckFields($ACTION, &$arFields)
{
global $DB;
if ((is_set($arFields, "ORDER_ID") || $ACTION=="ADD") && IntVal($arFields["ORDER_ID"])<=0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGOT_EMPTY_ORDER_ID"), "ERROR_NO_ORDER_ID");
return false;
}
if ((is_set($arFields, "TAX_NAME") || $ACTION=="ADD") && strlen($arFields["TAX_NAME"])<=0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGOT_EMPTY_TAX_NAME"), "ERROR_NO_TAX_NAME");
return false;
}
if ((is_set($arFields, "IS_PERCENT") || $ACTION=="ADD") && $arFields["IS_PERCENT"]!="Y" && $arFields["IS_PERCENT"]!="N")
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGOT_EMPTY_TAX_VALUE"), "ERROR_NO_IS_PERCENT");
return false;
}
if ((is_set($arFields, "IS_IN_PRICE") || $ACTION=="ADD") && $arFields["IS_IN_PRICE"]!="Y" && $arFields["IS_IN_PRICE"]!="N")
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGOT_EMPTY_IN_PRICE"), "ERROR_NO_IS_IN_PRICE");
return false;
}
if (is_set($arFields, "VALUE") || $ACTION=="ADD")
{
$arFields["VALUE"] = str_replace(",", ".", $arFields["VALUE"]);
$arFields["VALUE"] = DoubleVal($arFields["VALUE"]);
if ($arFields["VALUE"] <= 0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGOT_EMPTY_SUM"), "ERROR_NO_VALUE");
return false;
}
}
if (is_set($arFields, "VALUE_MONEY") || $ACTION=="ADD")
{
$arFields["VALUE_MONEY"] = str_replace(",", ".", $arFields["VALUE_MONEY"]);
$arFields["VALUE_MONEY"] = DoubleVal($arFields["VALUE_MONEY"]);
}
if ((is_set($arFields, "VALUE_MONEY") || $ACTION=="ADD") && $arFields["VALUE_MONEY"]<=0)
{
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGOT_EMPTY_SUM_MONEY"), "ERROR_NO_VALUE_MONEY");
return false;
}
if (is_set($arFields, "ORDER_ID"))
{
if (!($arOrder = CSaleOrder::GetByID($arFields["ORDER_ID"])))
{
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["ORDER_ID"], GetMessage("SKGOT_NO_ORDER")), "ERROR_NO_ORDER");
return false;
}
}
if ((is_set($arFields, "CODE") || $ACTION=="ADD") && strlen($arFields["CODE"])<=0)
$arFields["CODE"] = false;
return true;
}
示例2: CheckFields
public static function CheckFields($ACTION, &$arFields, $ID = 0)
{
if ((is_set($arFields, "ORDER_ID") || $ACTION == "ADD") && IntVal($arFields["ORDER_ID"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGOPV_EMPTY_ORDER_ID"), "EMPTY_ORDER_ID");
return false;
}
if ((is_set($arFields, "ORDER_PROPS_ID") || $ACTION == "ADD") && IntVal($arFields["ORDER_PROPS_ID"]) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGOPV_EMPTY_PROP_ID"), "EMPTY_ORDER_PROPS_ID");
return false;
}
if (is_set($arFields, "ORDER_ID")) {
if (!($arOrder = CSaleOrder::GetByID($arFields["ORDER_ID"]))) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["ORDER_ID"], GetMessage("SKGOPV_NO_ORDER_ID")), "ERROR_NO_ORDER");
return false;
}
}
if (is_set($arFields, "ORDER_PROPS_ID")) {
if (!($arOrder = CSaleOrderProps::GetByID($arFields["ORDER_PROPS_ID"]))) {
$GLOBALS["APPLICATION"]->ThrowException(str_replace("#ID#", $arFields["ORDER_PROPS_ID"], GetMessage("SKGOPV_NO_PROP_ID")), "ERROR_NO_PROPERY");
return false;
}
if (is_set($arFields, "ORDER_ID")) {
$arFilter = array("ORDER_ID" => $arFields["ORDER_ID"], "ORDER_PROPS_ID" => $arFields["ORDER_PROPS_ID"]);
if (IntVal($ID) > 0) {
$arFilter["!ID"] = $ID;
}
$dbP = CSaleOrderPropsValue::GetList(array(), $arFilter);
if ($arP = $dbP->Fetch()) {
$GLOBALS["APPLICATION"]->ThrowException(GetMessage("SKGOPV_DUPLICATE_PROP_ID", array("#ID#" => $arFields["ORDER_PROPS_ID"], "#ORDER_ID#" => $arFields["ORDER_ID"])), "ERROR_DUPLICATE_PROP_ID");
return false;
}
}
}
return True;
}
示例3: onFinishChange
/**
* @param \DDelivery\Order\DDeliveryOrder $order
* @throws \Bitrix\Main\ArgumentException
*/
public function onFinishChange($order)
{
global $APPLICATION;
$point = $order->getPoint();
if ($order->type == DDeliverySDK::TYPE_SELF) {
$replaceData = array('%1' => $order->cityName, '%2' => $point['address'], '%3' => $point['delivery_company_name'], '%4' => $point['_id'], '%5' => $point['type'] == 1 ? 'Постомат' : 'ПВЗ');
$replaceData = $APPLICATION->ConvertCharsetArray($replaceData, 'UTF-8', SITE_CHARSET);
$comment = GetMessage('DDELIVERY_ABOUT_SELF', $replaceData);
} else {
if ($order->type == DDeliverySDK::TYPE_COURIER) {
$replaceData = array('%1' => $order->getFullAddress(), '%2' => $point['delivery_company_name']);
$replaceData = $APPLICATION->ConvertCharsetArray($replaceData, 'UTF-8', SITE_CHARSET);
$comment = GetMessage('DDELIVERY_ABOUT_COURIER', $replaceData);
} else {
$comment = 'error';
}
}
$orderId = $this->formData['bx_order_id'];
$params = array('DD_ABOUT' => $comment, 'DD_LOCAL_ID' => $order->localId);
$orderDeliveryTableData = OrderDeliveryTable::getList(array('filter' => array('ORDER_ID' => $orderId)))->fetch();
if ($orderDeliveryTableData) {
OrderDeliveryTable::update($orderDeliveryTableData['ID'], array('PARAMS' => serialize($params)));
} else {
OrderDeliveryTable::add(array('ORDER_ID' => $orderId, 'PARAMS' => serialize($params)));
}
$order = CSaleOrder::GetByID($orderId);
$arDeliveryResult = CSaleDeliveryHandler::CalculateFull('ddelivery', 'ddelivery:all', $order, CSaleLang::GetLangCurrency(SITE_ID), SITE_ID);
if ($arDeliveryResult['RESULT'] == 'OK') {
CSaleOrder::Update($orderId, array('PRICE_DELIVERY' => $arDeliveryResult['VALUE']));
}
}
示例4: __construct
public function __construct($id)
{
if (is_array($id)) {
$this->container = $id;
$this->id = $id['ID'];
} elseif ($id) {
$this->id = $id;
$this->container = \CSaleOrder::GetByID($id);
}
}
示例5: OnSaleCancelOrderHandler
public static function OnSaleCancelOrderHandler($ID, $val) {
if ( $val == 'Y' && self::$cancel ) {
$arOrder = CSaleOrder::GetByID($ID);
$resPaySystemAction = CSalePaySystemAction::GetList(array(), array('PAY_SYSTEM_ID'=>$arOrder['PAY_SYSTEM_ID'], 'PERSON_TYPE_ID'=>$arOrder['PERSON_TYPE_ID']), false, false, array());
$arPaySystemAction = $resPaySystemAction->GetNext();
$urlCancel = $_SERVER['DOCUMENT_ROOT'].$arPaySystemAction['ACTION_FILE'].'/cancel.php';
if (preg_match('/\/alfabank$/', $arPaySystemAction['ACTION_FILE']) && file_exists($urlCancel)) {
include $urlCancel;
}
}
}
示例6: OnSalePayOrderHandler
/**
* Обработчик события подтверждения оплаты товара
*/
function OnSalePayOrderHandler($id, $val)
{
$currentUserId = $GLOBALS['USER']->GetID();
//Идентификатор текущего пользователя, по идее администратор
$idRatingGroup = 5;
//группа акции
$curTo = "UAH";
//тип гривневой цены
$arOrder = CSaleOrder::GetByID($id);
//информация о заказе
$price = CCurrencyRates::ConvertCurrency(floatval($arOrder["SUM_PAID"]), $arOrder["CURRENCY"], $curTo);
$price = intval(ceil($price));
//стоимость заказа
$userId = intval($arOrder["USER_ID"]);
//пользователь, который оплатил заказ
$arUserData = CUser::GetByID($userId)->Fetch();
//Информация о пользователе
$userGroups = CUser::GetUserGroup($userId);
//ИД групп, к которым принадлежит пользователь
//Если пользователя нет в акционной группе, и он совершил заказ более чем на 900 грн, то добавить его в группу
if (!in_array($idRatingGroup, $userGroups)) {
if ($price >= 900 && $price <= 4000 && $val === 'Y') {
$userGroups[] = $idRatingGroup;
CUser::SetUserGroup($userId, $userGroups);
}
}
$points = $price * 5;
$payedUser = new CUser();
//Если оплата подтверждается, то добавить баллы
if ($val === 'Y' && in_array($idRatingGroup, $userGroups)) {
$points = intval($arUserData['UF_ACTION_POINTS']) + $points;
$payedUser->Update($userId, array("UF_ACTION_POINTS" => $points, "UF_DATE_LAST_BUY" => $arOrder["DATE_UPDATE_FORMAT"]));
} else {
if ($val === 'N') {
$price = CCurrencyRates::ConvertCurrency(floatval($arOrder["PRICE"]), $arOrder["CURRENCY"], $curTo);
$price = intval(ceil($price));
//вычитаем полную стоимость
$points = $price * 5;
if ($arUserData['UF_ACTION_POINTS'] >= $points) {
$points = intval($arUserData['UF_ACTION_POINTS']) - $points;
$payedUser->Update($userId, array("UF_ACTION_POINTS" => $points));
//Если очков стало меньше 4500, то исключаем пользователя из группы участников
if (in_array($idRatingGroup, $userGroups) && $points < 4500) {
$indexGroup = array_search($idRatingGroup, $userGroups);
if (isset($userGroups[$indexGroup])) {
unset($userGroups[$indexGroup]);
CUser::SetUserGroup($userId, $userGroups);
}
}
}
}
}
unset($payedUser);
}
示例7: OnBeforeEventAddHandler
public static function OnBeforeEventAddHandler(&$event, &$lid, &$arFields)
{
if ($event == "SALE_NEW_ORDER") {
$orderId = $arFields['ORDER_ID'];
$dbOrderProps = CSaleOrderPropsValue::GetList(array("CODE" => "ASC"), array("ORDER_ID" => $orderId, "CODE" => array("ORDER_PHONE", "ORDER_ADDRESS", "ORDER_ADDRESS_DETAILS", "ORDER_NAME")));
while ($arOrderProps = $dbOrderProps->GetNext()) {
$arFields[$arOrderProps['CODE']] = $arOrderProps['~VALUE'];
}
$arFields["ORDER_DESCRIPTION"] = trim(CSaleOrder::GetByID($orderId)["USER_DESCRIPTION"]);
}
}
示例8: Update
function Update($ID, $arFields, $bDateUpdate = true)
{
global $DB;
$ID = IntVal($ID);
$arFields1 = array();
foreach ($arFields as $key => $value) {
if (substr($key, 0, 1) == "=") {
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CSaleOrder::CheckFields("UPDATE", $arFields)) {
return false;
}
foreach (GetModuleEvents("sale", "OnBeforeOrderUpdate", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($ID, &$arFields)) === false) {
return false;
}
}
$strUpdate = $DB->PrepareUpdate("b_sale_order", $arFields);
foreach ($arFields1 as $key => $value) {
if (strlen($strUpdate) > 0) {
$strUpdate .= ", ";
}
$strUpdate .= $key . "=" . $value . " ";
}
//get old fields
$arOrderOldFields = CSaleOrder::GetByID($ID);
$strSql = "UPDATE b_sale_order SET " . "\t" . $strUpdate . " ";
if ($bDateUpdate) {
$strSql .= ",\tDATE_UPDATE = " . $DB->GetNowFunction() . " ";
}
$strSql .= "WHERE ID = " . $ID . " ";
$res = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
if ($res) {
CSaleOrder::AddOrderHistory($arOrderOldFields, $arFields);
}
unset($GLOBALS["SALE_ORDER"]["SALE_ORDER_CACHE_" . $ID]);
foreach (GetModuleEvents("sale", "OnOrderUpdate", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array($ID, $arFields));
}
return $ID;
}
示例9:
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$bCorrectPayment = True;
if (!($arOrder = CSaleOrder::GetByID(IntVal($_POST["pci_wmtid"])))) {
$bCorrectPayment = False;
}
$CNST_PAYEE_PURSE = CSalePaySystemAction::GetParamValue("ACC_NUMBER");
$CNST_SECRET_KEY = CSalePaySystemAction::GetParamValue("CNST_SECRET_KEY");
if (strlen($CNST_SECRET_KEY) <= 0) {
$bCorrectPayment = False;
}
if ($_POST["LMI_PREREQUEST"] == "1") {
if (round($arOrder["PRICE"], 2) == round($_POST["LMI_PAYMENT_AMOUNT"], 2) && $CNST_PAYEE_PURSE == $_POST["LMI_PAYEE_PURSE"]) {
$APPLICATION->RestartBuffer();
echo "YES";
die;
}
} else {
$SERVER_NAME_tmp = "";
if (defined("SITE_SERVER_NAME")) {
$SERVER_NAME_tmp = SITE_SERVER_NAME;
}
if (strlen($SERVER_NAME_tmp) <= 0) {
$SERVER_NAME_tmp = COption::GetOptionString("main", "server_name", "");
}
/*
&purse=".$strPAYEE_PURSE;
示例10: array
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_GET["server_responce"]) && $_GET["server_responce"] == "Y" && !empty($_POST["cartId"])) {
$bCorrect = True;
if ($bCorrect && !($arOrder = CSaleOrder::GetByID(IntVal($_POST["cartId"])))) {
$bCorrect = False;
}
if ($bCorrect) {
CSalePaySystemAction::InitParamArrays($arOrder, $arOrder["ID"]);
$strCallbackPassword = CSalePaySystemAction::GetParamValue("CALLBACK_PASSWORD");
if (strlen($strCallbackPassword) <= 0 || $_POST["callbackPW"] != $strCallbackPassword) {
$bCorrect = False;
}
}
if ($bCorrect && isset($_POST["testMode"]) && IntVal($_POST["testMode"]) > 0) {
$bCorrect = False;
}
if ($bCorrect) {
$arFields = array("PS_STATUS" => $_POST["transStatus"] == "Y" ? "Y" : "N", "PS_STATUS_CODE" => $_POST["transStatus"], "PS_STATUS_DESCRIPTION" => $_POST["rawAuthMessage"], "PS_STATUS_MESSAGE" => $_POST["transStatus"] == "Y" ? "The WorldPay ID for this transaction: " . $_POST["transId"] . ", Time of this transaction: " . Date("r", $_POST["transTime"]) : "", "PS_SUM" => $_POST["authAmount"], "PS_CURRENCY" => $_POST["authCurrency"], "PS_RESPONSE_DATE" => Date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL", LANG))), "USER_ID" => $arOrder["USER_ID"]);
if ($arOrder["CURRENCY"] == $_POST["authCurrency"] && $arOrder["PRICE"] == $_POST["authAmount"]) {
CSaleOrder::PayOrder($arOrder["ID"], "Y");
}
CSaleOrder::Update($arOrder["ID"], $arFields);
}
}
示例11: IntVal
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
$inv_id = IntVal($_REQUEST["inv_id"]);
if (IntVal($inv_id) > 0) {
$bCorrectPayment = True;
$inv_id = IntVal($_REQUEST["inv_id"]);
$out_summ = $_REQUEST["OutSum"];
$crc = $_REQUEST["SignatureValue"];
if (!($arOrder = CSaleOrder::GetByID(IntVal($inv_id)))) {
$bCorrectPayment = False;
}
if ($bCorrectPayment) {
CSalePaySystemAction::InitParamArrays($arOrder, $arOrder["ID"]);
}
$mrh_pass2 = CSalePaySystemAction::GetParamValue("ShopPassword2");
$strCheck = md5($out_summ . ":" . $inv_id . ":" . $mrh_pass2);
if ($bCorrectPayment && strtoupper($CHECKSUM) != strtoupper($strCheck)) {
$bCorrectPayment = False;
}
if ($bCorrectPayment) {
$arFields = array("PS_STATUS" => "Y", "PS_STATUS_CODE" => "-", "PS_STATUS_DESCRIPTION" => $strPS_STATUS_DESCRIPTION, "PS_STATUS_MESSAGE" => $strPS_STATUS_MESSAGE, "PS_SUM" => $out_summ, "PS_CURRENCY" => "", "PS_RESPONSE_DATE" => Date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL", LANG))));
// You can comment this code if you want PAYED flag not to be set automatically
if ($arOrder["PRICE"] == $out_summ) {
CSaleOrder::PayOrder($arOrder["ID"], "Y");
}
if (CSaleOrder::Update($arOrder["ID"], $arFields)) {
echo "OK";
}
示例12: OnSaleBeforeCancelOrderHandler
function OnSaleBeforeCancelOrderHandler($orderId, $value){
if(
(CModule::IncludeModule("main"))
&&
(CModule::IncludeModule("iblock"))
&&
(CModule::IncludeModule("catalog"))
&&
(CModule::IncludeModule("sale"))
){
mail('kara20133@yandex.com', 'До отмены id заказа', $orderId);
if(isset($orderId)&&(is_numeric($orderId))){
mail('kara20133@yandex.com', ' в условии до отмены id заказа', $orderId);
$ar_order = array();
$ar_order=CSaleOrder::GetByID($orderId);
if($ar_order){
if(($ar_order['STATUS_ID']=='B')&&($ar_order['CANCELED']=='N')){
$dbBasketItems = CSaleBasket::GetList(
array("NAME" => "ASC", "ID" => "ASC"), array(
"LID" => SITE_ID,
"ORDER_ID" => $orderId
), false, false, array("PRODUCT_ID")
);
while ($arBasketItems = $dbBasketItems->GetNext()) {
$PRODUCT['ID']=$arBasketItems['PRODUCT_ID'];
}
$ar_res_product=CCatalogProduct::GetByID($PRODUCT['ID']);
$arFields_quant = array(
'QUANTITY' => $ar_res_product['QUANTITY']+1
);
CCatalogProduct::Update($PRODUCT['ID'], $arFields_quant);
}
}
}
}
}
示例13: GetMessage
$amount = $keyarray['mc_gross'];
echo "<p><h3>" . GetMessage("PPL_T1") . "</h3></p>";
echo "<b>" . GetMessage("PPL_T2") . "</b><br>\n";
echo "<li>" . GetMessage("PPL_T3") . ": {$firstname} {$lastname}</li>\n";
echo "<li>" . GetMessage("PPL_T4") . ": {$itemname}</li>\n";
echo "<li>" . GetMessage("PPL_T5") . ": {$amount}</li>\n";
} elseif (strcmp($res, "VERIFIED") == 0) {
$strPS_STATUS_MESSAGE = "";
$strPS_STATUS_MESSAGE .= GetMessage("PPL_T3") . ": " . $_POST["first_name"] . " " . $_POST["last_name"] . "; ";
$strPS_STATUS_MESSAGE .= "Email: " . $_POST["payer_email"] . "; ";
$strPS_STATUS_MESSAGE .= GetMessage("PPL_T4") . ": " . $_POST["item_name"] . "; ";
$strPS_STATUS_MESSAGE .= GetMessage("PPL_T5") . ": " . $_POST["mc_gross"] . "; ";
$strPS_STATUS_DESCRIPTION = "";
$strPS_STATUS_DESCRIPTION .= "Payment status - " . $_POST["payment_status"] . "; ";
$strPS_STATUS_DESCRIPTION .= "Payment sate - " . $_POST["payment_date"] . "; ";
$arOrder = CSaleOrder::GetByID($_POST["custom"]);
$arFields = array("PS_STATUS" => "Y", "PS_STATUS_CODE" => "-", "PS_STATUS_DESCRIPTION" => $strPS_STATUS_DESCRIPTION, "PS_STATUS_MESSAGE" => $strPS_STATUS_MESSAGE, "PS_SUM" => $_POST["mc_gross"], "PS_CURRENCY" => $_POST["mc_currency"], "PS_RESPONSE_DATE" => Date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL", LANG))), "USER_ID" => $arOrder["USER_ID"]);
$arFields["PAY_VOUCHER_NUM"] = $tx;
$arFields["PAY_VOUCHER_DATE"] = Date(CDatabase::DateFormatToPHP(CLang::GetDateFormat("FULL", LANG)));
if (IntVal($arOrder["PRICE"]) == IntVal($_POST["mc_gross"]) && $_POST["receiver_email"] == CSalePaySystemAction::GetParamValue("BUSINESS") && $_POST["payment_status"] == "Completed" && strlen($arOrder["PAY_VOUCHER_NUM"]) <= 0 && $arOrder["PAY_VOUCHER_NUM"] != $tx) {
CSaleOrder::PayOrder($arOrder["ID"], "Y");
}
if (strlen($arOrder["PAY_VOUCHER_NUM"]) <= 0 || $arOrder["PAY_VOUCHER_NUM"] != $tx) {
CSaleOrder::Update($arOrder["ID"], $arFields);
}
} else {
echo "<p>" . GetMessage("PPL_I1") . "</p>";
}
} else {
echo "<p>" . GetMessage("PPL_I2") . "</p>";
}
示例14: GetLangFileName
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
include GetLangFileName(dirname(__FILE__) . "/", "/ubrir.php");
include dirname(__FILE__) . "/sdk/ubrir_autoload.php";
include dirname(__FILE__) . "/view/style.php";
$shouldPay = strlen(CSalePaySystemAction::GetParamValue("SHOULD_PAY")) > 0 ? CSalePaySystemAction::GetParamValue("SHOULD_PAY") : $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["SHOULD_PAY"];
$orderID = strlen(CSalePaySystemAction::GetParamValue("ORDER_ID")) > 0 ? CSalePaySystemAction::GetParamValue("ORDER_ID") : $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["ID"];
$arOrder = CSaleOrder::GetByID(CSalePaySystemAction::GetParamValue("ORDER_ID"));
// получаем текущий заказ
if (!isset($_GET['status'])) {
/* ---------------- если операция еще не совершена -------------- */
$readyToPay = false;
// возможность платежа
$bankHandler = new Ubrir(array('shopId' => CSalePaySystemAction::GetParamValue("ID"), 'order_id' => CSalePaySystemAction::GetParamValue("ORDER_ID"), 'sert' => CSalePaySystemAction::GetParamValue("SERT"), 'amount' => CSalePaySystemAction::GetParamValue("SHOULD_PAY")));
$response_order = $bankHandler->prepare_to_pay();
// что вернул банк
include dirname(__FILE__) . "/include/twpg_db.php";
if ($readyToPay and !empty($response_order)) {
$twpg_url = $response_order->URL[0] . '?orderid=' . $response_order->OrderID[0] . '&sessionid=' . $response_order->SessionID[0];
echo '<INPUT TYPE="button" value="Оплатить Visa" onclick="document.location = \'' . $twpg_url . '\'">';
}
if (CSalePaySystemAction::GetParamValue("TWO") == 'Y') {
// если активны два процессинга, то работаем еще и с Uniteller
echo ' <INPUT TYPE="button" onclick="document.forms.uniteller.submit()" value="Оплатить MasterCard">';
include dirname(__FILE__) . "/include/uni_form.php";
}
} else {
$status = htmlspecialchars(stripslashes($_GET['status']));
switch ($status) {
示例15: OrderReservation
/**
* Method is called to reserve all products in the order basket
*
* @param int $orderID
* @param bool $bUndoReservation
* @return mixed array
*/
function OrderReservation($orderID, $bUndoReservation = false)
{
global $APPLICATION;
if (defined("SALE_DEBUG") && SALE_DEBUG) {
if ($bUndoReservation) {
CSaleHelper::WriteToLog("OrderReservation: undo started", array("orderId" => $orderID), "OR1");
} else {
CSaleHelper::WriteToLog("OrderReservation: started", array("orderId" => $orderID), "OR1");
}
}
$orderID = (int) $orderID;
if ($orderID <= 0) {
return false;
}
$arResult = array();
$arSetData = array();
$arOrder = CSaleOrder::GetByID($orderID);
if ($arOrder) {
$obStackExp = $APPLICATION->GetException();
if (is_object($obStackExp)) {
$APPLICATION->ResetException();
}
$dbBasketList = CSaleBasket::GetList(array(), array("ORDER_ID" => $orderID));
while ($arBasket = $dbBasketList->Fetch()) {
if ($bUndoReservation && $arBasket["RESERVED"] == "N" && COption::GetOptionString("catalog", "enable_reservation") != "N") {
continue;
}
if (CSaleBasketHelper::isSetParent($arBasket)) {
continue;
}
if (CSaleBasketHelper::isSetItem($arBasket)) {
$arSetData[$arBasket["PRODUCT_ID"]] = $arBasket["SET_PARENT_ID"];
}
if (defined("SALE_DEBUG") && SALE_DEBUG) {
CSaleHelper::WriteToLog("Reserving product #" . $arBasket["PRODUCT_ID"], array(), "OR2");
}
/** @var $productProvider IBXSaleProductProvider */
if ($productProvider = CSaleBasket::GetProductProvider($arBasket)) {
if (defined("SALE_DEBUG") && SALE_DEBUG) {
CSaleHelper::WriteToLog("Call ::ReserveProduct", array("PRODUCT_ID" => $arBasket["PRODUCT_ID"], "QUANTITY_ADD" => $arBasket["QUANTITY"], "UNDO_RESERVATION" => $bUndoReservation ? "Y" : "N"), "OR3");
}
if ($arOrder["DEDUCTED"] == "Y") {
$res = array("RESULT" => true, "QUANTITY_RESERVED" => 0);
if (defined("SALE_DEBUG") && SALE_DEBUG) {
CSaleHelper::WriteToLog("Order already deducted. Product won't be reserved.", array(), "OR5");
}
} else {
$res = $productProvider::ReserveProduct(array("PRODUCT_ID" => $arBasket["PRODUCT_ID"], "QUANTITY_ADD" => $arBasket["QUANTITY"], "UNDO_RESERVATION" => $bUndoReservation ? "Y" : "N"));
}
if ($res["RESULT"]) {
$arResult[$arBasket["PRODUCT_ID"]] = $res["QUANTITY_RESERVED"];
$arUpdateFields = array("RESERVED" => $bUndoReservation ? "N" : "Y");
if (!$bUndoReservation && isset($res["QUANTITY_NOT_RESERVED"])) {
$arUpdateFields["RESERVE_QUANTITY"] = $res["QUANTITY_NOT_RESERVED"];
}
if (defined("SALE_DEBUG") && SALE_DEBUG) {
CSaleHelper::WriteToLog("Product #" . $arBasket["PRODUCT_ID"] . " reserved successfully", array("arUpdateFields" => $arUpdateFields), "OR4");
}
if (!isset($res["QUANTITY_RESERVED"]) || isset($res["QUANTITY_RESERVED"]) && $res["QUANTITY_RESERVED"] != 0) {
CSaleBasket::Update($arBasket["ID"], $arUpdateFields);
}
} else {
if (defined("SALE_DEBUG") && SALE_DEBUG) {
CSaleHelper::WriteToLog("Product #" . $arBasket["PRODUCT_ID"] . " reservation error", array(), "OR4");
}
CSaleBasket::Update($arBasket["ID"], array("RESERVED" => "N"));
}
if ($ex = $APPLICATION->GetException()) {
if (defined("SALE_DEBUG") && SALE_DEBUG) {
CSaleHelper::WriteToLog("Call ::ReserveProduct - Exception", array("ID" => $arBasket["PRODUCT_ID"], "MESSAGE" => $ex->GetString(), "CODE" => $ex->GetID()), "OR4");
}
$arResult["ERROR"][$arBasket["PRODUCT_ID"]]["ID"] = $arBasket["PRODUCT_ID"];
$arResult["ERROR"][$arBasket["PRODUCT_ID"]]["MESSAGE"] = $ex->GetString();
$arResult["ERROR"][$arBasket["PRODUCT_ID"]]["CODE"] = $ex->GetID();
}
}
}
if (is_object($obStackExp)) {
$APPLICATION->ResetException();
$APPLICATION->ThrowException($obStackExp);
}
}
if (defined("SALE_DEBUG") && SALE_DEBUG) {
CSaleHelper::WriteToLog("OrderReservation result", array("arResult" => $arResult), "OR6");
}
return $arResult;
}