本文整理汇总了PHP中CSaleLang::GetLangCurrency方法的典型用法代码示例。如果您正苦于以下问题:PHP CSaleLang::GetLangCurrency方法的具体用法?PHP CSaleLang::GetLangCurrency怎么用?PHP CSaleLang::GetLangCurrency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSaleLang
的用法示例。
在下文中一共展示了CSaleLang::GetLangCurrency方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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']));
}
}
示例2: PrepareCurrency4Where
public static function PrepareCurrency4Where($val, $key, $operation, $negative, $field, &$arField, &$arFilter)
{
$val = DoubleVal($val);
$baseSiteCurrency = "";
if (isset($arFilter["LID"]) && strlen($arFilter["LID"]) > 0)
$baseSiteCurrency = CSaleLang::GetLangCurrency($arFilter["LID"]);
elseif (isset($arFilter["CURRENCY"]) && strlen($arFilter["CURRENCY"]) > 0)
$baseSiteCurrency = $arFilter["CURRENCY"];
if (strlen($baseSiteCurrency) <= 0)
return False;
$strSqlSearch = "";
$dbCurrency = CCurrency::GetList(($by = "sort"), ($order = "asc"));
while ($arCurrency = $dbCurrency->Fetch())
{
$val1 = roundEx(CCurrencyRates::ConvertCurrency($val, $baseSiteCurrency, $arCurrency["CURRENCY"]), SALE_VALUE_PRECISION);
if (strlen($strSqlSearch) > 0)
$strSqlSearch .= " OR ";
$strSqlSearch .= "(D.ORDER_CURRENCY = '".$arCurrency["CURRENCY"]."' AND ";
if ($negative == "Y")
$strSqlSearch .= "NOT";
$strSqlSearch .= "(".$field." ".$operation." ".$val1." OR ".$field." IS NULL OR ".$field." = 0)";
$strSqlSearch .= ")";
}
return "(".$strSqlSearch.")";
}
示例3: init
public function init()
{
$this->username = CSalePaySystemAction::GetParamValue("USER");
$this->pwd = CSalePaySystemAction::GetParamValue("PWD");
$this->signature = CSalePaySystemAction::GetParamValue("SIGNATURE");
$this->currency = CSalePaySystemAction::GetParamValue("CURRENCY");
$this->testMode = CSalePaySystemAction::GetParamValue("TEST") == "Y";
$this->notifyUrl = CSalePaySystemAction::GetParamValue("NOTIFY_URL");
if (strlen($this->currency) <= 0) {
$this->currency = CSaleLang::GetLangCurrency(SITE_ID);
}
if ($this->testMode) {
$this->domain = "sandbox.";
}
if (strlen($_REQUEST["token"]) > 0) {
$this->token = $_REQUEST["token"];
}
if (strlen($_REQUEST["PayerID"]) > 0) {
$this->payerId = $_REQUEST["PayerID"];
}
$this->version = "98.0";
$dbSite = CSite::GetByID(SITE_ID);
$arSite = $dbSite->Fetch();
$this->serverName = $arSite["SERVER_NAME"];
if (strLen($this->serverName) <= 0) {
if (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0) {
$this->serverName = SITE_SERVER_NAME;
} else {
$this->serverName = COption::GetOptionString("main", "server_name", "www.bitrixsoft.com");
}
}
$this->serverName = (CMain::IsHTTPS() ? "https" : "http") . "://" . $this->serverName;
if (strlen($this->username) <= 0 || strlen($this->username) <= 0 || strlen($this->username) <= 0) {
$GLOBALS["APPLICATION"]->ThrowException("CSalePaySystempaypal: init error", "CSalePaySystempaypal_init_error");
return false;
}
return true;
}
示例4: prepareDiscountConditions
protected function prepareDiscountConditions(&$conditions, &$result, &$handlers, $type, $site)
{
global $APPLICATION;
$obCond = null;
$result = '';
$handlers = array();
$type = (int) $type;
if ($type != self::PREPARE_CONDITIONS && $type != self::PREPARE_ACTIONS || empty($conditions)) {
return false;
}
if (!is_array($conditions)) {
if (!CheckSerializedData($conditions)) {
if ($type == self::PREPARE_CONDITIONS) {
$APPLICATION->ThrowException(Loc::getMessage("BT_MOD_SALE_DISC_ERR_BAD_CONDITIONS"), "CONDITIONS");
} else {
$APPLICATION->ThrowException(Loc::getMessage("BT_MOD_SALE_DISC_ERR_BAD_ACTIONS_EXT"), "ACTIONS");
}
return false;
}
$conditions = unserialize($conditions);
if (!is_array($conditions) || empty($conditions)) {
if ($type == self::PREPARE_CONDITIONS) {
$APPLICATION->ThrowException(Loc::getMessage("BT_MOD_SALE_DISC_ERR_BAD_CONDITIONS"), "CONDITIONS");
} else {
$APPLICATION->ThrowException(Loc::getMessage("BT_MOD_SALE_DISC_ERR_BAD_ACTIONS_EXT"), "ACTIONS");
}
return false;
}
}
if ($type == self::PREPARE_CONDITIONS) {
$obCond = new CSaleCondTree();
$boolCond = $obCond->Init(BT_COND_MODE_GENERATE, BT_COND_BUILD_SALE, array('INIT_CONTROLS' => array('SITE_ID' => $site, 'CURRENCY' => CSaleLang::GetLangCurrency($site))));
} else {
$obCond = new CSaleActionTree();
$boolCond = $obCond->Init(BT_COND_MODE_GENERATE, BT_COND_BUILD_SALE_ACTIONS, array());
}
if (!$boolCond) {
return false;
}
$result = $obCond->Generate($conditions, array('ORDER' => '$arOrder', 'ORDER_FIELDS' => '$arOrder', 'ORDER_PROPS' => '$arOrder[\'PROPS\']', 'ORDER_BASKET' => '$arOrder[\'BASKET_ITEMS\']', 'BASKET' => '$arBasket', 'BASKET_ROW' => '$row'));
if ($result == '') {
if ($type == self::PREPARE_CONDITIONS) {
$APPLICATION->ThrowException(Loc::getMessage('BT_MOD_SALE_DISC_ERR_BAD_CONDITIONS'), 'CONDITIONS');
} else {
$APPLICATION->ThrowException(Loc::getMessage('BT_MOD_SALE_DISC_ERR_BAD_ACTIONS_EXT'), 'ACTIONS');
}
return false;
} else {
$handlers['HANDLERS'] = $obCond->GetConditionHandlers();
$handlers['ENTITY'] = $obCond->GetUsedEntityList();
$handlers['EXECUTE_MODULE'] = $obCond->GetExecuteModule();
}
$conditions = serialize($conditions);
return true;
}
示例5: GetControlShow
public static function GetControlShow($arParams)
{
$arControls = static::GetControls();
$arResult = array(
'controlgroup' => true,
'group' => false,
'label' => Loc::getMessage('BT_MOD_SALE_COND_CMP_ORDER_CONTROLGROUP_LABEL'),
'showIn' => static::GetShowIn($arParams['SHOW_IN_GROUPS']),
'children' => array()
);
foreach ($arControls as &$arOneControl)
{
if ('CondSaleOrderSumm' == $arOneControl['ID'])
{
$arJSControl = array(
array(
'id' => 'prefix',
'type' => 'prefix',
'text' => $arOneControl['PREFIX']
),
static::GetLogicAtom($arOneControl['LOGIC']),
static::GetValueAtom($arOneControl['JS_VALUE'])
);
if (static::$boolInit)
{
if (isset(static::$arInitParams['CURRENCY']))
{
$arJSControl[] = static::$arInitParams['CURRENCY'];
}
elseif (isset(static::$arInitParams['SITE_ID']))
{
$strCurrency = CSaleLang::GetLangCurrency(static::$arInitParams['SITE_ID']);
if (!empty($strCurrency))
{
$arJSControl[] = $strCurrency;
}
}
}
$arOne = array(
'controlId' => $arOneControl['ID'],
'group' => ('Y' == $arOneControl['GROUP']),
'label' => $arOneControl['LABEL'],
'showIn' => static::GetShowIn($arParams['SHOW_IN_GROUPS']),
'control' => $arJSControl
);
}
else
{
$arOne = array(
'controlId' => $arOneControl['ID'],
'group' => ('Y' == $arOneControl['GROUP']),
'label' => $arOneControl['LABEL'],
'showIn' => static::GetShowIn($arParams['SHOW_IN_GROUPS']),
'control' => array(
array(
'id' => 'prefix',
'type' => 'prefix',
'text' => $arOneControl['PREFIX']
),
static::GetLogicAtom($arOneControl['LOGIC']),
static::GetValueAtom($arOneControl['JS_VALUE'])
)
);
}
if ('CondSaleOrderWeight' == $arOneControl['ID'])
{
$arOne['control'][] = Loc::getMessage('BT_MOD_SALE_COND_MESS_WEIGHT_UNIT');
}
$arResult['children'][] = $arOne;
}
if (isset($arOneControl))
unset($arOneControl);
return $arResult;
}
示例6: DoCalculateOrder
static function DoCalculateOrder($siteId, $userId, $arShoppingCart, $personTypeId, $arOrderPropsValues, $deliveryId, $paySystemId, $arOptions, &$arErrors, &$arWarnings)
{
$siteId = trim($siteId);
if (empty($siteId)) {
$arErrors[] = array("CODE" => "PARAM", "TEXT" => GetMessage('SKGO_CALC_PARAM_ERROR'));
return null;
}
$userId = intval($userId);
if (!is_array($arShoppingCart) || count($arShoppingCart) <= 0) {
$arErrors[] = array("CODE" => "PARAM", "TEXT" => GetMessage('SKGO_SHOPPING_CART_EMPTY'));
return null;
}
$arOrder = array("ORDER_PRICE" => 0, "ORDER_WEIGHT" => 0, "CURRENCY" => CSaleLang::GetLangCurrency($siteId), "WEIGHT_UNIT" => htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_unit', false, $siteId)), "WEIGHT_KOEF" => htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_koef', 1, $siteId)), "BASKET_ITEMS" => $arShoppingCart, "SITE_ID" => $siteId, "LID" => $siteId, "USER_ID" => $userId, "USE_VAT" => false, "VAT_RATE" => 0, "VAT_SUM" => 0, "DELIVERY_ID" => false);
foreach ($arShoppingCart as $arShoppingCartItem) {
if (array_key_exists('CUSTOM_PRICE', $arShoppingCartItem) && 'Y' == $arShoppingCartItem['CUSTOM_PRICE']) {
$arShoppingCartItem['DISCOUNT_PRICE'] = $arShoppingCartItem['DEFAULT_PRICE'] - $arShoppingCartItem['PRICE'];
if (0 > $arShoppingCartItem['DISCOUNT_PRICE']) {
$arShoppingCartItem['DISCOUNT_PRICE'] = 0;
}
$arShoppingCartItem['DISCOUNT_PRICE_PERCENT'] = $arShoppingCartItem['DISCOUNT_PRICE'] * 100 / $arShoppingCartItem['DEFAULT_PRICE'];
if ($arShoppingCartItem["VAT_RATE"] > 0) {
$arShoppingCartItem["VAT_VALUE"] = $arShoppingCartItem["PRICE"] / ($arShoppingCartItem["VAT_RATE"] + 1) * $arShoppingCartItem["VAT_RATE"];
}
}
$arOrder["ORDER_PRICE"] += $arShoppingCartItem["PRICE"] * $arShoppingCartItem["QUANTITY"];
$arOrder["ORDER_WEIGHT"] += $arShoppingCartItem["WEIGHT"] * $arShoppingCartItem["QUANTITY"];
if ($arShoppingCartItem["VAT_RATE"] > 0) {
$arOrder["USE_VAT"] = true;
if ($arShoppingCartItem["VAT_RATE"] > $arOrder["VAT_RATE"]) {
$arOrder["VAT_RATE"] = $arShoppingCartItem["VAT_RATE"];
}
$arOrder["VAT_SUM"] += $arShoppingCartItem["VAT_VALUE"] * $arShoppingCartItem["QUANTITY"];
}
}
foreach (GetModuleEvents("sale", "OnSaleCalculateOrderShoppingCart", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array(&$arOrder));
}
CSalePersonType::DoProcessOrder($arOrder, $personTypeId, $arErrors);
if (count($arErrors) > 0) {
return null;
}
foreach (GetModuleEvents("sale", "OnSaleCalculateOrderPersonType", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array(&$arOrder));
}
CSaleOrderProps::DoProcessOrder($arOrder, $arOrderPropsValues, $arErrors, $arWarnings);
if (count($arErrors) > 0) {
return null;
}
foreach (GetModuleEvents("sale", "OnSaleCalculateOrderProps", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array(&$arOrder));
}
CSaleDelivery::DoProcessOrder($arOrder, $deliveryId, $arErrors);
if (count($arErrors) > 0) {
return null;
}
$arOrder["PRICE_DELIVERY"] = $arOrder["DELIVERY_PRICE"];
foreach (GetModuleEvents("sale", "OnSaleCalculateOrderDelivery", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array(&$arOrder));
}
CSalePaySystem::DoProcessOrder($arOrder, $paySystemId, $arErrors);
if (count($arErrors) > 0) {
return null;
}
foreach (GetModuleEvents("sale", "OnSaleCalculateOrderPaySystem", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array(&$arOrder));
}
if (!array_key_exists('CART_FIX', $arOptions) || 'Y' != $arOptions['CART_FIX']) {
CSaleDiscount::DoProcessOrder($arOrder, $arOptions, $arErrors);
if (count($arErrors) > 0) {
return null;
}
foreach (GetModuleEvents("sale", "OnSaleCalculateOrderDiscount", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array(&$arOrder));
}
}
CSaleTax::DoProcessOrderBasket($arOrder, $arOptions, $arErrors);
if (count($arErrors) > 0) {
return null;
}
foreach (GetModuleEvents("sale", "OnSaleCalculateOrderShoppingCartTax", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array(&$arOrder));
}
CSaleTax::DoProcessOrderDelivery($arOrder, $arOptions, $arErrors);
if (count($arErrors) > 0) {
return null;
}
foreach (GetModuleEvents("sale", "OnSaleCalculateOrderDeliveryTax", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array(&$arOrder));
}
$arOrder["PRICE"] = $arOrder["ORDER_PRICE"] + $arOrder["DELIVERY_PRICE"] + $arOrder["TAX_PRICE"] - $arOrder["DISCOUNT_PRICE"];
$arOrder["TAX_VALUE"] = $arOrder["USE_VAT"] ? $arOrder["VAT_SUM"] : $arOrder["TAX_PRICE"];
foreach (GetModuleEvents("sale", "OnSaleCalculateOrder", true) as $arEvent) {
ExecuteModuleEventEx($arEvent, array(&$arOrder));
}
return $arOrder;
}
示例7: GetMessage
echo GetMessage("SOE_NEW_ITEMS");
?>
</a>
<?endif;?>
<a title="<?php
echo GetMessage("SOE_ADD_ITEMS");
?>
" onClick="AddProductSearch(1);" class="adm-btn adm-btn-green adm-btn-add" href="javascript:void(0);"><?php
echo GetMessage("SOE_ADD_ITEMS");
?>
</a>
</div>
<script type="text/javascript">
var currencyBase = '<?php
echo CSaleLang::GetLangCurrency($LID);
?>
';
var orderWeight = '<?php
echo $productWeight;
?>
';
var orderPrice = '<?php
echo $str_PRICE;
?>
';
function fEnableSub()
{
if (document.getElementById('tbl_sale_order_edit'))
document.getElementById('tbl_sale_order_edit').style.zIndex = 10000;
示例8: array
if (!isset($arParams["DISABLE_BASKET_REDIRECT"]) || 'Y' !== $arParams["DISABLE_BASKET_REDIRECT"]) {
$arParams["DISABLE_BASKET_REDIRECT"] = "N";
}
$bUseAccountNumber = COption::GetOptionString("sale", "account_number_template", "") !== "" ? true : false;
$arResult = array("PERSON_TYPE" => array(), "PAY_SYSTEM" => array(), "ORDER_PROP" => array(), "DELIVERY" => array(), "TAX" => array(), "ERROR" => array(), "ORDER_PRICE" => 0, "ORDER_WEIGHT" => 0, "VATE_RATE" => 0, "VAT_SUM" => 0, "bUsingVat" => false, "BASKET_ITEMS" => array(), "BASE_LANG_CURRENCY" => CSaleLang::GetLangCurrency(SITE_ID), "WEIGHT_UNIT" => htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_unit', false, SITE_ID)), "WEIGHT_KOEF" => htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_koef', 1, SITE_ID)), "TaxExempt" => array(), "DISCOUNT_PRICE" => 0, "DISCOUNT_PERCENT" => 0, "DELIVERY_PRICE" => 0, "TAX_PRICE" => 0, "PAYED_FROM_ACCOUNT_FORMATED" => false, "ORDER_TOTAL_PRICE_FORMATED" => false, "ORDER_WEIGHT_FORMATED" => false, "ORDER_PRICE_FORMATED" => false, "VAT_SUM_FORMATED" => false, "DELIVERY_SUM" => false, "DELIVERY_PROFILE_SUM" => false, "DELIVERY_PRICE_FORMATED" => false, "DISCOUNT_PERCENT_FORMATED" => false, "PAY_FROM_ACCOUNT" => false, "CURRENT_BUDGET_FORMATED" => false, "USER_ACCOUNT" => false, "DISCOUNTS" => array(), "AUTH" => array(), "HAVE_PREPAYMENT" => false, "PREPAY_PS" => array(), "PREPAY_ADIT_FIELDS" => "", "PREPAY_ORDER_PROPS" => array());
$arUserResult = array("PERSON_TYPE_ID" => false, "PAY_SYSTEM_ID" => false, "DELIVERY_ID" => false, "ORDER_PROP" => false, "DELIVERY_LOCATION" => false, "TAX_LOCATION" => false, "PAYER_NAME" => false, "USER_EMAIL" => false, "PROFILE_NAME" => false, "PAY_CURRENT_ACCOUNT" => false, "CONFIRM_ORDER" => false, "FINAL_STEP" => false, "ORDER_DESCRIPTION" => false, "PROFILE_ID" => false, "PROFILE_CHANGE" => false, "DELIVERY_LOCATION_ZIP" => false);
$arResult["DELIVERY_EXTRA"] = isset($_POST["DELIVERY_ID"]) && isset($_POST["DELIVERY_EXTRA"][$_POST["DELIVERY_ID"]]) ? $_POST["DELIVERY_EXTRA"][$_POST["DELIVERY_ID"]] : array();
$arResult["AUTH"]["new_user_registration_email_confirmation"] = COption::GetOptionString("main", "new_user_registration_email_confirmation", "N") == "Y" ? "Y" : "N";
$arResult["AUTH"]["new_user_registration"] = COption::GetOptionString("main", "new_user_registration", "Y") == "Y" ? "Y" : "N";
$arParams["ALLOW_AUTO_REGISTER"] = $arParams["ALLOW_AUTO_REGISTER"] == "Y" ? "Y" : "N";
if ($arParams["ALLOW_AUTO_REGISTER"] == "Y" && ($arResult["AUTH"]["new_user_registration_email_confirmation"] == "Y" || $arResult["AUTH"]["new_user_registration"] == "N")) {
$arParams["ALLOW_AUTO_REGISTER"] = "N";
}
$arParams["SEND_NEW_USER_NOTIFY"] = $arParams["SEND_NEW_USER_NOTIFY"] == "N" ? "N" : "Y";
$arParams["ALLOW_NEW_PROFILE"] = $arParams["ALLOW_NEW_PROFILE"] == "N" ? "N" : "Y";
$allCurrency = CSaleLang::GetLangCurrency(SITE_ID);
if (!$arParams["DELIVERY_NO_SESSION"]) {
$arParams["DELIVERY_NO_SESSION"] = "N";
}
$arResult["BUYER_STORE"] = "";
if (isset($_POST["BUYER_STORE"])) {
$arResult["BUYER_STORE"] = intval($_POST["BUYER_STORE"]);
}
$arResult["GRID"]["HEADERS"] = array();
$arResult["GRID"]["ROWS"] = array();
// grid product table columns
$bIblockEnabled = false;
$arResult["GRID"]["DEFAULT_COLUMNS"] = false;
if (empty($arParams["PRODUCT_COLUMNS"])) {
$arParams["PRODUCT_COLUMNS"] = array("NAME" => GetMessage("SOA_NAME_DEFAULT_COLUMN"), "PROPS" => GetMessage("SOA_PROPS_DEFAULT_COLUMN"), "DISCOUNT_PRICE_PERCENT_FORMATED" => GetMessage("SOA_DISCOUNT_DEFAULT_COLUMN"), "PRICE_FORMATED" => GetMessage("SOA_PRICE_DEFAULT_COLUMN"), "QUANTITY" => GetMessage("SOA_QUANTITY_DEFAULT_COLUMN"), "SUM" => GetMessage("SOA_SUM_DEFAULT_COLUMN"));
$arResult["GRID"]["DEFAULT_COLUMNS"] = true;
示例9: sendEmailNewOrder
protected function sendEmailNewOrder($newOrderId, $buyer)
{
global $DB;
$strOrderList = "";
$baseLangCurrency = CSaleLang::GetLangCurrency($this->siteId);
$orderNew = CSaleOrder::GetByID($newOrderId);
$orderNew["BASKET_ITEMS"] = array();
$userEmail = $buyer["email"];
$fio = $buyer["last-name"] . (isset($buyer["first-name"]) ? $buyer["first-name"] : "");
$dbBasketTmp = CSaleBasket::GetList(array("SET_PARENT_ID" => "DESC", "TYPE" => "DESC", "NAME" => "ASC"), array("ORDER_ID" => $newOrderId), false, false, array("ID", "PRICE", "QUANTITY", "NAME"));
while ($arBasketTmp = $dbBasketTmp->GetNext()) {
$orderNew["BASKET_ITEMS"][] = $arBasketTmp;
}
$orderNew["BASKET_ITEMS"] = getMeasures($orderNew["BASKET_ITEMS"]);
foreach ($orderNew["BASKET_ITEMS"] as $val) {
if (CSaleBasketHelper::isSetItem($val)) {
continue;
}
$measure = isset($val["MEASURE_TEXT"]) ? $val["MEASURE_TEXT"] : GetMessage("SALE_YMH_SHT");
$strOrderList .= $val["NAME"] . " - " . $val["QUANTITY"] . " " . $measure . ": " . SaleFormatCurrency($val["PRICE"], $baseLangCurrency);
$strOrderList .= "\n";
}
//send mail
$arFields = array("ORDER_ID" => $orderNew["ACCOUNT_NUMBER"], "ORDER_DATE" => Date($DB->DateFormatToPHP(CLang::GetDateFormat("SHORT", $this->siteId))), "ORDER_USER" => $fio, "PRICE" => SaleFormatCurrency($orderNew["PRICE"], $baseLangCurrency), "BCC" => COption::GetOptionString("sale", "order_email", "order@" . $_SERVER['SERVER_NAME']), "EMAIL" => array("PAYER_NAME" => $fio, "USER_EMAIL" => $userEmail), "ORDER_LIST" => $strOrderList, "SALE_EMAIL" => COption::GetOptionString("sale", "order_email", "order@" . $_SERVER['SERVER_NAME']), "DELIVERY_PRICE" => $orderNew["DELIVERY_PRICE"]);
$eventName = "SALE_NEW_ORDER";
$bSend = true;
foreach (GetModuleEvents("sale", "OnOrderNewSendEmail", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($newOrderId, &$eventName, &$arFields)) === false) {
$bSend = false;
}
}
if ($bSend) {
$event = new CEvent();
$event->Send($eventName, $this->siteId, $arFields, "N");
}
CSaleMobileOrderPush::send("ORDER_CREATED", array("ORDER" => $orderNew));
}
示例10: ConvertDiscount
public static function ConvertDiscount($intStep = 100, $intMaxExecutionTime = 15)
{
global $DBType;
global $DB;
global $APPLICATION;
self::InitStep();
$intStep = intval($intStep);
if (0 >= $intStep) {
$intStep = 100;
}
$startConvertTime = getmicrotime();
$obDiscount = new CSaleDiscount();
$strTableName = '';
switch (ToUpper($DBType)) {
case 'MYSQL':
$strTableName = 'b_catalog_discount';
break;
case 'MSSQL':
$strTableName = 'B_CATALOG_DISCOUNT';
break;
case 'ORACLE':
$strTableName = 'B_CATALOG_DISCOUNT';
break;
}
$intCount = CSaleDiscountConvert::GetCount();
if (0 == $intCount) {
}
$strStatus = 1 < $intCount ? 'N' : 'Y';
$arBaseCurrencies = array();
$rsSites = CSite::GetList($b = "id", $o = "asc");
while ($arSite = $rsSites->Fetch()) {
$arBaseCurrencies[$arSite['ID']] = CSaleLang::GetLangCurrency($arSite['ID']);
}
CTimeZone::Disable();
$rsDiscounts = CSaleDiscount::GetList(array('ID' => 'ASC'), array('VERSION' => CSaleDiscount::VERSION_OLD), false, array('nTopCount' => $intStep), array('ID', 'SITE_ID', 'MODIFIED_BY', 'TIMESTAMP_X', 'PRICE_FROM', 'PRICE_TO', 'CURRENCY', 'DISCOUNT_VALUE', 'DISCOUNT_TYPE'));
while ($arDiscount = $rsDiscounts->Fetch()) {
$arFields = array();
$arFields['MODIFIED_BY'] = $arDiscount['MODIFIED_BY'];
$arConditions = array('CLASS_ID' => 'CondGroup', 'DATA' => array('All' => 'AND', 'True' => 'True'), 'CHILDREN' => array());
$arActions = array('CLASS_ID' => 'CondGroup', 'DATA' => array('All' => 'AND', 'True' => 'True'), 'CHILDREN' => array());
$boolCurrency = $arDiscount['CURRENCY'] == $arBaseCurrencies[$arDiscount['SITE_ID']];
$strFrom = '';
$strTo = '';
$strValue = '';
$arDiscount['PRICE_FROM'] = doubleval($arDiscount['PRICE_FROM']);
$arDiscount['PRICE_TO'] = doubleval($arDiscount['PRICE_TO']);
$arDiscount['DISCOUNT_VALUE'] = doubleval($arDiscount['DISCOUNT_VALUE']);
if (0 < $arDiscount['PRICE_FROM']) {
$dblValue = roundEx($boolCurrency ? $arDiscount['PRICE_FROM'] : CCurrencyRates::ConvertCurrency($arDiscount['PRICE_FROM'], $arDiscount['CURRENCY'], $arBaseCurrencies[$arDiscount['SITE_ID']]), SALE_VALUE_PRECISION);
$arConditions['CHILDREN'][] = array('CLASS_ID' => 'CondBsktAmtGroup', 'DATA' => array('logic' => 'EqGr', 'Value' => (string) $dblValue, 'All' => 'AND'), 'CHILDREN' => array());
if (!$boolCurrency) {
$arFields['PRICE_FROM'] = $dblValue;
}
$strFrom = str_replace('#VALUE#', $dblValue . ' ' . $arBaseCurrencies[$arDiscount['SITE_ID']], GetMessage('BT_MOD_SALE_DSC_FORMAT_NAME_FROM'));
}
if (0 < $arDiscount['PRICE_TO']) {
$dblValue = roundEx($boolCurrency ? $arDiscount['PRICE_TO'] : CCurrencyRates::ConvertCurrency($arDiscount['PRICE_TO'], $arDiscount['CURRENCY'], $arBaseCurrencies[$arDiscount['SITE_ID']]), SALE_VALUE_PRECISION);
$arConditions['CHILDREN'][] = array('CLASS_ID' => 'CondBsktAmtGroup', 'DATA' => array('logic' => 'EqLs', 'Value' => (string) $dblValue, 'All' => 'AND'), 'CHILDREN' => array());
if (!$boolCurrency) {
$arFields['PRICE_TO'] = $dblValue;
}
$strTo = str_replace('#VALUE#', $dblValue . ' ' . $arBaseCurrencies[$arDiscount['SITE_ID']], GetMessage('BT_MOD_SALE_DSC_FORMAT_NAME_TO'));
}
if (CSaleDiscount::OLD_DSC_TYPE_PERCENT == $arDiscount['DISCOUNT_TYPE']) {
$arActions['CHILDREN'][] = array('CLASS_ID' => 'ActSaleBsktGrp', 'DATA' => array('Type' => 'Discount', 'Value' => (string) roundEx($arDiscount['DISCOUNT_VALUE'], SALE_VALUE_PRECISION), 'Unit' => 'Perc', 'All' => 'AND'), 'CHILDREN' => array());
$strValue = $arDiscount['DISCOUNT_VALUE'] . ' %';
} else {
$dblValue = roundEx($boolCurrency ? $arDiscount['DISCOUNT_VALUE'] : CCurrencyRates::ConvertCurrency($arDiscount['DISCOUNT_VALUE'], $arDiscount['CURRENCY'], $arBaseCurrencies[$arDiscount['SITE_ID']]), SALE_VALUE_PRECISION);
$arActions['CHILDREN'][] = array('CLASS_ID' => 'ActSaleBsktGrp', 'DATA' => array('Type' => 'Discount', 'Value' => (string) $dblValue, 'Unit' => 'CurAll', 'All' => 'AND'), 'CHILDREN' => array());
if (!$boolCurrency) {
$arFields['DISCOUNT_VALUE'] = $dblValue;
}
$strValue = $dblValue . ' ' . $arBaseCurrencies[$arDiscount['SITE_ID']];
}
if ('' != $strFrom || '' != $strTo) {
$strName = str_replace(array('#VALUE#', '#FROM#', '#TO#'), array($strValue, $strFrom, $strTo), GetMessage('BT_MOD_SALE_DSC_FORMAT_NAME'));
} else {
$strName = str_replace('#VALUE#', $strValue, GetMessage('BT_MOD_SALE_DSC_FORMAT_SHORT_NAME'));
}
$arFields['CONDITIONS'] = $arConditions;
$arFields['ACTIONS'] = $arActions;
$arFields['NAME'] = $strName;
if (!$boolCurrency) {
$arFields['CURRENCY'] = $arBaseCurrencies[$arDiscount['SITE_ID']];
}
if ('N' == $strStatus) {
$arFields['ACTIVE'] = 'N';
}
$mxRes = $obDiscount->Update($arDiscount['ID'], $arFields);
if (!$mxRes) {
self::$intErrors++;
$strError = '';
if ($ex = $APPLICATION->GetException()) {
$strError = $ex->GetString();
}
if (empty($strError)) {
$strError = GetMessage('');
}
self::$arErrors[] = array('ID' => $arDiscount['ID'], 'NAME' => $strName, 'ERROR' => $strError);
} else {
//.........这里部分代码省略.........
示例11: DoCalculateOrder
/**
* @param $siteId
* @param $userId
* @param $arShoppingCart
* @param $personTypeId
* @param $arOrderPropsValues
* @param $deliveryId
* @param $paySystemId
* @param $arOptions
* @param $arErrors
* @param $arWarnings
* @return array|null
*/
static function DoCalculateOrder($siteId, $userId, $arShoppingCart, $personTypeId, $arOrderPropsValues,
$deliveryId, $paySystemId, $arOptions, &$arErrors, &$arWarnings)
{
if(!is_array($arOptions))
{
$arOptions = array();
}
$siteId = trim($siteId);
if (empty($siteId))
{
$arErrors[] = array("CODE" => "PARAM", "TEXT" => GetMessage('SKGO_CALC_PARAM_ERROR'));
return null;
}
$userId = intval($userId);
if (!is_array($arShoppingCart) || (count($arShoppingCart) <= 0))
{
$arErrors[] = array("CODE" => "PARAM", "TEXT" => GetMessage('SKGO_SHOPPING_CART_EMPTY'));
return null;
}
// calculate weight for set parent
$arParentWeight = array();
foreach ($arShoppingCart as $arItem)
{
if (CSaleBasketHelper::isSetItem($arItem))
$arParentWeight[$arItem["SET_PARENT_ID"]]["WEIGHT"] += $arItem["WEIGHT"] * $arItem["QUANTITY"];
}
foreach ($arShoppingCart as &$arItem)
{
if (CSaleBasketHelper::isSetParent($arItem) && isset($arParentWeight[$arItem["SET_PARENT_ID"]]))
$arItem["WEIGHT"] = $arParentWeight[$arItem["SET_PARENT_ID"]]["WEIGHT"];
}
unset($arItem);
$currency = isset($arOptions['CURRENCY']) && is_string($arOptions['CURRENCY']) ? $arOptions['CURRENCY'] : '';
if($currency === '')
{
$currency = CSaleLang::GetLangCurrency($siteId);
}
$arOrder = array(
"ORDER_PRICE" => 0,
"ORDER_WEIGHT" => 0,
"CURRENCY" => $currency,
"WEIGHT_UNIT" => htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_unit', false, $siteId)),
"WEIGHT_KOEF" => htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_koef', 1, $siteId)),
"BASKET_ITEMS" => $arShoppingCart,
"SITE_ID" => $siteId,
"LID" => $siteId,
"USER_ID" => $userId,
"USE_VAT" => false,
"VAT_RATE" => 0,
"VAT_SUM" => 0,
"DELIVERY_ID" => false,
);
$arOrderPrices = CSaleOrder::CalculateOrderPrices($arShoppingCart);
if (sizeof($arOrderPrices)>0 && isset($arOrderPrices['BASKET_ITEMS']))
$arShoppingCart = $arOrderPrices['BASKET_ITEMS'];
$arOrder['ORDER_PRICE'] = $arOrderPrices['ORDER_PRICE'];
$arOrder['ORDER_WEIGHT'] = $arOrderPrices['ORDER_WEIGHT'];
$arOrder['VAT_RATE'] = $arOrderPrices['VAT_RATE'];
$arOrder['VAT_SUM'] = $arOrderPrices['VAT_SUM'];
$arOrder["USE_VAT"] = ($arOrderPrices['USE_VAT'] == "Y"?true:false);
foreach(GetModuleEvents("sale", "OnSaleCalculateOrderShoppingCart", true) as $arEvent)
ExecuteModuleEventEx($arEvent, array(&$arOrder));
CSalePersonType::DoProcessOrder($arOrder, $personTypeId, $arErrors);
if (count($arErrors) > 0)
return null;
foreach(GetModuleEvents("sale", "OnSaleCalculateOrderPersonType", true) as $arEvent)
ExecuteModuleEventEx($arEvent, array(&$arOrder));
CSaleOrderProps::DoProcessOrder($arOrder, $arOrderPropsValues, $arErrors, $arWarnings, $paySystemId, $deliveryId);
if (count($arErrors) > 0)
return null;
foreach(GetModuleEvents("sale", "OnSaleCalculateOrderProps", true) as $arEvent)
ExecuteModuleEventEx($arEvent, array(&$arOrder));
//.........这里部分代码省略.........
示例12: Trim
$arParams["PATH_TO_AUTH"] = Trim($arParams["PATH_TO_AUTH"]);
if (strlen($arParams["PATH_TO_AUTH"]) <= 0) {
$arParams["PATH_TO_AUTH"] = "/auth/";
}
$arParams["PAY_FROM_ACCOUNT"] = $arParams["PAY_FROM_ACCOUNT"] == "N" ? "N" : "Y";
$arParams["COUNT_DELIVERY_TAX"] = $arParams["COUNT_DELIVERY_TAX"] == "Y" ? "Y" : "N";
$arParams["ONLY_FULL_PAY_FROM_ACCOUNT"] = $arParams["ONLY_FULL_PAY_FROM_ACCOUNT"] == "Y" ? "Y" : "N";
$arParams["DELIVERY_NO_AJAX"] = $arParams["DELIVERY_NO_AJAX"] == "Y" ? "Y" : "N";
$arParams["USE_PREPAYMENT"] = $arParams["USE_PREPAYMENT"] == 'Y' ? 'Y' : 'N';
$arParams["DISPLAY_IMG_HEIGHT"] = Intval($arParams["DISPLAY_IMG_HEIGHT"]) <= 0 ? 90 : Intval($arParams["DISPLAY_IMG_HEIGHT"]);
$arParams["DELIVERY_TO_PAYSYSTEM"] = strlen($arParams["DELIVERY_TO_PAYSYSTEM"]) <= 0 ? "d2p" : trim($arParams["DELIVERY_TO_PAYSYSTEM"]);
if (!isset($arParams["DISABLE_BASKET_REDIRECT"]) || 'Y' !== $arParams["DISABLE_BASKET_REDIRECT"]) {
$arParams["DISABLE_BASKET_REDIRECT"] = "N";
}
$bUseAccountNumber = COption::GetOptionString("sale", "account_number_template", "") !== "";
$arResult = array("PERSON_TYPE" => array(), "PAY_SYSTEM" => array(), "ORDER_PROP" => array(), "DELIVERY" => array(), "TAX" => array(), "ERROR" => array(), "ORDER_PRICE" => 0, "ORDER_WEIGHT" => 0, "VATE_RATE" => 0, "VAT_SUM" => 0, "bUsingVat" => false, "BASKET_ITEMS" => array(), "BASE_LANG_CURRENCY" => CSaleLang::GetLangCurrency(SITE_ID), "WEIGHT_UNIT" => htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_unit', false, SITE_ID)), "WEIGHT_KOEF" => htmlspecialcharsbx(COption::GetOptionString('sale', 'weight_koef', 1, SITE_ID)), "TaxExempt" => array(), "DISCOUNT_PRICE" => 0, "DISCOUNT_PERCENT" => 0, "DELIVERY_PRICE" => 0, "TAX_PRICE" => 0, "PAYED_FROM_ACCOUNT_FORMATED" => false, "ORDER_TOTAL_PRICE_FORMATED" => false, "ORDER_WEIGHT_FORMATED" => false, "ORDER_PRICE_FORMATED" => false, "VAT_SUM_FORMATED" => false, "DELIVERY_SUM" => false, "DELIVERY_PROFILE_SUM" => false, "DELIVERY_PRICE_FORMATED" => false, "DISCOUNT_PERCENT_FORMATED" => false, "PAY_FROM_ACCOUNT" => false, "CURRENT_BUDGET_FORMATED" => false, "USER_ACCOUNT" => false, "DISCOUNTS" => array(), "AUTH" => array(), "HAVE_PREPAYMENT" => false, "PREPAY_PS" => array(), "PREPAY_ADIT_FIELDS" => "", "PREPAY_ORDER_PROPS" => array());
$arUserResult = array("PERSON_TYPE_ID" => false, "PAY_SYSTEM_ID" => false, "DELIVERY_ID" => false, "ORDER_PROP" => false, "DELIVERY_LOCATION" => false, "TAX_LOCATION" => false, "PAYER_NAME" => false, "USER_EMAIL" => false, "PROFILE_NAME" => false, "PAY_CURRENT_ACCOUNT" => false, "CONFIRM_ORDER" => false, "FINAL_STEP" => false, "ORDER_DESCRIPTION" => false, "PROFILE_ID" => false, "PROFILE_CHANGE" => false, "DELIVERY_LOCATION_ZIP" => false);
$arResult["DELIVERY_EXTRA"] = isset($_POST["DELIVERY_ID"]) && isset($_POST["DELIVERY_EXTRA"][$_POST["DELIVERY_ID"]]) ? $_POST["DELIVERY_EXTRA"][$_POST["DELIVERY_ID"]] : array();
$arResult["AUTH"]["new_user_registration_email_confirmation"] = COption::GetOptionString("main", "new_user_registration_email_confirmation", "N") == "Y" ? "Y" : "N";
$arResult["AUTH"]["new_user_registration"] = COption::GetOptionString("main", "new_user_registration", "Y") == "Y" ? "Y" : "N";
$arParams["ALLOW_AUTO_REGISTER"] = $arParams["ALLOW_AUTO_REGISTER"] == "Y" ? "Y" : "N";
if ($arParams["ALLOW_AUTO_REGISTER"] == "Y" && ($arResult["AUTH"]["new_user_registration_email_confirmation"] == "Y" || $arResult["AUTH"]["new_user_registration"] == "N")) {
$arParams["ALLOW_AUTO_REGISTER"] = "N";
}
$arParams["SEND_NEW_USER_NOTIFY"] = $arParams["SEND_NEW_USER_NOTIFY"] == "N" ? "N" : "Y";
$arParams["ALLOW_NEW_PROFILE"] = $arParams["ALLOW_NEW_PROFILE"] == "N" ? "N" : "Y";
$allCurrency = $arResult['BASE_LANG_CURRENCY'];
if (!$arParams["DELIVERY_NO_SESSION"]) {
$arParams["DELIVERY_NO_SESSION"] = "N";
}
$arResult["BUYER_STORE"] = "";
示例13: __ConvertOldFormat
protected function __ConvertOldFormat($strAction, &$arFields)
{
global $APPLICATION;
$arMsg = array();
$boolResult = true;
$arNeedFields = array('LID', 'CURRENCY', 'DISCOUNT_TYPE', 'DISCOUNT_VALUE', 'PRICE_FROM', 'PRICE_TO');
$arUpdateFields = array('DISCOUNT_VALUE', 'PRICE_FROM', 'PRICE_TO');
$strAction = ToUpper($strAction);
if (!array_key_exists('CONDITIONS', $arFields) && !array_key_exists('ACTIONS', $arFields)) {
$strSiteCurrency = '';
$boolUpdate = false;
if ('UPDATE' == $strAction) {
$boolNeedQuery = false;
foreach ($arUpdateFields as &$strFieldID) {
if (array_key_exists($strFieldID, $arFields)) {
$boolUpdate = true;
break;
}
}
if (isset($strFieldID)) {
unset($strFieldID);
}
if ($boolUpdate) {
foreach ($arNeedFields as &$strFieldID) {
if (!array_key_exists($strFieldID, $arFields)) {
$boolNeedQuery = true;
break;
}
}
if (isset($strFieldID)) {
unset($strFieldID);
}
if ($boolNeedQuery) {
$rsDiscounts = CSaleDiscount::GetList(array(), array('ID' => $arFields['ID']), false, false, $arNeedFields);
if ($arDiscount = $rsDiscounts->Fetch()) {
foreach ($arNeedFields as &$strFieldID) {
if (!array_key_exists($strFieldID, $arFields)) {
$arFields[$strFieldID] = $arDiscount[$strFieldID];
}
}
if (isset($strFieldID)) {
unset($strFieldID);
}
} else {
$boolUpdate = false;
$boolResult = false;
$arMsg[] = array('id' => 'ID', 'text' => GetMessage('BT_MOD_SALE_ERR_DSC_ABSENT'));
}
}
}
}
if ('ADD' == $strAction || $boolUpdate) {
if (!array_key_exists('LID', $arFields)) {
$boolResult = false;
$arMsg[] = array('id' => 'LID', 'text' => GetMessage('BT_MOD_SALE_ERR_DSC_SITE_ID_ABSENT'));
} else {
$arFields['LID'] = strval($arFields['LID']);
if ('' == $arFields['LID']) {
$boolResult = false;
$arMsg[] = array('id' => 'LID', 'text' => GetMessage('BT_MOD_SALE_ERR_DSC_SITE_ID_ABSENT'));
} else {
$rsSites = CSite::GetByID($arFields["LID"]);
if (!($arSite = $rsSites->Fetch())) {
$boolResult = false;
$arMsg[] = array('id' => 'LID', 'text' => str_replace("#ID#", $arFields["LID"], GetMessage("SKGD_NO_SITE")));
} else {
$strSiteCurrency = CSaleLang::GetLangCurrency($arFields['LID']);
}
}
}
if (!array_key_exists('CURRENCY', $arFields)) {
$boolResult = false;
$arMsg[] = array('id' => 'CURRENCY', 'text' => GetMessage('BT_MOD_SALE_ERR_DSC_CURRENCY_ABSENT'));
} else {
$arFields['CURRENCY'] = strval($arFields['CURRENCY']);
if ('' == $arFields['CURRENCY']) {
$boolResult = false;
$arMsg[] = array('id' => 'CURRENCY', 'text' => GetMessage('BT_MOD_SALE_ERR_DSC_CURRENCY_ABSENT'));
} else {
if (!($arCurrency = CCurrency::GetByID($arFields["CURRENCY"]))) {
$boolResult = false;
$arMsg[] = array('id' => 'CURRENCY', 'text' => str_replace("#ID#", $arFields["CURRENCY"], GetMessage("SKGD_NO_CURRENCY")));
}
}
}
if (!array_key_exists("DISCOUNT_TYPE", $arFields)) {
$boolResult = false;
$arMsg[] = array('id' => 'DISCOUNT_TYPE', 'text' => GetMessage('BT_MOD_SALE_ERR_DSC_TYPE_ABSENT'));
} else {
$arFields["DISCOUNT_TYPE"] = strval($arFields["DISCOUNT_TYPE"]);
if (CSaleDiscount::OLD_DSC_TYPE_PERCENT != $arFields["DISCOUNT_TYPE"] && CSaleDiscount::OLD_DSC_TYPE_FIX != $arFields["DISCOUNT_TYPE"]) {
$boolResult = false;
$arMsg[] = array('id' => 'DISCOUNT_TYPE', 'text' => GetMessage('BT_MOD_SALE_ERR_DSC_TYPE_BAD'));
}
}
if (!array_key_exists('DISCOUNT_VALUE', $arFields)) {
$boolResult = false;
$arMsg[] = array('id' => 'DISCOUNT_VALUE', 'text' => GetMessage('BT_MOD_SALE_ERR_DSC_VALUE_ABSENT'));
} else {
$arFields['DISCOUNT_VALUE'] = doubleval(str_replace(',', '.', $arFields['DISCOUNT_VALUE']));
//.........这里部分代码省略.........
示例14: notifyNewOrder
public static function notifyNewOrder($newOrderId, $siteId, $buyerEmail = "", $buyerFio = "")
{
if (strlen($newOrderId) <= 0) {
throw new ArgumentNullException("newOrderId");
}
if (strlen($siteId) <= 0) {
throw new ArgumentNullException("siteId");
}
global $DB;
$strOrderList = "";
$baseLangCurrency = \CSaleLang::GetLangCurrency($siteId);
$orderNew = \CSaleOrder::GetByID($newOrderId);
$orderNew["BASKET_ITEMS"] = array();
$dbBasketTmp = \CSaleBasket::GetList(array("SET_PARENT_ID" => "DESC", "TYPE" => "DESC", "NAME" => "ASC"), array("ORDER_ID" => $newOrderId), false, false, array("ID", "PRICE", "QUANTITY", "NAME"));
while ($arBasketTmp = $dbBasketTmp->GetNext()) {
$orderNew["BASKET_ITEMS"][] = $arBasketTmp;
}
$orderNew["BASKET_ITEMS"] = getMeasures($orderNew["BASKET_ITEMS"]);
foreach ($orderNew["BASKET_ITEMS"] as $val) {
if (\CSaleBasketHelper::isSetItem($val)) {
continue;
}
$measure = isset($val["MEASURE_TEXT"]) ? $val["MEASURE_TEXT"] : GetMessage("SALE_YMH_SHT");
$strOrderList .= $val["NAME"] . " - " . $val["QUANTITY"] . " " . $measure . ": " . SaleFormatCurrency($val["PRICE"], $baseLangCurrency);
$strOrderList .= "\n";
}
//send mail
$arFields = array("ORDER_ID" => $orderNew["ACCOUNT_NUMBER"], "ORDER_DATE" => Date($DB->DateFormatToPHP(\CLang::GetDateFormat("SHORT", $siteId))), "ORDER_USER" => $buyerFio, "PRICE" => SaleFormatCurrency($orderNew["PRICE"], $baseLangCurrency), "BCC" => \COption::GetOptionString("sale", "order_email", "order@" . $_SERVER['SERVER_NAME']), "EMAIL_TO" => array("PAYER_NAME" => $buyerFio, "USER_EMAIL" => $buyerEmail), "ORDER_LIST" => $strOrderList, "SALE_EMAIL" => \COption::GetOptionString("sale", "order_email", "order@" . $_SERVER['SERVER_NAME']), "DELIVERY_PRICE" => $orderNew["DELIVERY_PRICE"]);
$eventName = "SALE_NEW_ORDER";
$bSend = true;
foreach (GetModuleEvents("sale", "OnOrderNewSendEmail", true) as $arEvent) {
if (ExecuteModuleEventEx($arEvent, array($newOrderId, &$eventName, &$arFields)) === false) {
$bSend = false;
}
}
$emailSendRes = false;
if ($bSend) {
$event = new \CEvent();
$emailSendRes = $event->Send($eventName, $siteId, $arFields, "N");
}
$pushSendResult = \CSaleMobileOrderPush::send("ORDER_CREATED", array("ORDER" => $orderNew));
return $emailSendRes && $pushSendResult;
}
示例15: array
}
if ($USER->GetID() <= 0) {
$APPLICATION->AuthForm(GetMessage('SPT_ACCESS_DENIED'));
return;
}
if (!is_array($arParams['ALLOWED_CURRENCY'])) {
$arParams['ALLOWED_CURRENCY'] = array();
}
$arParams['COMISSION'] = round($arParams['COMISSION'], 2);
$arParams['CART_PAGE'] = trim($arParams['CART_PAGE']);
$arParams['PAY_IMMED'] = isset($arParams['PAY_IMMED']) && $arParams['PAY_IMMED'] == 'Y';
$arResult = array();
$arResult['ACCOUNT'] = array();
$arResult['CURRENCIES'] = array();
$arResult['ERROR'] = '';
$arResult['LANG_CURRENCY'] = CSaleLang::GetLangCurrency(SITE_ID);
$arResult['REQUEST_AMOUNT'] = $_REQUEST['amount'] > 0 ? round(str_replace(',', '.', trim($_REQUEST['amount'])), 2) : '';
$arResult['REQUEST_ACCOUNT'] = isset($_REQUEST['account']) ? $_REQUEST['account'] : $arParams['DEFAULT_CURRENCY'];
$arResult['REQUEST_PAY_SYSTEM'] = isset($_REQUEST['pay_system']) ? $_REQUEST['pay_system'] : 0;
$i = 0;
$rsCurrency = CCurrency::GetList($by = 'name', $order = 'desc', LANGUAGE_ID);
while ($arCurrency = $rsCurrency->Fetch()) {
$arCurrency['ID'] = ++$i;
if ($arCurrency['CURRENCY'] != $arResult['LANG_CURRENCY']) {
$arCurrency['FACTOR'] = round(CCurrencyRates::GetConvertFactor($arCurrency['CURRENCY'], $arResult['LANG_CURRENCY']), 2);
} else {
$arCurrency['FACTOR'] = 1;
}
$arResult['CURRENCIES'][$arCurrency['CURRENCY']] = $arCurrency;
if (empty($arParams['ALLOWED_CURRENCY']) || in_array($arCurrency['CURRENCY'], $arParams['ALLOWED_CURRENCY'])) {
$arResult['ACCOUNT'][$arCurrency['CURRENCY']] = array();