本文整理汇总了PHP中CIBlockPriceTools::GetCatalogPrices方法的典型用法代码示例。如果您正苦于以下问题:PHP CIBlockPriceTools::GetCatalogPrices方法的具体用法?PHP CIBlockPriceTools::GetCatalogPrices怎么用?PHP CIBlockPriceTools::GetCatalogPrices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIBlockPriceTools
的用法示例。
在下文中一共展示了CIBlockPriceTools::GetCatalogPrices方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CTextParser
$arParams['CONVERT_CURRENCY'] = 'N';
$arParams['CURRENCY_ID'] = '';
} else {
$arCurrencyInfo = CCurrency::GetByID($arParams['CURRENCY_ID']);
if (!(is_array($arCurrencyInfo) && !empty($arCurrencyInfo))) {
$arParams['CONVERT_CURRENCY'] = 'N';
$arParams['CURRENCY_ID'] = '';
} else {
$arParams['CURRENCY_ID'] = $arCurrencyInfo['CURRENCY'];
$arConvertParams['CURRENCY_ID'] = $arCurrencyInfo['CURRENCY'];
}
}
}
$obParser = new CTextParser();
if (is_array($arParams["PRICE_CODE"])) {
$arResult["PRICES"] = CIBlockPriceTools::GetCatalogPrices(0, $arParams["PRICE_CODE"]);
} else {
$arResult["PRICES"] = array();
}
$arSelect = array("ID", "IBLOCK_ID", "PREVIEW_TEXT", "PREVIEW_PICTURE", "DETAIL_PICTURE");
$arFilter = array("IBLOCK_LID" => SITE_ID, "IBLOCK_ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "ACTIVE" => "Y", "CHECK_PERMISSIONS" => "Y", "MIN_PERMISSION" => "R");
foreach ($arResult["PRICES"] as $value) {
$arSelect[] = $value["SELECT"];
$arFilter["CATALOG_SHOP_QUANTITY_" . $value["ID"]] = 1;
}
$arFilter["=ID"] = $arResult["ELEMENTS"];
$rsElements = CIBlockElement::GetList(array(), $arFilter, false, false, $arSelect);
while ($arElement = $rsElements->Fetch()) {
$arElement["PRICES"] = CIBlockPriceTools::GetItemPrices($arElement["IBLOCK_ID"], $arResult["PRICES"], $arElement, $arParams['PRICE_VAT_INCLUDE'], $arConvertParams);
if ($arParams["PREVIEW_TRUNCATE_LEN"] > 0) {
$arElement["PREVIEW_TEXT"] = $obParser->html_cut($arElement["PREVIEW_TEXT"], $arParams["PREVIEW_TRUNCATE_LEN"]);
示例2: ShowError
/** @var array $arResult */
/** @var string $componentPath */
/** @var string $componentName */
/** @var string $componentTemplate */
/** @global CDatabase $DB */
/** @global CUser $USER */
/** @global CMain $APPLICATION */
if (!Loader::includeModule('iblock')) {
ShowError(GetMessage("CC_BCF_MODULE_NOT_INSTALLED"));
return;
}
$FILTER_NAME = (string) $arParams["FILTER_NAME"];
if ($this->StartResultCache(false, $arParams["CACHE_GROUPS"] ? $USER->GetGroups() : false)) {
$arResult["FACET_FILTER"] = false;
$arResult["COMBO"] = array();
$arResult["PRICES"] = CIBlockPriceTools::GetCatalogPrices($arParams["IBLOCK_ID"], $arParams["PRICE_CODE"]);
$arResult["ITEMS"] = $this->getResultItems();
$arResult["CURRENCIES"] = array();
$propertyEmptyValuesCombination = array();
foreach ($arResult["ITEMS"] as $PID => $arItem) {
$propertyEmptyValuesCombination[$arItem["ID"]] = array();
}
if (!empty($arResult["ITEMS"])) {
if ($this->facet->isValid()) {
$this->facet->setPrices($arResult["PRICES"]);
$this->facet->setSectionId($this->SECTION_ID);
$arResult["FACET_FILTER"] = array("ACTIVE_DATE" => "Y", "CHECK_PERMISSIONS" => "Y");
if ($this->arParams['HIDE_NOT_AVAILABLE'] == 'Y') {
$arResult["FACET_FILTER"]['CATALOG_AVAILABLE'] = 'Y';
}
$res = $this->facet->query($arResult["FACET_FILTER"]);
示例3: array
$arFilter += array("!PROPERTY_SALELEADER" => false);
$dbRes = CIBlockElement::GetList(array("PROPERTY_WEEK_COUNTER" => "desc"), $arFilter, false, array("nTopCount" => 3), $arSelect);
while ($obEl = $dbRes->GetNextElement()) {
$arFields = $obEl->GetFields();
if (!empty($arFields["IBLOCK_SECTION_ID"])) {
$arSec = $arSect;
}
$path = !empty($arFields['DETAIL_PICTURE']) ? $arFields['DETAIL_PICTURE'] : $arFields['PREVIEW_PICTURE'];
if (empty($path)) {
$arProp = CIBlockElement::GetProperty($arFields["IBLOCK_ID"], $arFields["ID"], array(), array('CODE' => 'MORE_PHOTO'))->Fetch();
$path = $arProp["VALUE"];
}
$path = CFile::ResizeImageGet($path, array('width' => 150, 'height' => 150), BX_RESIZE_IMAGE_PROPORTIONAL, false);
$path = $path['src'];
if (CModule::IncludeModule('catalog')) {
$arResultPrices = CIBlockPriceTools::GetCatalogPrices($arFields["IBLOCK_ID"], array($arParams["PRICE_CODE"]));
$arProduct = CCatalogProduct::GetByID($arFields["ID"]);
$arProduct['VAT_INCLUDED'] = $arProduct['VAT_INCLUDED'] == 'Y' ? true : false;
$arPrices = CIBlockPriceTools::GetItemPrices($arFields["IBLOCK_ID"], $arResultPrices, $arFields, $arProduct['VAT_INCLUDED'], array("CURRENCY_ID" => $arParams["CURRENCY"]));
}
$arHits[$index][] = array("NAME" => $arFields["NAME"], "SECTION" => $arSec["NAME"], "SECTION_PAGE_URL" => $arSec["SECTION_PAGE_URL"], "DETAIL_PAGE_URL" => $arFields["DETAIL_PAGE_URL"], "PHOTO" => $path, "PRICE" => $arPrices, "SALELEADER" => $arFields["PROPERTY_SALELEADER_VALUE"], "NEWPRODUCT" => $arFields["PROPERTY_NEWPRODUCT_VALUE"], "SPECIAL_OFFER" => $arFields["PROPERTY_SPECIAL_OFFER_VALUE"]);
}
// while( $obEl = $dbRes->GetNextElement() )
$arResult['HITS'][$index] = $arHits[$index];
}
// if($arParams["VIEW_HIT"] == "Y" && $arItem['DEPTH_LEVEL'] == 1)
}
// foreach($arResult as &$arItem => $index)
if ($obCache->StartDataCache($life_time, $cache_id, "/")) {
$obCache->EndDataCache(array("MENU_HITS" => $arHits));
}
示例4: while
while ($arOfferProperties = $dbOfferProperties->Fetch()) {
$arCacheOfferProperties[$arOffersIblock["OFFERS_IBLOCK_ID"]][] = $arOfferProperties["CODE"];
}
}
$arIblockOfferPropsFilter = $arCacheOfferProperties[$arOffersIblock["OFFERS_IBLOCK_ID"]];
$arIblockOfferProps = array();
$arIblockOfferPropsFilter = array();
foreach ($arIblockOfferPropsFilter as $val) {
$arIblockOfferProps[] = array("CODE" => $val["CODE"], "NAME" => $val["NAME"]);
$arIblockOfferPropsFilter[] = $val["CODE"];
}
static $arCacheResultPrices = array();
if (!is_set($arCacheResultPrices[$arElements["IBLOCK_ID"]])) {
$dbPriceType = CCatalogGroup::GetList(array(), array('NAME_LANG' => $arItems['NOTES'], 'CAN_BUY' => 'Y'), false, false, array('NAME', 'ID'));
$arPriceType = $dbPriceType->Fetch();
$arResultPrices = CIBlockPriceTools::GetCatalogPrices($arElements["IBLOCK_ID"], array($arPriceType["NAME"]));
$arCacheResultPrices[$arElements["IBLOCK_ID"]] = $arResultPrices;
} else {
$arResultPrices = $arCacheResultPrices[$arElements["IBLOCK_ID"]];
}
$arOffers = CIBlockPriceTools::GetOffersArray($arElements["IBLOCK_ID"], $arItems["PRODUCT_ID"], array("ID" => "DESC"), array("NAME"), $arIblockOfferPropsFilter, 0, $arResultPrices, 1, array(), $USER->GetID(), $arItems['LID']);
if (count($arOffers) > 0) {
foreach ($arOffers as $arOffer) {
/*$arPrice = CCatalogProduct::GetOptimalPrice($arOffer['ID'], 1, $arGroups, "N", array(), $arItems['LID']);
$arOffer["PRICES"] = $arPrice;
if ($arCatalogProduct = CCatalogProduct::GetByID($arOffer['ID']))
{
if ($arCatalogProduct["CAN_BUY_ZERO"]!="Y" && ($arCatalogProduct["QUANTITY_TRACE"]=="Y" && doubleval($arCatalogProduct["QUANTITY"])<=0))
$arItems["CAN_BUY"] = "N";
else
示例5: 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;
}
示例6: array
$arCompare = array();
if (isset($_SESSION[$arParams["NAME"]][$arParams["IBLOCK_ID"]]["ITEMS"])) {
$arCompare = $_SESSION[$arParams["NAME"]][$arParams["IBLOCK_ID"]]["ITEMS"];
}
if (!empty($arCompare) && is_array($arCompare)) {
$fieldsRequired = array('NAME' => true);
$fieldsHidden = array('IBLOCK_TYPE_ID' => true, 'IBLOCK_CODE' => true, 'IBLOCK_NAME' => true, 'IBLOCK_EXTERNAL_ID' => true, 'SECTION_ID' => true, 'IBLOCK_SECTION_ID' => true);
$sessionFields = array('DELETE_FIELD', 'DELETE_PROP', 'DELETE_OFFER_FIELD', 'DELETE_OFFER_PROP');
foreach ($sessionFields as &$fieldName) {
if (!isset($_SESSION[$arParams['NAME']][$arParams['IBLOCK_ID']][$fieldName]) || !is_array($_SESSION[$arParams['NAME']][$arParams['IBLOCK_ID']][$fieldName])) {
$_SESSION[$arParams['NAME']][$arParams['IBLOCK_ID']][$fieldName] = array();
}
}
unset($fieldName, $sessionFields);
$catalogIncluded = Loader::includeModule('catalog');
$arResult['PRICES'] = CIBlockPriceTools::GetCatalogPrices($arParams['IBLOCK_ID'], $arParams['PRICE_CODE']);
$arResult['PRICES_ALLOW'] = CIBlockPriceTools::GetAllowCatalogPrices($arResult['PRICES']);
$arConvertParams = array();
if ($arParams['CONVERT_CURRENCY'] == 'Y') {
if (!Loader::includeModule('currency')) {
$arParams['CONVERT_CURRENCY'] = 'N';
$arParams['CURRENCY_ID'] = '';
} else {
$currencyIterator = CurrencyTable::getList(array('select' => array('CURRENCY'), 'filter' => array('=CURRENCY' => $arParams['CURRENCY_ID'])));
if ($currency = $currencyIterator->fetch()) {
$arParams['CURRENCY_ID'] = $currency['CURRENCY'];
$arConvertParams['CURRENCY_ID'] = $currency['CURRENCY'];
} else {
$arParams['CONVERT_CURRENCY'] = 'N';
$arParams['CURRENCY_ID'] = '';
}
示例7: 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;
}
示例8: bx_format_price
public static function bx_format_price($price_codes, $arItem)
{
$arCatalogPrices = \CIBlockPriceTools::GetCatalogPrices($arItem['IBLOCK_ID'], $price_codes);
return \CIBlockPriceTools::GetItemPrices($arItem['IBLOCK_ID'], $arCatalogPrices, $arItem);
}
示例9: array
static $arCacheOfferProperties = array();
if (!isset($arCacheOfferProperties[$arOffersIblock["OFFERS_IBLOCK_ID"]])) {
$dbOfferProperties = CIBlock::GetProperties($arOffersIblock["OFFERS_IBLOCK_ID"], array(), array("!XML_ID" => "CML2_LINK"));
while ($arOfferProperties = $dbOfferProperties->Fetch()) {
$arCacheOfferProperties[$arOffersIblock["OFFERS_IBLOCK_ID"]][] = $arOfferProperties["CODE"];
}
}
$arIblockOfferPropsFilter = $arCacheOfferProperties[$arOffersIblock["OFFERS_IBLOCK_ID"]];
static $arCacheResultPrices = array();
if (empty($arCacheResultPrices)) {
$arPriceTypeList = array();
$dbPriceType = CCatalogGroup::GetList(array(), array('CAN_BUY' => 'Y'), false, false, array('NAME', 'ID'));
while ($arPriceType = $dbPriceType->Fetch()) {
$arPriceTypeList[] = $arPriceType["NAME"];
}
$arResultPrices = CIBlockPriceTools::GetCatalogPrices($arElements["IBLOCK_ID"], $arPriceTypeList);
$arCacheResultPrices = $arResultPrices;
} else {
$arResultPrices = $arCacheResultPrices;
}
$arOffers = CIBlockPriceTools::GetOffersArray($arElements["IBLOCK_ID"], $arItems["PRODUCT_ID"], array("ID" => "DESC"), array("NAME"), $arIblockOfferPropsFilter, 0, $arResultPrices, true);
if (!empty($arOffers) && is_array($arOffers)) {
$result = false;
$minPrice = 0;
$urlAdd2Basket = '';
$urlBuy = '';
foreach ($arOffers as $oneOffer) {
if ($oneOffer['LINK_ELEMENT_ID'] != $arItems['PRODUCT_ID']) {
continue;
}
if (!$oneOffer['CAN_BUY']) {