本文整理汇总了PHP中CCurrency::GetBaseCurrency方法的典型用法代码示例。如果您正苦于以下问题:PHP CCurrency::GetBaseCurrency方法的具体用法?PHP CCurrency::GetBaseCurrency怎么用?PHP CCurrency::GetBaseCurrency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCurrency
的用法示例。
在下文中一共展示了CCurrency::GetBaseCurrency方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: orderHistory
//.........这里部分代码省略.........
switch ($dbUser->SelectedRowsCount()) {
case 0:
$login = $order['customer']['email'];
break;
case 1:
$arUser = $dbUser->Fetch();
$registeredUserID = $arUser['ID'];
$registerNewUser = false;
break;
default:
$login = uniqid('user_' . time()) . '@crm.com';
break;
}
}
if ($registerNewUser === true) {
$userPassword = uniqid();
$newUser = new CUser();
$arFields = array("NAME" => self::fromJSON($order['customer']['firstName']), "LAST_NAME" => self::fromJSON($order['customer']['lastName']), "EMAIL" => $order['customer']['email'], "LOGIN" => $login, "LID" => "ru", "ACTIVE" => "Y", "PASSWORD" => $userPassword, "CONFIRM_PASSWORD" => $userPassword);
$registeredUserID = $newUser->Add($arFields);
if ($registeredUserID === false) {
self::eventLog('ICrmOrderActions::orderHistory', 'CUser::Register', 'Error register user');
continue;
}
try {
$api->customerFixExternalIds(array(array('id' => $order['customer']['id'], 'externalId' => $registeredUserID)));
} catch (\RetailCrm\Exception\CurlException $e) {
self::eventLog('ICrmOrderActions::orderHistory', 'RetailCrm\\RestApi::customerFixExternalIds::CurlException', $e->getCode() . ': ' . $e->getMessage());
continue;
}
}
$order['customer']['externalId'] = $registeredUserID;
}
// new order
$newOrderFields = array('LID' => CSite::GetDefSite(), 'PERSON_TYPE_ID' => isset($optionsOrderTypes[$order['orderType']]) ? $optionsOrderTypes[$order['orderType']] : $defaultOrderType, 'PAYED' => 'N', 'CANCELED' => 'N', 'STATUS_ID' => 'N', 'PRICE' => 0, 'CURRENCY' => CCurrency::GetBaseCurrency(), 'USER_ID' => $order['customer']['externalId'], 'PAY_SYSTEM_ID' => 0, 'PRICE_DELIVERY' => 0, 'DELIVERY_ID' => 0, 'DISCOUNT_VALUE' => 0, 'USER_DESCRIPTION' => '');
if (count($optionsSitesList) > 1 && ($lid = array_search($order['site'], $optionsSitesList))) {
$newOrderFields['LID'] = $lid;
}
$externalId = CSaleOrder::Add($newOrderFields);
if (!isset($order['externalId'])) {
try {
$api->orderFixExternalIds(array(array('id' => $order['id'], 'externalId' => $externalId)));
} catch (\RetailCrm\Exception\CurlException $e) {
self::eventLog('ICrmOrderActions::orderHistory', 'RetailCrm\\RestApi::orderFixExternalIds::CurlException', $e->getCode() . ': ' . $e->getMessage());
continue;
}
}
$order['externalId'] = $externalId;
}
if (isset($order['externalId']) && $order['externalId']) {
// custom orderType function
if (function_exists('intarocrm_set_order_type')) {
$orderType = intarocrm_set_order_type($order);
if ($orderType) {
$optionsOrderTypes[$order['orderType']] = $orderType;
} else {
$optionsOrderTypes[$order['orderType']] = $defaultOrderType;
}
}
$arFields = CSaleOrder::GetById($order['externalId']);
// incorrect order
if ($arFields === false || empty($arFields)) {
continue;
}
$LID = $arFields['LID'];
$userId = $arFields['USER_ID'];
if (isset($order['customer']['externalId']) && !is_null($order['customer']['externalId'])) {
示例2: GetBaseCurrency
public static function GetBaseCurrency()
{
if (!CModule::IncludeModule('currency')) {
return false;
}
$baseCurrencyID = CCurrency::GetBaseCurrency();
if (!isset($baseCurrencyID[0])) {
return false;
}
return self::GetByID($baseCurrencyID);
}
示例3: randString
return false;
}
$saleModulePermissions = $GLOBALS["APPLICATION"]->GetGroupRight("sale");
if (intval($arGadgetParams["ITEMS_COUNT"]) <= 0 || intval($arGadgetParams["ITEMS_COUNT"]) > 40) {
$arGadgetParams["ITEMS_COUNT"] = 10;
}
if (strlen($arGadgetParams["SITE_ID"]) > 0) {
$arGadgetParams["SITE_CURRENCY"] = CSaleLang::GetLangCurrency($arGadgetParams["SITE_ID"]);
if (strlen($arGadgetParams["TITLE_STD"]) <= 0) {
$rsSites = CSite::GetByID($arGadgetParams["SITE_ID"]);
if ($arSite = $rsSites->GetNext()) {
$arGadget["TITLE"] .= " / [" . $arSite["ID"] . "] " . $arSite["NAME"];
}
}
} else {
$arGadgetParams["SITE_CURRENCY"] = CCurrency::GetBaseCurrency();
}
$arGadgetParams["RND_STRING"] = randString(8);
$arOrderStats = array();
$arOrders = array();
$arCurUsed = array();
if (strlen($arGadgetParams["SITE_ID"]) > 0) {
$arFilterLID = array("LID" => $arGadgetParams["SITE_ID"]);
} else {
$arFilterLID = array();
}
if ($saleModulePermissions != "W") {
$arFilterPerms = array("STATUS_PERMS_GROUP_ID" => $GLOBALS["USER"]->GetUserGroupArray(), ">=STATUS_PERMS_PERM_VIEW" => "Y");
} else {
$arFilterPerms = array();
}
示例4: array
$arFilter = array("name" => "sharpen", "precision" => $arParams["SHARPEN"]);
}
$arFileTmp = CFile::ResizeImageGet($arResult['DETAIL_PICTURE'], array("width" => $arParams["DISPLAY_DETAIL_IMG_WIDTH"], "height" => $arParams["DISPLAY_DETAIL_IMG_HEIGHT"]), BX_RESIZE_IMAGE_PROPORTIONAL, true, $arFilter);
$arResult['DETAIL_PICTURE_280'] = array('SRC' => $arFileTmp["src"], 'WIDTH' => $arFileTmp["width"], 'HEIGHT' => $arFileTmp["height"]);
}
if (is_array($arResult['MORE_PHOTO']) && count($arResult['MORE_PHOTO']) > 0) {
unset($arResult['DISPLAY_PROPERTIES']['MORE_PHOTO']);
foreach ($arResult['MORE_PHOTO'] as $key => $arFile) {
$arFilter = '';
if ($arParams["SHARPEN"] != 0) {
$arFilter = array("name" => "sharpen", "precision" => $arParams["SHARPEN"]);
}
$arFileTmp = CFile::ResizeImageGet($arFile, array("width" => $arParams["DISPLAY_MORE_PHOTO_WIDTH"], "height" => $arParams["DISPLAY_MORE_PHOTO_HEIGHT"]), BX_RESIZE_IMAGE_PROPORTIONAL, true, $arFilter);
$arFile['PREVIEW_WIDTH'] = $arFileTmp["width"];
$arFile['PREVIEW_HEIGHT'] = $arFileTmp["height"];
$arFile['SRC'] = $arFileTmp['src'];
$arResult['MORE_PHOTO'][$key] = $arFile;
}
}
if (CModule::IncludeModule('currency')) {
if (isset($arResult['DISPLAY_PROPERTIES']['MINIMUM_PRICE'])) {
$arResult['DISPLAY_PROPERTIES']['MINIMUM_PRICE']['DISPLAY_VALUE'] = FormatCurrency($arResult['DISPLAY_PROPERTIES']['MINIMUM_PRICE']['VALUE'], CCurrency::GetBaseCurrency());
}
if (isset($arResult['DISPLAY_PROPERTIES']['MAXIMUM_PRICE'])) {
$arResult['DISPLAY_PROPERTIES']['MAXIMUM_PRICE']['DISPLAY_VALUE'] = FormatCurrency($arResult['DISPLAY_PROPERTIES']['MAXIMUM_PRICE']['VALUE'], CCurrency::GetBaseCurrency());
}
}
$this->__component->SetResultCacheKeys(array("DISPLAY_PROPERTIES"));
$this->__component->SetResultCacheKeys(array("DETAIL_TEXT"));
$this->__component->SetResultCacheKeys(array("CAN_BUY"));
//$this->__component->SetResultCacheKeys(array("OFFERS_IDS"));
示例5: GetOptimalPrice
//.........这里部分代码省略.........
if (0 >= $quantity)
{
$APPLICATION->ThrowException(GetMessage("BT_MOD_CATALOG_PROD_ERR_QUANTITY_ABSENT"), "NO_QUANTITY");
return false;
}
if (!is_array($arUserGroups) && intval($arUserGroups)."|" == $arUserGroups."|")
$arUserGroups = array(intval($arUserGroups));
if (!is_array($arUserGroups))
$arUserGroups = array();
if (!in_array(2, $arUserGroups))
$arUserGroups[] = 2;
$rsVAT = CCatalogProduct::GetVATInfo($intProductID);
if ($arVAT = $rsVAT->Fetch())
{
$arVAT['RATE'] = doubleval($arVAT['RATE'] * 0.01);
}
else
{
$arVAT = array('RATE' => 0.0, 'VAT_INCLUDED' => 'N');
}
$renewal = (($renewal == "N") ? "N" : "Y");
if (false === $siteID)
$siteID = SITE_ID;
if (false === $arDiscountCoupons)
$arDiscountCoupons = CCatalogDiscountCoupon::GetCoupons();
$strBaseCurrency = CCurrency::GetBaseCurrency();
if (empty($strBaseCurrency))
{
$APPLICATION->ThrowException(GetMessage("BT_MOD_CATALOG_PROD_ERR_NO_BASE_CURRENCY"), "NO_BASE_CURRENCY");
return false;
}
$intIBlockID = intval(CIBlockElement::GetIBlockByID($intProductID));
if (0 >= $intIBlockID)
{
$APPLICATION->ThrowException(str_replace("#ID#", $intProductID, GetMessage('BT_MOD_CATALOG_PROD_ERR_ELEMENT_ID_NOT_FOUND')), "NO_ELEMENT");
return false;
}
if (!isset($arPrices) || !is_array($arPrices))
$arPrices = array();
if (empty($arPrices))
{
$arPrices = array();
$dbPriceList = CPrice::GetListEx(
array(),
array(
"PRODUCT_ID" => $intProductID,
"GROUP_GROUP_ID" => $arUserGroups,
"GROUP_BUY" => "Y",
"+<=QUANTITY_FROM" => $quantity,
"+>=QUANTITY_TO" => $quantity
),
false,
false,
array("ID", "CATALOG_GROUP_ID", "PRICE", "CURRENCY")
);
示例6: updateUserHandlerOptimalPrice
/**
* Update result user handlers for event OnGetOptimalPrice.
*
* @param array &$userResult Optimal price array.
* @return void
*/
public static function updateUserHandlerOptimalPrice(&$userResult)
{
global $APPLICATION;
if (empty($userResult) || !is_array($userResult)) {
$userResult = false;
return;
}
if (empty($userResult['PRICE']) || !is_array($userResult['PRICE'])) {
$userResult = false;
return;
}
if (empty($userResult['RESULT_PRICE']) || !is_array($userResult['RESULT_PRICE'])) {
$resultCurrency = CCurrency::GetBaseCurrency();
if (empty($resultCurrency)) {
$APPLICATION->ThrowException(Loc::getMessage('BT_MOD_CATALOG_PROD_ERR_NO_BASE_CURRENCY'), 'NO_BASE_CURRENCY');
$userResult = false;
return;
}
if (self::$usedCurrency !== null) {
$resultCurrency = self::$usedCurrency;
}
$oldDiscountExist = !empty($userResult['DISCOUNT']) && is_array($userResult['DISCOUNT']);
if ($oldDiscountExist) {
if (empty($userResult['DISCOUNT']['MODULE_ID'])) {
$userResult['DISCOUNT']['MODULE_ID'] = 'catalog';
}
if ($userResult['DISCOUNT']['CURRENCY'] != $resultCurrency) {
Catalog\DiscountTable::convertCurrency($userResult['DISCOUNT'], $resultCurrency);
}
}
if (!isset($userResult['DISCOUNT_LIST']) || !is_array($userResult['DISCOUNT_LIST'])) {
$userResult['DISCOUNT_LIST'] = array();
if ($oldDiscountExist) {
$userResult['DISCOUNT_LIST'][] = $userResult['DISCOUNT'];
}
}
if (isset($userResult['DISCOUNT_LIST'])) {
foreach ($userResult['DISCOUNT_LIST'] as &$discount) {
if (empty($discount['MODULE_ID'])) {
$discount['MODULE_ID'] = 'catalog';
}
if ($discount['CURRENCY'] != $resultCurrency) {
Catalog\DiscountTable::convertCurrency($discount, $resultCurrency);
}
}
unset($discount);
}
$userResult['RESULT_PRICE'] = CCatalogDiscount::calculateDiscountList($userResult['PRICE'], $resultCurrency, $userResult['DISCOUNT_LIST'], self::$optimalPriceWithVat);
} else {
$userResult['RESULT_PRICE']['BASE_PRICE'] = roundEx($userResult['RESULT_PRICE']['BASE_PRICE'], CATALOG_VALUE_PRECISION);
$userResult['RESULT_PRICE']['DISCOUNT'] = roundEx($userResult['RESULT_PRICE']['DISCOUNT'], CATALOG_VALUE_PRECISION);
$userResult['RESULT_PRICE']['DISCOUNT_PRICE'] = $userResult['RESULT_PRICE']['BASE_PRICE'] - $userResult['RESULT_PRICE']['DISCOUNT'];
$userResult['RESULT_PRICE']['VAT_RATE'] = $userResult['PRICE']['VAT_RATE'];
}
}
示例7: getPrices
protected function getPrices($productId, $siteId)
{
$minPrice = 0;
$minPriceRUR = 0;
$minPriceGroup = 0;
$minPriceCurrency = "";
$baseCurrency = \CCurrency::GetBaseCurrency();
$RUR = $this->getRub();
if ($this->xmlData['PRICE'] > 0) {
$rsPrices = \CPrice::GetListEx(array(), array('PRODUCT_ID' => $productId, 'CATALOG_GROUP_ID' => $this->xmlData['PRICE'], 'CAN_BUY' => 'Y', 'GROUP_GROUP_ID' => array(2), '+<=QUANTITY_FROM' => 1, '+>=QUANTITY_TO' => 1));
if ($arPrice = $rsPrices->Fetch()) {
if ($arOptimalPrice = \CCatalogProduct::GetOptimalPrice($productId, 1, array(2), 'N', array($arPrice), $siteId)) {
$minPrice = $arOptimalPrice['DISCOUNT_PRICE'];
$minPriceCurrency = $baseCurrency;
$minPriceRUR = \CCurrencyRates::ConvertCurrency($minPrice, $baseCurrency, $RUR);
$minPriceGroup = $arOptimalPrice['PRICE']['CATALOG_GROUP_ID'];
}
}
} else {
if ($arPrice = \CCatalogProduct::GetOptimalPrice($productId, 1, array(2), 'N', array(), $siteId)) {
$minPrice = $arPrice['DISCOUNT_PRICE'];
$minPriceCurrency = $baseCurrency;
$minPriceRUR = \CCurrencyRates::ConvertCurrency($minPrice, $baseCurrency, $RUR);
$minPriceGroup = $arPrice['PRICE']['CATALOG_GROUP_ID'];
}
}
$result = array("MIN" => $minPrice, "MIN_RUB" => $minPriceRUR, "MIN_GROUP" => $minPriceGroup, "MIN_CURRENCY" => $minPriceCurrency);
return $result;
}
示例8: SubscribeProduct
function SubscribeProduct($intProductID, $arRewriteFields = array(), $arProductParams = array())
{
global $USER;
if (!CCatalog::IsUserExists())
return false;
if (!$USER->IsAuthorized())
return false;
$intUserID = intval($USER->GetID());
$intProductID = intval($intProductID);
if (0 >= $intProductID)
{
$APPLICATION->ThrowException(GetMessage('CATALOG_ERR_EMPTY_PRODUCT_ID'), "EMPTY_PRODUCT_ID");
return false;
}
if (!CModule::IncludeModule("sale"))
{
$APPLICATION->ThrowException(GetMessage('CATALOG_ERR_NO_SALE_MODULE'), "NO_SALE_MODULE");
return false;
}
if (CModule::IncludeModule("statistic") && array_key_exists('SESS_SEARCHER_ID', $_SESSION) && 0 < intval($_SESSION["SESS_SEARCHER_ID"]))
{
$APPLICATION->ThrowException(GetMessage('CATALOG_ERR_SESS_SEARCHER'), "SESS_SEARCHER");
return false;
}
$rsProducts = CCatalogProduct::GetList(
array(),
array('ID' => $intProductID),
false,
false,
array(
'ID',
'WEIGHT',
)
);
if (!($arCatalogProduct = $rsProducts->Fetch()))
{
$APPLICATION->ThrowException(GetMessage('CATALOG_ERR_NO_PRODUCT'), "NO_PRODUCT");
return false;
}
$rsItems = CIBlockElement::GetList(
array(),
array(
"ID" => $intProductID,
"ACTIVE" => "Y",
"ACTIVE_DATE" => "Y",
"CHECK_PERMISSIONS" => "Y",
"MIN_PERMISSION" => "R"
),
false,
false,
array(
'ID',
'IBLOCK_ID',
'NAME',
'XML_ID',
'DETAIL_PAGE_URL'
)
);
if (!($arProduct = $rsItems->Fetch()))
return false;
$arPrice = array(
'PRICE' => 0.0,
'CURRENCY' => CSaleLang::GetLangCurrency(SITE_ID),
'VAT_RATE' => 0,
'PRODUCT_PRICE_ID' => 0,
'CATALOG_GROUP_NAME' => '',
);
$arBuyerGroups = $USER->GetUserGroupArray();
$arSubscrPrice = CCatalogProduct::GetOptimalPrice($intProductID, 1, $arBuyerGroups, "N", array(), SITE_ID, array());
if (!empty($arSubscrPrice) && is_array($arSubscrPrice))
{
$arPrice['PRICE'] = $arSubscrPrice['DISCOUNT_PRICE'];
$arPrice['CURRENCY'] = CCurrency::GetBaseCurrency();
$arPrice['VAT_RATE'] = $arSubscrPrice['PRICE']['VAT_RATE'];
$arPrice['PRODUCT_PRICE_ID'] = $arSubscrPrice["PRICE"]["ID"];
$arPrice['CATALOG_GROUP_NAME'] = $arSubscrPrice["PRICE"]["CATALOG_GROUP_NAME"];
}
$arProps = array();
$strIBlockXmlID = strval(CIBlock::GetArrayByID($arProduct['IBLOCK_ID'], 'XML_ID'));
if ('' != $strIBlockXmlID)
{
$arProps[] = array(
"NAME" => "Catalog XML_ID",
"CODE" => "CATALOG.XML_ID",
"VALUE" => $strIBlockXmlID
);
}
$arProps[] = array(
"NAME" => "Product XML_ID",
"CODE" => "PRODUCT.XML_ID",
//.........这里部分代码省略.........
示例9: GetBuyersList
public static function GetBuyersList($arOrder = array(), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
{
global $DB;
if (empty($arSelectFields) || in_array("*", $arSelectFields)) {
$arSelectFields = array("ID", "ACTIVE", "LID", "DATE_REGISTER", "LOGIN", "EMAIL", "NAME", "LAST_NAME", "SECOND_NAME", "PERSONAL_PHONE", "USER_ID", "LAST_LOGIN", "TIMESTAMP_X", "PERSONAL_BIRTHDAY", "ORDER_COUNT", "ORDER_SUM", "CURRENCY", "LAST_ORDER_DATE");
}
$arFields_m = array("ACTIVE", "LOGIN", "EMAIL", "NAME", "LAST_NAME", "SECOND_NAME", "PERSONAL_PHONE");
$arFields_md = array("LAST_LOGIN", "DATE_REGISTER", "TIMESTAMP_X", "PERSONAL_BIRTHDAY");
$CURRENCY = "";
if (strlen($arFilter["CURRENCY"]) > 0) {
$CURRENCY = $arFilter["CURRENCY"];
unset($arFilter["CURRENCY"]);
} else {
CModule::IncludeModule("currency");
$CURRENCY = CCurrency::GetBaseCurrency();
}
$LID = "";
if (strlen($arFilter["LID"]) > 0) {
$LID = $arFilter["LID"];
unset($arFilter["LID"]);
} else {
$rsSites = CSite::GetList($by = "id", $order = "asc", array("ACTIVE" => "Y"));
$arSite = $rsSites->Fetch();
$LID = $arSite["ID"];
}
$arFields = array("ID" => array("FIELD" => "F.ID", "TYPE" => "int"), "LID" => array("FIELD" => "O1.LID", "TYPE" => "string"), "ORDER_COUNT" => array("FIELD" => "(SELECT COUNT(O3.PRICE) FROM b_sale_order O3 WHERE O3.USER_ID=F.USER_ID AND O3.CURRENCY = '" . $DB->ForSQL($CURRENCY) . "' AND O3.PAYED = 'Y' AND O3.LID = '" . $DB->ForSQL($LID) . "' )", "TYPE" => "double"), "ORDER_SUM" => array("FIELD" => "(SELECT SUM(O3.PRICE) FROM b_sale_order O3 WHERE O3.USER_ID=F.USER_ID AND O3.CURRENCY = '" . $DB->ForSQL($CURRENCY) . "' AND O3.PAYED = 'Y' AND O3.LID = '" . $DB->ForSQL($LID) . "' )", "TYPE" => "double"), "CURRENCY" => array("FIELD" => "O1.CURRENCY", "TYPE" => "string", "FROM" => "LEFT JOIN b_sale_order O1 ON (O1.USER_ID=U.ID AND O1.CURRENCY = '" . $DB->ForSQL($CURRENCY) . "' AND O1.LID = '" . $DB->ForSQL($LID) . "' AND O1.PAYED = 'Y')"), "LAST_ORDER_DATE" => array("FIELD" => "(SELECT MAX(O2.DATE_INSERT) FROM b_sale_order O2 WHERE (O2.USER_ID=F.USER_ID))", "TYPE" => "datetime"), "NAME_SEARCH" => array("FIELD" => "U.NAME, U.LAST_NAME, U.SECOND_NAME, U.EMAIL, U.LOGIN, U.ID", "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (U.ID = F.USER_ID)"), "USER_ID" => array("FIELD" => "F.USER_ID", "TYPE" => "int", "FROM" => "INNER JOIN b_user U ON (U.ID = F.USER_ID)"), "GROUPS_ID" => array("FIELD" => "UG.GROUP_ID", "TYPE" => "int", "FROM" => "LEFT JOIN b_user_group UG ON (UG.USER_ID = F.USER_ID)"));
foreach ($arFields_m as $val) {
$arFields[$val] = array("FIELD" => "U." . $val, "TYPE" => "string", "FROM" => "INNER JOIN b_user U ON (U.ID = F.USER_ID)");
}
foreach ($arFields_md as $val) {
$arFields[$val] = array("FIELD" => "U." . $val, "TYPE" => "datetime", "FROM" => "INNER JOIN b_user U ON (U.ID = F.USER_ID)");
}
if (!in_array("USER_ID", $arSelectFields)) {
$arSelectFields[] = "USER_ID";
}
$arFilterH = array();
if (!empty($arFilter)) {
foreach ($arFilter as $k => $v) {
if (strpos($k, "ORDER_SUM") !== false || strpos($k, "ORDER_COUNT") !== false || strpos($k, "LAST_ORDER_DATE") !== false) {
$arFilterH[$k] = $v;
unset($arFilter[$k]);
}
}
}
if (!empty($arFilterH)) {
$arSqlsH = CSaleOrder::PrepareSql($arFields, $arOrder, $arFilterH, false, $arSelectFields);
}
$arSqls = CSaleOrder::PrepareSql($arFields, $arOrder, $arFilter, $arGroupBy, $arSelectFields);
$arSqls["SELECT"] = str_replace("%%_DISTINCT_%%", "", $arSqls["SELECT"]);
$strSql = "SELECT " . $arSqls["SELECT"] . " " . "FROM b_sale_fuser F " . "\t" . $arSqls["FROM"] . " ";
if (strlen($arSqls["WHERE"]) > 0) {
$strSql .= "WHERE " . $arSqls["WHERE"] . " ";
}
$strSql .= "GROUP BY F.USER_ID ";
if (strlen($arSqlsH["WHERE"]) > 0) {
$strSql .= "HAVING " . $arSqlsH["WHERE"] . " ";
}
if (strlen($arSqls["ORDERBY"]) > 0) {
$strSql .= "ORDER BY " . $arSqls["ORDERBY"] . " ";
}
// echo "!3!=".htmlspecialcharsbx($strSql)."<br>";
if (is_array($arNavStartParams) && IntVal($arNavStartParams["nTopCount"]) <= 0) {
$strSql_tmp = "SELECT COUNT('x') as CNT " . "FROM b_sale_fuser F " . "\t" . $arSqls["FROM"] . " ";
if (strlen($arSqls["WHERE"]) > 0) {
$strSql_tmp .= "WHERE " . $arSqls["WHERE"] . " ";
}
$strSql_tmp .= "GROUP BY F.USER_ID ";
if (strlen($arSqlsH["WHERE"]) > 0) {
$strSql_tmp .= "HAVING " . $arSqlsH["WHERE"] . " ";
}
// echo "!2.1!=".htmlspecialcharsbx($strSql_tmp)."<br>";
$dbRes = $DB->Query($strSql_tmp, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$cnt = $dbRes->SelectedRowsCount();
$dbRes = new CDBResult();
// echo "!2.2!=".htmlspecialcharsbx($strSql)."<br>";
$dbRes->NavQuery($strSql, $cnt, $arNavStartParams);
} else {
if (is_array($arNavStartParams) && IntVal($arNavStartParams["nTopCount"]) > 0) {
$strSql .= "LIMIT " . IntVal($arNavStartParams["nTopCount"]);
}
// echo "!3!=".htmlspecialcharsbx($strSql)."<br>";
$dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
}
return $dbRes;
}
示例10: DoIBlockAfterSave
function DoIBlockAfterSave($arg1, $arg2 = false)
{
$ELEMENT_ID = false;
$IBLOCK_ID = false;
$OFFERS_IBLOCK_ID = false;
$OFFERS_PROPERTY_ID = false;
if (CModule::IncludeModule('currency')) {
$strDefaultCurrency = CCurrency::GetBaseCurrency();
}
//Check for catalog event
if (is_array($arg2) && $arg2["PRODUCT_ID"] > 0) {
//Get iblock element
$rsPriceElement = CIBlockElement::GetList(array(), array("ID" => $arg2["PRODUCT_ID"]), false, false, array("ID", "IBLOCK_ID"));
if ($arPriceElement = $rsPriceElement->Fetch()) {
$arCatalog = CCatalog::GetByID($arPriceElement["IBLOCK_ID"]);
if (is_array($arCatalog)) {
//Check if it is offers iblock
if ($arCatalog["OFFERS"] == "Y") {
//Find product element
$rsElement = CIBlockElement::GetProperty($arPriceElement["IBLOCK_ID"], $arPriceElement["ID"], "sort", "asc", array("ID" => $arCatalog["SKU_PROPERTY_ID"]));
$arElement = $rsElement->Fetch();
if ($arElement && $arElement["VALUE"] > 0) {
$ELEMENT_ID = $arElement["VALUE"];
$IBLOCK_ID = $arCatalog["PRODUCT_IBLOCK_ID"];
$OFFERS_IBLOCK_ID = $arCatalog["IBLOCK_ID"];
$OFFERS_PROPERTY_ID = $arCatalog["SKU_PROPERTY_ID"];
}
} elseif ($arCatalog["OFFERS_IBLOCK_ID"] > 0) {
$ELEMENT_ID = $arPriceElement["ID"];
$IBLOCK_ID = $arPriceElement["IBLOCK_ID"];
$OFFERS_IBLOCK_ID = $arCatalog["OFFERS_IBLOCK_ID"];
$OFFERS_PROPERTY_ID = $arCatalog["OFFERS_PROPERTY_ID"];
} else {
$ELEMENT_ID = $arPriceElement["ID"];
$IBLOCK_ID = $arPriceElement["IBLOCK_ID"];
$OFFERS_IBLOCK_ID = false;
$OFFERS_PROPERTY_ID = false;
}
}
}
} elseif (is_array($arg1) && $arg1["ID"] > 0 && $arg1["IBLOCK_ID"] > 0) {
//Check if iblock has offers
$arOffers = CIBlockPriceTools::GetOffersIBlock($arg1["IBLOCK_ID"]);
if (is_array($arOffers)) {
$ELEMENT_ID = $arg1["ID"];
$IBLOCK_ID = $arg1["IBLOCK_ID"];
$OFFERS_IBLOCK_ID = $arOffers["OFFERS_IBLOCK_ID"];
$OFFERS_PROPERTY_ID = $arOffers["OFFERS_PROPERTY_ID"];
}
}
if ($ELEMENT_ID) {
static $arPropCache = array();
if (!array_key_exists($IBLOCK_ID, $arPropCache)) {
//Check for MINIMAL_PRICE property
$rsProperty = CIBlockProperty::GetByID("MINIMUM_PRICE", $IBLOCK_ID);
$arProperty = $rsProperty->Fetch();
if ($arProperty) {
$arPropCache[$IBLOCK_ID] = $arProperty["ID"];
} else {
$arPropCache[$IBLOCK_ID] = false;
}
}
if ($arPropCache[$IBLOCK_ID]) {
//Compose elements filter
if ($OFFERS_IBLOCK_ID) {
$rsOffers = CIBlockElement::GetList(array(), array("IBLOCK_ID" => $OFFERS_IBLOCK_ID, "PROPERTY_" . $OFFERS_PROPERTY_ID => $ELEMENT_ID), false, false, array("ID"));
while ($arOffer = $rsOffers->Fetch()) {
$arProductID[] = $arOffer["ID"];
}
if (!is_array($arProductID)) {
$arProductID = array($ELEMENT_ID);
}
} else {
$arProductID = array($ELEMENT_ID);
}
$minPrice = false;
$maxPrice = false;
//Get prices
$rsPrices = CPrice::GetList(array(), array("PRODUCT_ID" => $arProductID));
while ($arPrice = $rsPrices->Fetch()) {
if (CModule::IncludeModule('currency') && $strDefaultCurrency != $arPrice['CURRENCY']) {
$arPrice["PRICE"] = CCurrencyRates::ConvertCurrency($arPrice["PRICE"], $arPrice["CURRENCY"], $strDefaultCurrency);
}
$PRICE = $arPrice["PRICE"];
if ($minPrice === false || $minPrice > $PRICE) {
$minPrice = $PRICE;
}
if ($maxPrice === false || $maxPrice < $PRICE) {
$maxPrice = $PRICE;
}
}
//Save found minimal price into property
if ($minPrice !== false) {
CIBlockElement::SetPropertyValuesEx($ELEMENT_ID, $IBLOCK_ID, array("MINIMUM_PRICE" => $minPrice, "MAXIMUM_PRICE" => $maxPrice));
}
}
}
}
示例11: GetLiveFeedData
function GetLiveFeedData($site_id = "", $lang = "en")
{
global $MESS;
if (($r = CSaleWS::CheckAuth()) !== False) {
return $r;
}
$saleRight = $GLOBALS["APPLICATION"]->GetGroupRight("sale");
CComponentUtil::__IncludeLang("/bitrix/components/bitrix/webservice.sale/", "/component_1.php", $lang);
$arFilter = array();
$server_name = COption::GetOptionString("main", "server_name", $GLOBALS["SERVER_NAME"]);
$protocol = CMain::IsHTTPS() ? "https" : "http";
if (strlen($site_id) > 0) {
$rsSites = CSite::GetByID($arFields["SITE_ID"]);
if ($arSite = $rsSites->Fetch()) {
$arFilterLID = array("LID" => $site_id);
if (strlen($arSite["SERVER_NAME"]) > 0) {
$server_name = $arSite["SERVER_NAME"];
}
}
$strSiteCurrency = CSaleLang::GetLangCurrency($site_id);
} else {
$arFilterLID = array();
$strSiteCurrency = CCurrency::GetBaseCurrency();
}
if ($saleRight != "W") {
$arFilterPerms = array("STATUS_PERMS_GROUP_ID" => $GLOBALS["USER"]->GetUserGroupArray(), ">=STATUS_PERMS_PERM_VIEW" => "Y");
} else {
$arFilterPerms = array();
}
$d = date("w");
if ($d < 1) {
$d = -6;
} elseif ($d > 1) {
$d = $d - 1;
} else {
$d = 0;
}
$BeforeLastWeek_minDate = ConvertTimeStamp(AddToTimeStamp(array("DD" => "-" . (14 + $d)), mktime(0, 0, 0, date("n"), date("j"), date("Y"))), "FULL");
$BeforeLastWeek_maxDate = ConvertTimeStamp(AddToTimeStamp(array("DD" => "-" . (7 + $d), "SS" => -1), mktime(0, 0, 0, date("n"), date("j"), date("Y"))), "FULL");
$LastWeek_minDate = ConvertTimeStamp(AddToTimeStamp(array("DD" => "-" . (7 + $d)), mktime(0, 0, 0, date("n"), date("j"), date("Y"))), "FULL");
$LastWeek_maxDate = ConvertTimeStamp(AddToTimeStamp(array("DD" => "-" . $d, "SS" => -1), mktime(0, 0, 0, date("n"), date("j"), date("Y"))), "FULL");
$ThisWeek_minDate = ConvertTimeStamp(AddToTimeStamp(array("DD" => "-" . $d), mktime(0, 0, 0, date("n"), date("j"), date("Y"))), "FULL");
$ThisWeek_maxDate = ConvertTimeStamp(mktime(0, 0, 0, date("n"), date("j") + 1, date("Y")), "FULL");
$BeforeYesterday_minDate = ConvertTimeStamp(AddToTimeStamp(array("DD" => "-2"), mktime(0, 0, 0, date("n"), date("j"), date("Y"))), "FULL");
$BeforeYesterday_maxDate = ConvertTimeStamp(AddToTimeStamp(array("DD" => "-1", "SS" => -1), mktime(0, 0, 0, date("n"), date("j"), date("Y"))), "FULL");
$Yesterday_minDate = ConvertTimeStamp(AddToTimeStamp(array("DD" => "-1"), mktime(0, 0, 0, date("n"), date("j"), date("Y"))), "FULL");
$Yesterday_maxDate = ConvertTimeStamp(AddToTimeStamp(array("SS" => -1), mktime(0, 0, 0, date("n"), date("j"), date("Y"))), "FULL");
$Today_minDate = ConvertTimeStamp(mktime(0, 0, 0, date("n"), date("j"), date("Y")), "FULL");
$Today_maxDate = ConvertTimeStamp(mktime(0, 0, 0, date("n"), date("j") + 1, date("Y")), "FULL");
$arDatePeriods = array("BEFORE_LAST_WEEK" => array("MIN_DATE" => $BeforeLastWeek_minDate, "MAX_DATE" => $BeforeLastWeek_maxDate), "LAST_WEEK" => array("MIN_DATE" => $LastWeek_minDate, "MAX_DATE" => $LastWeek_maxDate), "THIS_WEEK" => array("MIN_DATE" => $ThisWeek_minDate, "MAX_DATE" => $ThisWeek_maxDate), "BEFORE_YESTERDAY" => array("MIN_DATE" => $BeforeYesterday_minDate, "MAX_DATE" => $BeforeYesterday_maxDate), "YESTERDAY" => array("MIN_DATE" => $Yesterday_minDate, "MAX_DATE" => $Yesterday_maxDate), "TODAY" => array("MIN_DATE" => $Today_minDate, "MAX_DATE" => $Today_maxDate));
$arStatus1 = array("CREATED" => array("NAME" => GetMessage("BX_WS_SALE_STATUS_1_CREATED"), "DB_FIELD" => "DATE"), "PAID" => array("NAME" => GetMessage("BX_WS_SALE_STATUS_1_PAID"), "DB_FIELD" => "DATE_PAYED"), "CANCELED" => array("NAME" => GetMessage("BX_WS_SALE_STATUS_1_CANCELED"), "DB_FIELD" => "DATE_UPDATE", "Y_FIELD" => "CANCELED"), "ALLOW_DELIVERY" => array("NAME" => GetMessage("BX_WS_SALE_STATUS_1_ALLOW_DELIVERY"), "DB_FIELD" => "DATE_UPDATE", "Y_FIELD" => "ALLOW_DELIVERY"));
foreach ($arDatePeriods as $key => $arPeriod) {
foreach ($arStatus1 as $status_code => $arStatus) {
$arOrderStats[$key][$status_code] = 0;
$arOrderStats[$key]["PRICE_" . $status_code] = 0;
}
foreach ($arStatus1 as $status_code => $arStatus) {
if (!is_array($arGadgetParams["ORDERS_STATUS_1"]) || in_array($status_code, $arGadgetParams["ORDERS_STATUS_1"])) {
if (array_key_exists("Y_FIELD", $arStatus) && strlen($arStatus["Y_FIELD"]) > 0) {
$arFilterYField = array($arStatus["Y_FIELD"] => "Y");
} else {
$arFilterYField = array();
}
$arFilter = array_merge(array($arStatus["DB_FIELD"] . "_FROM" => $arPeriod["MIN_DATE"], $arStatus["DB_FIELD"] . "_TO" => $arPeriod["MAX_DATE"]), $arFilterLID, $arFilterPerms, $arFilterYField);
$dbOrder = CSaleOrder::GetList(array(), $arFilter, array("SUM" => "PRICE", "COUNT" => "ID"));
if ($arOrder = $dbOrder->Fetch()) {
$arOrderStats[$key][$status_code] = $arOrder["ID"];
$arOrderStats[$key]["PRICE_" . $status_code] = $arOrder["PRICE"];
}
}
}
}
$strSaleStat = '<table border="0">';
$strSaleStat .= '<tr><td> </td>';
foreach ($arStatus1 as $status_code => $arStatus) {
$strSaleStat .= '<td><b>' . $arStatus["NAME"] . '</b></td>';
}
$strSaleStat .= '</tr>';
$strSaleStat .= '<tr><td>' . GetMessage("BX_WS_SALE_TODAY") . '</td>';
foreach ($arStatus1 as $status_code => $arStatus) {
$strSaleStat .= '<td align="center">' . intval($arOrderStats["TODAY"][$status_code]) . '</td>';
}
$strSaleStat .= '</tr>';
$strSaleStat .= '<tr><td>' . GetMessage("BX_WS_SALE_YESTERDAY") . '</td>';
foreach ($arStatus1 as $status_code => $arStatus) {
$strSaleStat .= '<td align="center">' . intval($arOrderStats["YESTERDAY"][$status_code]) . '</td>';
}
$strSaleStat .= '</tr>';
$strSaleStat .= '<tr><td>' . GetMessage("BX_WS_SALE_BEFOREYESTERDAY") . '</td>';
foreach ($arStatus1 as $status_code => $arStatus) {
$strSaleStat .= '<td align="center">' . intval($arOrderStats["BEFORE_YESTERDAY"][$status_code]) . '</td>';
}
$strSaleStat .= '</tr>';
$strSaleStat .= '<tr><td>' . GetMessage("BX_WS_SALE_THISWEEK") . '</td>';
foreach ($arStatus1 as $status_code => $arStatus) {
$strSaleStat .= '<td align="center">' . intval($arOrderStats["THIS_WEEK"][$status_code]) . '</td>';
}
$strSaleStat .= '</tr>';
$strSaleStat .= '<tr><td>' . GetMessage("BX_WS_SALE_LASTWEEK") . '</td>';
foreach ($arStatus1 as $status_code => $arStatus) {
//.........这里部分代码省略.........
示例12: intval
}
$arParams["CACHE_TIME"] = intval($arParams["CACHE_TIME"]);
if ($this->StartResultCache()) {
if (!CModule::IncludeModule("currency")) {
$this->AbortResultCache();
ShowError(GetMessage("CURRENCY_MODULE_NOT_INSTALLED"));
return;
}
global $CACHE_MANAGER;
$arResult = array();
$arResult["CURRENCY"] = array();
if ('' == $arParams["CURRENCY_BASE"]) {
$arParams["CURRENCY_BASE"] = COption::GetOptionString("sale", "default_currency");
}
if ('' == $arParams["CURRENCY_BASE"]) {
$arParams["CURRENCY_BASE"] = CCurrency::GetBaseCurrency();
}
if ('' == $arParams["CURRENCY_BASE"]) {
$dbCurrency = CCurrency::GetList($by = "SORT", $order = "ASC");
$arCurrency = $dbCurrency->Fetch();
$arParams["CURRENCY_BASE"] = $arCurrency["CURRENCY"];
}
if ('' != $arParams["CURRENCY_BASE"]) {
if ('' == $arParams["RATE_DAY"]) {
$arResult["RATE_DAY_TIMESTAMP"] = time();
$arResult["RATE_DAY_SHOW"] = ConvertTimeStamp($arResult["RATE_DAY_TIMESTAMP"], 'SHORT');
} else {
$arRATE_DAY_PARSED = ParseDateTime($arParams["RATE_DAY"], "YYYY-MM-DD");
$arRATE_DAY_PARSED['YYYY'] = intval($arRATE_DAY_PARSED['YYYY']);
if (1901 > $arRATE_DAY_PARSED["YYYY"] || 2038 < $arRATE_DAY_PARSED["YYYY"]) {
$arResult["RATE_DAY_TIMESTAMP"] = time();
示例13: array
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
$arPrice = array();
if (CModule::IncludeModule("catalog")) {
$rsPrice = CCatalogGroup::GetList($v1 = "sort", $v2 = "asc");
while ($arr = $rsPrice->Fetch()) {
$arPrice[$arr["NAME"]] = "[" . $arr["NAME"] . "] " . $arr["NAME_LANG"];
}
}
$arTemplateParameters = array("SHOW_INPUT" => array("NAME" => GetMessage("TP_BST_SHOW_INPUT"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y", "REFRESH" => "Y"), "INPUT_ID" => array("NAME" => GetMessage("TP_BST_INPUT_ID"), "TYPE" => "STRING", "DEFAULT" => "title-search-input"), "CONTAINER_ID" => array("NAME" => GetMessage("TP_BST_CONTAINER_ID"), "TYPE" => "STRING", "DEFAULT" => "title-search"), "PRICE_CODE" => array("PARENT" => "PRICES", "NAME" => GetMessage("TP_BST_PRICE_CODE"), "TYPE" => "LIST", "MULTIPLE" => "Y", "VALUES" => $arPrice), "PREVIEW_TRUNCATE_LEN" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("TP_BST_PREVIEW_TRUNCATE_LEN"), "TYPE" => "STRING", "DEFAULT" => ""), "SHOW_PREVIEW" => array("NAME" => GetMessage("TP_BST_SHOW_PREVIEW"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y", "REFRESH" => "Y"));
if (isset($arCurrentValues['SHOW_PREVIEW']) && 'Y' == $arCurrentValues['SHOW_PREVIEW']) {
$arTemplateParameters["PREVIEW_WIDTH"] = array("NAME" => GetMessage("TP_BST_PREVIEW_WIDTH"), "TYPE" => "STRING", "DEFAULT" => 75);
$arTemplateParameters["PREVIEW_HEIGHT"] = array("NAME" => GetMessage("TP_BST_PREVIEW_HEIGHT"), "TYPE" => "STRING", "DEFAULT" => 75);
}
if (CModule::IncludeModule('catalog') && CModule::IncludeModule('currency')) {
$arTemplateParameters['CONVERT_CURRENCY'] = array('PARENT' => 'PRICES', 'NAME' => GetMessage('TP_BST_CONVERT_CURRENCY'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N', 'REFRESH' => 'Y');
if (isset($arCurrentValues['CONVERT_CURRENCY']) && 'Y' == $arCurrentValues['CONVERT_CURRENCY']) {
$arCurrencyList = array();
$rsCurrencies = CCurrency::GetList($by = 'SORT', $order = 'ASC');
while ($arCurrency = $rsCurrencies->Fetch()) {
$arCurrencyList[$arCurrency['CURRENCY']] = $arCurrency['CURRENCY'];
}
$arTemplateParameters['CURRENCY_ID'] = array('PARENT' => 'PRICES', 'NAME' => GetMessage('TP_BST_CURRENCY_ID'), 'TYPE' => 'LIST', 'VALUES' => $arCurrencyList, 'DEFAULT' => CCurrency::GetBaseCurrency(), "ADDITIONAL_VALUES" => "Y");
}
}
示例14: array
}
$arUsersGroups = array();
$dbGroups = CGroup::GetList($b = "c_sort", $o = "asc", array("ANONYMOUS" => "N"));
while ($arGroups = $dbGroups->Fetch()) {
$arUsersGroups[] = $arGroups;
}
$sTableID = "tbl_sale_buyers";
$oSort = new CAdminSorting($sTableID, "LAST_LOGIN", "desc");
$lAdmin = new CAdminList($sTableID, $oSort);
$arFilterFields = array("filter_universal", "filter_ID", "filter_login", "filter_mail", "filter_phone", "filter_lid", "find_last_login_1", "filter_mobile", "filter_dateauth", "filter_group", "find_last_login_2", "filter_price_all_from", "filter_price_all_to", "filter_quantity_all_from", "filter_quantity_all_to");
$lAdmin->InitFilter($arFilterFields);
/* COLLECTION FILTER */
$arFilter = array();
if (!isset($filter_currency) || $filter_currency == "") {
if (CModule::IncludeModule("currency")) {
$arFilter["CURRENCY"] = CCurrency::GetBaseCurrency();
$filter_currency = $arFilter["CURRENCY"];
}
} else {
$arFilter["CURRENCY"] = $filter_currency;
}
if (!isset($filter_lid) || $filter_lid == "") {
$rsSites = CSite::GetList($by2 = "SORT", $order2 = "ASC", array("ACTIVE" => "Y"));
$arSite = $rsSites->Fetch();
$arFilter["LID"] = $arSite["ID"];
$filter_lid = $arFilter["LID"];
} else {
$arFilter["LID"] = $filter_lid;
}
if (isset($filter_login)) {
$arFilter["LOGIN"] = trim($filter_login);
示例15: array
@fwrite($fp, "<name>".$APPLICATION->ConvertCharset(htmlspecialcharsbx(COption::GetOptionString("main", "site_name", "")), LANG_CHARSET, 'windows-1251')."</name>\n");
@fwrite($fp, "<company>".$APPLICATION->ConvertCharset(htmlspecialcharsbx(COption::GetOptionString("main", "site_name", "")), LANG_CHARSET, 'windows-1251')."</company>\n");
@fwrite($fp, "<url>http://".htmlspecialcharsbx($ar_iblock['SERVER_NAME'])."</url>\n");
$strTmp = "<currencies>\n";
if ($arCurrency = CCurrency::GetByID('RUR'))
$RUR = 'RUR';
else
$RUR = 'RUB';
$arCurrencyAllowed = array($RUR, 'USD', 'EUR', 'UAH', 'BYR', 'KZT');
$BASE_CURRENCY = CCurrency::GetBaseCurrency();
if (is_array($XML_DATA['CURRENCY']))
{
foreach ($XML_DATA['CURRENCY'] as $CURRENCY => $arCurData)
{
if (in_array($CURRENCY, $arCurrencyAllowed))
{
$strTmp.= "<currency id=\"".$CURRENCY."\""
." rate=\"".($arCurData['rate'] == 'SITE' ? CCurrencyRates::ConvertCurrency(1, $CURRENCY, $RUR) : $arCurData['rate'])."\""
.($arCurData['plus'] > 0 ? ' plus="'.intval($arCurData['plus']).'"' : '')
." />\n";
}
}
}
else
{