本文整理汇总了PHP中CCurrency::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP CCurrency::getList方法的具体用法?PHP CCurrency::getList怎么用?PHP CCurrency::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCurrency
的用法示例。
在下文中一共展示了CCurrency::getList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getReferences
/**
* Get common data from cache.
* @return mixed[]
*/
protected function getReferences()
{
global $USER;
$this->arParams['CACHE_GROUPS'] = isset($this->arParams['CACHE_GROUPS']) && $this->arParams['CACHE_GROUPS'] == 'N' ? 'N' : 'Y';
$obCache = new CPHPCache();
if ($this->arParams['CACHE_GROUPS'] == 'Y') {
$cacheId = implode("-", array(__CLASS__, LANGUAGE_ID, SITE_ID, $USER->GetGroups()));
} else {
$cacheId = implode("-", array(__CLASS__, LANGUAGE_ID, SITE_ID));
}
$cached = array();
if ($obCache->StartDataCache($this->arParams["CACHE_TIME"], $cacheId, SITE_ID . '/' . $this->getRelativePath() . '/reference')) {
// Catalog Groups
$cached['CATALOG_GROUP'] = array();
$catalogGroupIterator = CCatalogGroup::GetList(array("SORT" => "ASC"));
while ($catalogGroup = $catalogGroupIterator->fetch()) {
$cached['CATALOG_GROUP'][$catalogGroup['NAME']] = $catalogGroup;
}
// Catalog Prices
$cached['CATALOG_PRICE'] = CIBlockPriceTools::GetCatalogPrices(false, array_keys($cached['CATALOG_GROUP']));
// Catalog Currency
$cached['CURRENCY'] = array();
if ($this->isCurrency) {
$by = "currency";
$order = "asc";
$currencyIterator = CCurrency::getList($by, $order);
while ($currency = $currencyIterator->fetch()) {
$cached['CURRENCY'][$currency['CURRENCY']] = $currency;
}
}
// Catalogs list
$cached['CATALOG'] = array();
$catalogIterator = CCatalog::getList(array("IBLOCK_ID" => "ASC"));
while ($catalog = $catalogIterator->fetch()) {
$info = CCatalogSku::getInfoByIblock($catalog['IBLOCK_ID']);
$catalog['CATALOG_TYPE'] = $info['CATALOG_TYPE'];
$cached['CATALOG'][$catalog['IBLOCK_ID']] = $catalog;
}
// Measure list
$cached['MEASURE'] = array();
$measureIterator = CCatalogMeasure::getList(array("CODE" => "ASC"));
while ($measure = $measureIterator->fetch()) {
$cached['MEASURE'][$measure['ID']] = $measure;
}
// Default Measure
$cached['DEFAULT_MEASURE'] = CCatalogMeasure::getDefaultMeasure(true, true);
$obCache->EndDataCache($cached);
} else {
$cached = $obCache->GetVars();
}
return $cached;
}
示例2: getReferences
/**
* Get common data from cache.
* @return mixed[]
*/
protected function getReferences()
{
$this->arParams['CACHE_GROUPS'] = isset($this->arParams['CACHE_GROUPS']) && $this->arParams['CACHE_GROUPS'] == 'N' ? 'N' : 'Y';
$obCache = new CPHPCache();
if ($this->arParams['CACHE_GROUPS'] == 'Y') {
$userGroups = implode(",", Main\UserTable::getUserGroupIds($this->getUserId()));
$cacheId = implode("-", array(__CLASS__, $this->getLanguageId(), $this->getSiteId(), $userGroups));
} else {
$cacheId = implode("-", array(__CLASS__, $this->getLanguageId(), $this->getSiteId()));
}
$cached = array();
if ($obCache->StartDataCache($this->arParams["CACHE_TIME"], $cacheId, $this->getSiteId() . '/' . $this->getRelativePath() . '/reference')) {
// Catalog Groups
$cached['CATALOG_GROUP'] = array();
$catalogGroupIterator = CCatalogGroup::GetList(array("SORT" => "ASC"));
while ($catalogGroup = $catalogGroupIterator->fetch()) {
$cached['CATALOG_GROUP'][$catalogGroup['NAME']] = $catalogGroup;
}
// Catalog Prices
$cached['CATALOG_PRICE'] = CIBlockPriceTools::GetCatalogPrices(false, array_keys($cached['CATALOG_GROUP']));
// Catalog Currency
$cached['CURRENCY'] = array();
if ($this->isCurrency) {
$by = "currency";
$order = "asc";
$currencyIterator = CCurrency::getList($by, $order);
while ($currency = $currencyIterator->fetch()) {
$cached['CURRENCY'][$currency['CURRENCY']] = $currency;
}
}
// Catalogs list
$cached['CATALOG'] = array();
$catalogIterator = CCatalog::getList(array("IBLOCK_ID" => "ASC"));
while ($catalog = $catalogIterator->fetch()) {
$info = CCatalogSku::getInfoByIblock($catalog['IBLOCK_ID']);
$catalog['CATALOG_TYPE'] = $info['CATALOG_TYPE'];
$cached['CATALOG'][$catalog['IBLOCK_ID']] = $catalog;
}
// Measure list
$cached['MEASURE'] = array();
$measureIterator = CCatalogMeasure::getList(array("CODE" => "ASC"));
while ($measure = $measureIterator->fetch()) {
$cached['MEASURE'][$measure['ID']] = $measure;
}
// Default Measure
$cached['DEFAULT_MEASURE'] = CCatalogMeasure::getDefaultMeasure(true, true);
$additionalCache = $this->getAdditionalRefereneces();
if (!empty($additionalCache) && is_array($additionalCache)) {
foreach ($additionalCache as $cacheKey => $cacheData) {
$cached[$cacheKey] = $cacheData;
}
unset($cacheKey, $cacheData);
}
unset($additionalCache);
$obCache->EndDataCache($cached);
} else {
$cached = $obCache->GetVars();
}
return $cached;
}