<?
//Мой код
function my_onAfterResultAdd($WEB_FORM_ID, $RESULT_ID)
{
if ($WEB_FORM_ID == 17)
{
CFormResult::SetField($RESULT_ID, 'add_quest_id', 'test');
}
}
AddEventHandler('form', 'onAfterResultAdd', 'my_onAfterResultAdd');
//Конец моего кода
include_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/templates/.default/sale/mp3/init_vars.php");
AddEventHandler("sale", "OnSaleCancelOrder", "SaleCancelOrderEventAdd");
function SaleCancelOrderEventAdd(&$ID, &$var)
{
if($var == "Y" && CModule::IncludeModule("statistic"))
{
CStatistic::Set_Event("eStore", "order_cancel", $ID);
}
}
function MP3DeliveryOrderCallback($productID, $userID, $bPaid, $orderID)
{
global $DB;
$productID = IntVal($productID);
$userID = IntVal($userID);
$bPaid = ($bPaid ? True : False);
$orderID = IntVal($orderID);
if ($userID <= 0)
return False;
if ($orderID <= 0)
return False;
if (!array_key_exists($productID, $GLOBALS["arMP3Sums"]))
return False;
if (!($arOrder = CSaleOrder::GetByID($orderID)))
return False;
$baseLangCurrency = CSaleLang::GetLangCurrency($arOrder["LID"]);
$currentPrice = $GLOBALS["arMP3Sums"][$productID]["PRICE"];
$currentCurrency = $GLOBALS["arMP3Sums"][$productID]["CURRENCY"];
if ($GLOBALS["arMP3Sums"][$productID]["CURRENCY"] != $baseLangCurrency)
{
$currentPrice = CCurrencyRates::ConvertCurrency($GLOBALS["arMP3Sums"][$productID]["PRICE"], $GLOBALS["arMP3Sums"][$productID]["CURRENCY"], $baseLangCurrency);
$currentCurrency = $baseLangCurrency;
}
if (!CSaleUserAccount::UpdateAccount($userID, ($bPaid ? $currentPrice : -$currentPrice), $currentCurrency, "MANUAL", $orderID))
return False;
return True;
}
?>
|