本文整理汇总了PHP中CCatalog::getList方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalog::getList方法的具体用法?PHP CCatalog::getList怎么用?PHP CCatalog::getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalog
的用法示例。
在下文中一共展示了CCatalog::getList方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onPrepareComponentParams
/**
* @param $params
* @override
* @return array
*/
public function onPrepareComponentParams($params)
{
if (Loader::includeModule("catalog")) {
$catalogIterator = CCatalog::getList(array("IBLOCK_ID" => "ASC"));
while ($row = $catalogIterator->fetch()) {
$params['SHOW_PRODUCTS_' . $row['IBLOCK_ID']] = true;
}
}
$params = parent::onPrepareComponentParams($params);
if (!isset($params["CACHE_TIME"])) {
$params["CACHE_TIME"] = 86400;
}
$params["DETAIL_URL"] = trim($params["DETAIL_URL"]);
$params["MIN_BUYES"] = IntVal($params["MIN_BUYES"]);
if ($params["MIN_BUYES"] <= 0) {
$params["MIN_BUYES"] = 2;
}
if (isset($params['ID'])) {
$params['ID'] = (int) $params["ID"];
} else {
$params['ID'] = -1;
}
if (isset($params['CODE'])) {
$params['CODE'] = trim($params['CODE']);
} else {
$params['CODE'] = '';
}
if (isset($params['IBLOCK_ID'])) {
$params['IBLOCK_ID'] = (int) $params['IBLOCK_ID'];
} else {
$params['IBLOCK_ID'] = -1;
}
$params['ID'] = CIBlockFindTools::getElementID($params["ID"], $params["CODE"], false, false, array("IBLOCK_ID" => $params["IBLOCK_ID"], "IBLOCK_LID" => SITE_ID, "IBLOCK_ACTIVE" => "Y", "ACTIVE_DATE" => "Y", "CHECK_PERMISSIONS" => "Y"));
if ($params["ID"] <= 0) {
$this->errors[] = Loc::getMessage("SRP_PRODUCT_ID_REQUIRED");
}
return $params;
}
示例2: onBeforeIndex
/**
* @param array $fields Item fields.
* @return array
*/
public function onBeforeIndex($fields)
{
if ($fields["MODULE_ID"] == "iblock") {
$catalogs = \CCatalog::getList(array(), array('IBLOCK_ID' => $fields['PARAM2']), false, false, array('IBLOCK_ID'));
if ($catalogs->fetch()) {
$fields["PARAMS"]["iblock_section"] = array();
if (strpos($fields['ITEM_ID'], 'S') === false) {
$sections = \CIBlockElement::getElementGroups($fields["ITEM_ID"], true, array('ID'));
while ($section = $sections->fetch()) {
$nav = \CIBlockSection::getNavChain($fields['PARAM2'], $section["ID"], array('ID'));
while ($chain = $nav->fetch()) {
$fields["PARAMS"]["iblock_section"][] = $chain['ID'];
}
}
} else {
$nav = \CIBlockSection::getNavChain($fields['PARAM2'], preg_replace('#[^0-9]+#', '', $fields["ITEM_ID"]), array('ID'));
while ($chain = $nav->fetch()) {
$fields["PARAMS"]["iblock_section"][] = $chain['ID'];
}
}
}
}
return $fields;
}
示例3: array
$iblockIterator = CIBlock::GetList(array("SORT" => "ASC"), array("TYPE" => $arCurrentValues["IBLOCK_TYPE"] != "-" ? $arCurrentValues["IBLOCK_TYPE"] : ""));
while ($iblock = $iblockIterator->fetch()) {
$iblockNames[$iblock['ID']] = "[{$iblock['CODE']}] {$iblock['NAME']}";
}
$arAscDesc = array("asc" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_SORT_ASC"), "desc" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_SORT_DESC"));
$arComponentParameters = array("GROUPS" => array("PRICES" => array("NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_PRICES")), "BASKET" => array("NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_BASKET"))), "PARAMETERS" => array("IBLOCK_TYPE" => array("PARENT" => "BASE", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_TYPE"), "TYPE" => "LIST", "VALUES" => $iblockTypes, "DEFAULT" => "catalog", "REFRESH" => "Y"), "IBLOCK_ID" => array("PARENT" => "BASE", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_IBLOCK_ID"), "TYPE" => "LIST", "VALUES" => $iblockNames, "DEFAULT" => '={$_REQUEST["IBLOCK_ID"]}', "ADDITIONAL_VALUES" => "Y", "REFRESH" => "Y"), "ID" => array("PARENT" => "BASE", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_ID"), "TYPE" => "STRING", "DEFAULT" => '={$_REQUEST["PRODUCT_ID"]}'), "CODE" => array("PARENT" => "BASE", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_CODE"), "TYPE" => "STRING", "DEFAULT" => '={$_REQUEST["PRODUCT_CODE"]}'), "PROPERTY_LINK" => array("PARENT" => "BASE", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_PROP_LIST"), "TYPE" => "STRING", "DEFAULT" => "RECOMMEND"), "OFFERS_PROPERTY_LINK" => array("PARENT" => "BASE", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_OFFERS_PROP_LIST"), "TYPE" => "STRING", "DEFAULT" => "RECOMMEND"), "CACHE_TIME" => array("DEFAULT" => 86400), "DETAIL_URL" => CIBlockParameters::GetPathTemplateParam("DETAIL", "DETAIL_URL", GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_DETAIL_URL"), "", "URL_TEMPLATES"), "BASKET_URL" => array("PARENT" => "BASKET", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_BASKET_URL"), "TYPE" => "STRING", "DEFAULT" => "/personal/basket.php"), "ACTION_VARIABLE" => array("PARENT" => "BASKET", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_ACTION_VARIABLE"), "TYPE" => "STRING", "DEFAULT" => "action"), "PRODUCT_ID_VARIABLE" => array("PARENT" => "BASKET", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_PRODUCT_ID_VARIABLE"), "TYPE" => "STRING", "DEFAULT" => "id"), "PRODUCT_QUANTITY_VARIABLE" => array("PARENT" => "BASKET", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_PRODUCT_QUANTITY_VARIABLE"), "TYPE" => "STRING", "DEFAULT" => "quantity"), "ADD_PROPERTIES_TO_BASKET" => array("PARENT" => "BASKET", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_ADD_PROPERTIES_TO_BASKET"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y", "REFRESH" => "Y"), "PRODUCT_PROPS_VARIABLE" => array("PARENT" => "BASKET", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_PRODUCT_PROPS_VARIABLE"), "TYPE" => "STRING", "DEFAULT" => "prop", "HIDDEN" => isset($arCurrentValues['ADD_PROPERTIES_TO_BASKET']) && $arCurrentValues['ADD_PROPERTIES_TO_BASKET'] == 'N' ? 'Y' : 'N'), "PARTIAL_PRODUCT_PROPERTIES" => array("PARENT" => "BASKET", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_PARTIAL_PRODUCT_PROPERTIES"), "TYPE" => "CHECKBOX", "DEFAULT" => "N", "HIDDEN" => isset($arCurrentValues['ADD_PROPERTIES_TO_BASKET']) && $arCurrentValues['ADD_PROPERTIES_TO_BASKET'] == 'N' ? 'Y' : 'N'), "SHOW_OLD_PRICE" => array("PARENT" => "PRICES", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_SHOW_OLD_PRICE"), "TYPE" => "CHECKBOX", "VALUES" => "N"), 'SHOW_DISCOUNT_PERCENT' => array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_SHOW_DISCOUNT_PERCENT'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N'), "PRICE_CODE" => array("PARENT" => "PRICES", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_PRICE_CODE"), "TYPE" => "LIST", "MULTIPLE" => "Y", "VALUES" => $catalogGroups), "SHOW_PRICE_COUNT" => array("PARENT" => "PRICES", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_SHOW_PRICE_COUNT"), "TYPE" => "STRING", "DEFAULT" => "1"), 'PRODUCT_SUBSCRIPTION' => array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_PRODUCT_SUBSCRIPTION'), 'TYPE' => 'CHECKBOX', 'DEFAULT' => 'N'), "PRICE_VAT_INCLUDE" => array("PARENT" => "PRICES", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_VAT_INCLUDE"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y"), "USE_PRODUCT_QUANTITY" => array("PARENT" => "BASKET", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_USE_PRODUCT_QUANTITY"), "TYPE" => "CHECKBOX", "DEFAULT" => "N", "REFRESH" => "Y"), "SHOW_NAME" => array("PARENT" => "VISUAL", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_SHOW_NAME"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y"), "SHOW_IMAGE" => array("PARENT" => "VISUAL", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_SHOW_IMAGE"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y"), 'MESS_BTN_BUY' => array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_MESS_BTN_BUY'), 'TYPE' => 'STRING', 'DEFAULT' => GetMessage('CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_MESS_BTN_BUY_DEFAULT')), 'MESS_BTN_DETAIL' => array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_MESS_BTN_DETAIL'), 'TYPE' => 'STRING', 'DEFAULT' => GetMessage('CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_MESS_BTN_DETAIL_DEFAULT')), 'MESS_NOT_AVAILABLE' => array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_MESS_NOT_AVAILABLE'), 'TYPE' => 'STRING', 'DEFAULT' => GetMessage('CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_MESS_NOT_AVAILABLE_DEFAULT')), 'MESS_BTN_SUBSCRIBE' => array('PARENT' => 'VISUAL', 'NAME' => GetMessage('CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_MESS_BTN_SUBSCRIBE'), 'TYPE' => 'STRING', 'DEFAULT' => GetMessage('CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_MESS_BTN_SUBSCRIBE_DEFAULT')), "PAGE_ELEMENT_COUNT" => array("PARENT" => "VISUAL", "NAME" => GetMessage("CATALOG_RECOMMENDED_PRODUCTS_COMPONENT_PAGE_ELEMENT_COUNT"), "TYPE" => "STRING", "DEFAULT" => "30")));
// Params groups
$iblockMap = array();
$iblockIterator = CIBlock::GetList(array("SORT" => "ASC"), array("ACTIVE" => "Y"));
while ($iblock = $iblockIterator->fetch()) {
$iblockMap[$iblock['ID']] = $iblock;
}
$catalogs = array();
$productsCatalogs = array();
$skuCatalogs = array();
$catalogIterator = CCatalog::getList(array("IBLOCK_ID" => "ASC"), array("@IBLOCK_ID" => array_keys($iblockMap)));
while ($catalog = $catalogIterator->fetch()) {
$isOffersCatalog = (int) $catalog['PRODUCT_IBLOCK_ID'] > 0;
if ($isOffersCatalog) {
$skuCatalogs[$catalog['PRODUCT_IBLOCK_ID']] = $catalog;
} else {
$productsCatalogs[$catalog['IBLOCK_ID']] = $catalog;
}
}
foreach ($productsCatalogs as $catalog) {
$catalog['VISIBLE'] = isset($arCurrentValues['SHOW_PRODUCTS_' . $catalog['IBLOCK_ID']]) && $arCurrentValues['SHOW_PRODUCTS_' . $catalog['IBLOCK_ID']] == "Y";
$catalogs[] = $catalog;
if (isset($skuCatalogs[$catalog['IBLOCK_ID']])) {
$skuCatalogs[$catalog['IBLOCK_ID']]['VISIBLE'] = $catalog['VISIBLE'];
$catalogs[] = $skuCatalogs[$catalog['IBLOCK_ID']];
}
示例4: GetList
/**
* The function select viewed product
*
* @param array $arOrder - array to sort
* @param array $arFilter - array to filter
* @param array $arGroupBy - array to group records
* @param array $arNavStartParams - array to parameters
* @param array $arSelectFields - array to selectes fields
* @return object $dbRes - object result
*/
public static function GetList($arOrder = array("ID" => "DESC"), $arFilter = array(), $arGroupBy = false, $arNavStartParams = false, $arSelectFields = array())
{
global $DB;
if (array_key_exists("DATE_FROM", $arFilter)) {
$arFilter[">=DATE_VISIT"] = trim($arFilter["DATE_FROM"]);
unset($arFilter["DATE_FROM"]);
}
if (array_key_exists("DATE_TO", $arFilter)) {
$arFilter["<=DATE_VISIT"] = trim($arFilter["DATE_TO"]);
unset($arFilter["DATE_TO"]);
}
if (!$arSelectFields || count($arSelectFields) <= 0 || in_array("*", $arSelectFields)) {
$arSelectFields = array("ID", "FUSER_ID", "DATE_VISIT", "PRODUCT_ID", "MODULE", "LID", "NAME", "DETAIL_PAGE_URL", "CURRENCY", "PRICE", "NOTES", "PREVIEW_PICTURE", "DETAIL_PICTURE", "CALLBACK_FUNC", "PRODUCT_PROVIDER_CLASS");
}
if (\Bitrix\Main\Loader::includeModule("catalog")) {
if (\Bitrix\Main\Config\Option::get("sale", "viewed_capability", "") == "Y") {
foreach ($arFilter as $key => $value) {
if ($key == "LID") {
$arFilter['SITE_ID'] = $value;
unset($arFilter['LID']);
}
}
$limit = 100;
if (is_array($arNavStartParams) && IntVal($arNavStartParams["nTopCount"]) >= 0) {
$limit = IntVal($arNavStartParams["nTopCount"]);
}
$viewedIterator = \Bitrix\Catalog\CatalogViewedProductTable::getList(array("filter" => $arFilter, "select" => array("ID", "PRODUCT_ID", "DATE_VISIT", "LID" => "SITE_ID", "NAME" => "ELEMENT.NAME"), "order" => array("DATE_VISIT" => "DESC"), "limit" => $limit));
$viewed = array();
while ($row = $viewedIterator->fetch()) {
$row['MODULE'] = "catalog";
$row['DATE_VISIT'] = $row['DATE_VISIT']->toString();
$viewed[$row['PRODUCT_ID']] = $row;
}
if (count($viewed)) {
// Map to parent sku
$newIds = array();
$ids = array_keys($viewed);
$catalogIterator = CCatalog::getList();
while ($catalog = $catalogIterator->fetch()) {
if ($catalog['IBLOCK_TYPE_ID'] == "offers") {
$elementIterator = CIBlockElement::getList(array(), array("ID" => $ids, "IBLOCK_ID" => $catalog['IBLOCK_ID']), false, false, array("ID", "IBLOCK_ID", "PROPERTY_" . $catalog['SKU_PROPERTY_ID']));
while ($item = $elementIterator->fetch()) {
$propertyName = "PROPERTY_" . $catalog['SKU_PROPERTY_ID'] . "_VALUE";
$parentId = $item[$propertyName];
if (!empty($parentId)) {
$newIds[$item['ID']] = $parentId;
} else {
$newIds[$item['ID']] = $item['ID'];
}
}
}
}
// Push missing
foreach ($ids as $id) {
if (!isset($newIds[$id])) {
$newIds[$id] = $id;
}
}
$filter = array("ID" => array_values($newIds));
if (!count($filter['ID'])) {
$filter = array("ID" => -1);
}
$mapped = array();
if (in_array("DETAIL_PAGE_URL", $arSelectFields) || in_array("PREVIEW_PICTURE", $arSelectFields) || in_array("DETAIL_PICTURE", $arSelectFields)) {
$elementIterator = CIBlockElement::GetList(array(), $filter);
while ($elementObj = $elementIterator->GetNextElement()) {
$fields = $elementObj->GetFields();
$mapped[$fields['ID']]['PREVIEW_PICTURE'] = $fields['PREVIEW_PICTURE'];
$mapped[$fields['ID']]['DETAIL_PICTURE'] = $fields['DETAIL_PICTURE'];
}
}
foreach ($newIds as $natural => $tr) {
$viewed[$natural]['PREVIEW_PICTURE'] = $mapped[$tr]['DETAIL_PICTURE'];
$viewed[$natural]['DETAIL_PICTURE'] = $mapped[$tr]['PREVIEW_PICTURE'];
$viewed[$natural]['PRODUCT_ID'] = $tr;
}
if (in_array("CURRENCY", $arSelectFields) || in_array("PRICE", $arSelectFields)) {
// Prices
$priceIterator = CPrice::getList(array(), array("PRODUCT_ID" => $ids), false, false, array("PRODUCT_ID", "PRICE", "CURRENCY"));
while ($price = $priceIterator->fetch()) {
if (!isset($viewed[$price['PRODUCT_ID']]['PRICE'])) {
$viewed[$price['PRODUCT_ID']]['PRICE'] = $price['PRICE'];
$viewed[$price['PRODUCT_ID']]['CURRENCY'] = $price['CURRENCY'];
}
}
}
}
// resort
$dbresult = new CDBResult();
$dbresult->InitFromArray(array_values($viewed));
//.........这里部分代码省略.........
示例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: 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;
}
示例7: IncludeModuleLangFile
##############################################
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/storeassist/include.php";
IncludeModuleLangFile(__FILE__);
\Bitrix\Main\Loader::includeModule('storeassist');
if (!($APPLICATION->GetGroupRight("storeassist") >= "R")) {
$APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/storeassist/prolog.php";
$APPLICATION->SetTitle(GetMessage("STOREAS_TITLE"));
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
$APPLICATION->SetAdditionalCSS('/bitrix/panel/storeassist/storeassist.css');
CUtil::InitJSCore(array("fx", "storeassist"));
$catalogIblockId = "";
if (Bitrix\Main\Loader::includeModule("catalog")) {
$dbCatalog = CCatalog::getList(array(), array("IBLOCK_ACTIVE" => "Y", "IBLOCK_TYPE_ID" => "catalog"));
if ($arCatalog = $dbCatalog->Fetch()) {
$catalogIblockId = $arCatalog["IBLOCK_ID"];
}
}
$partnerUrl = Bitrix\Main\Config\Option::get("storeassist", "partner_url", "");
$arAssistSteps = array("MAIN" => array("BLOCKS" => array("BLOCK_1" => array("MAIN_ITEMS" => array("currencies" => array("path" => "/bitrix/admin/currencies.php?lang=" . LANGUAGE_ID . "&back=main_block_1#showtask", "available" => IsModuleInstalled("currency")), "cat_group_admin" => array("path" => "/bitrix/admin/cat_group_admin.php?lang=" . LANGUAGE_ID . "&back=main_block_1#showtask", "available" => IsModuleInstalled("catalog")), "cat_measure_list" => array("path" => "/bitrix/admin/cat_measure_list.php?lang=" . LANGUAGE_ID . "&back=main_block_1#showtask", "available" => IsModuleInstalled("catalog")), "sale_report_edit" => array("path" => "/bitrix/admin/sale_report_edit.php?lang=" . LANGUAGE_ID . "&back=main_block_1#showtask", "available" => IsModuleInstalled("sale")), "sale_person_type" => array("path" => "/bitrix/admin/sale_person_type.php?lang=" . LANGUAGE_ID . "&back=main_block_1#showtask", "available" => IsModuleInstalled("sale")), "sale_buyers" => array("path" => "/bitrix/admin/sale_buyers.php?lang=" . LANGUAGE_ID . "&pageid=sale_buyers&back=main_block_1#showtask", "available" => IsModuleInstalled("sale")), "sale_status" => array("path" => "/bitrix/admin/sale_status.php?lang=" . LANGUAGE_ID . "&back=main_block_1#showtask", "available" => IsModuleInstalled("sale")), "cat_store_list" => array("path" => "/bitrix/admin/cat_store_list.php?lang=" . LANGUAGE_ID . "&back=main_block_1#showtask", "available" => IsModuleInstalled("catalog")), "storeassist_social" => array("path" => "/bitrix/admin/storeassist_social.php?lang=" . LANGUAGE_ID . "&back=main_block_1#showtask", "available" => true)), "ADDITIONAL_ITEMS" => array()), "BLOCK_2" => array("MAIN_ITEMS" => array("cat_product_list" => array("path" => intval($catalogIblockId) ? "/bitrix/admin/cat_product_list.php?lang=" . LANGUAGE_ID . "&IBLOCK_ID=" . $catalogIblockId . "&type=catalog&find_section_section=-1" : "/bitrix/admin/storeassist_new_items.php?lang=" . LANGUAGE_ID . "&pageid=cat_product_list&back=main_block_2#showtask", "available" => IsModuleInstalled("catalog")), "quantity" => array("path" => "/bitrix/admin/settings.php?lang=" . LANGUAGE_ID . "&mid=catalog&pageid=quantity&back=main_block_2#showtask", "available" => IsModuleInstalled("catalog")), "cat_store_document_list" => array("path" => "/bitrix/admin/cat_store_document_list.php?lang=" . LANGUAGE_ID . "&back=main_block_2#showtask", "available" => IsModuleInstalled("catalog")), "order_setting" => array("path" => "/bitrix/admin/settings.php?lang=" . LANGUAGE_ID . "&mid=sale&pageid=order_setting&back=main_block_2#showtask", "available" => IsModuleInstalled("sale")), "reserve_setting" => array("path" => "/bitrix/admin/settings.php?lang=" . LANGUAGE_ID . "&mid=catalog&pageid=reserve_setting&back=main_block_2#showtask", "available" => IsModuleInstalled("catalog"))), "ADDITIONAL_ITEMS" => array(), "TYPE" => "ONE"), "BLOCK_3" => array("MAIN_ITEMS" => array("storeassist_1c_catalog_fill" => array("path" => "/bitrix/admin/storeassist_1c_catalog_fill.php?lang=" . LANGUAGE_ID . "&back=main_block_3#showtask", "available" => true), "1c_integration" => array("path" => "/bitrix/admin/1c_admin.php?lang=" . LANGUAGE_ID . "&pageid=1c_integration&back=main_block_3#showtask", "available" => IsModuleInstalled("sale")), "storeassist_1c_unloading" => array("path" => "/bitrix/admin/storeassist_1c_unloading.php?lang=" . LANGUAGE_ID . "&back=main_block_3#showtask", "available" => true), "1c_exchange" => array("path" => "/bitrix/admin/1c_admin.php?lang=" . LANGUAGE_ID . "&pageid=1c_exchange&back=main_block_3#showtask", "available" => IsModuleInstalled("sale")), "storeassist_1c_exchange_realtime" => array("path" => "/bitrix/admin/storeassist_1c_exchange_realtime.php?lang=" . LANGUAGE_ID . "&back=main_block_3#showtask", "available" => true), "storeassist_1c_small_firm" => array("path" => "/bitrix/admin/storeassist_1c_small_firm.php?lang=" . LANGUAGE_ID . "&back=main_block_3#showtask", "available" => true)), "ADDITIONAL_ITEMS" => array(), "TYPE" => "TWO"), "BLOCK_4" => array("MAIN_ITEMS" => array("sale_pay_system" => array("path" => "/bitrix/admin/sale_pay_system.php?lang=" . LANGUAGE_ID . "&back=main_block_4#showtask", "available" => IsModuleInstalled("sale")), COption::GetOptionString("main", "~sale_converted_15", "") == "Y" ? "sale_delivery_service_list" : "sale_delivery" => array("path" => "/bitrix/admin/" . (COption::GetOptionString("main", "~sale_converted_15", "") == "Y" ? "sale_delivery_service_list" : "sale_delivery") . ".php?lang=" . LANGUAGE_ID . "&back=main_block_4#showtask", "available" => IsModuleInstalled("sale"))), "ADDITIONAL_ITEMS" => array()), "BLOCK_5" => array("MAIN_ITEMS" => array("storeassist_seo_settings" => array("path" => "/bitrix/admin/storeassist_seo_settings.php?lang=" . LANGUAGE_ID . "&back=main_block_5#showtask", "available" => true), "seo_robots" => array("path" => "/bitrix/admin/seo_robots.php?lang=" . LANGUAGE_ID . "&back=main_block_5#showtask", "available" => IsModuleInstalled("seo")), "seo_sitemap" => array("path" => "/bitrix/admin/seo_sitemap.php?lang=" . LANGUAGE_ID . "&back=main_block_5#showtask", "available" => IsModuleInstalled("seo")), "seo_search_yandex" => array("path" => "/bitrix/admin/seo_search_yandex.php?lang=" . LANGUAGE_ID . "&back=main_block_5#showtask", "available" => IsModuleInstalled("seo")), "seo_search_google" => array("path" => "/bitrix/admin/seo_search_google.php?lang=" . LANGUAGE_ID . "&back=main_block_5#showtask", "available" => IsModuleInstalled("seo")), "search_reindex" => array("path" => "/bitrix/admin/search_reindex.php?lang=" . LANGUAGE_ID . "&back=main_block_5#showtask", "available" => IsModuleInstalled("search"))), "ADDITIONAL_ITEMS" => array()))), "WORK" => array("BLOCKS" => array("BLOCK_1" => array("MAIN_ITEMS" => array("storeassist_adaptive" => array("path" => "/bitrix/admin/storeassist_adaptive.php?lang=" . LANGUAGE_ID . "&back=work_block_1#showtask", "available" => true), "opening" => array("path" => "/bitrix/admin/settings.php?lang=" . LANGUAGE_ID . "&mid=main&pageid=opening&back=work_block_1#showtask", "available" => IsModuleInstalled("main")), "checklist" => array("path" => "/bitrix/admin/checklist.php?lang=" . LANGUAGE_ID . "&back=work_block_1#showtask", "available" => IsModuleInstalled("main"))), "ADDITIONAL_ITEMS" => array()), "BLOCK_2" => array("MAIN_ITEMS" => array("cat_discount_admin" => array("path" => "/bitrix/admin/cat_discount_admin.php?lang=" . LANGUAGE_ID . "&back=work_block_2#showtask", "available" => IsModuleInstalled("catalog")), "posting_admin" => array("path" => "/bitrix/admin/posting_admin.php?lang=" . LANGUAGE_ID . "&back=work_block_2#showtask", "available" => IsModuleInstalled("subscribe"))), "ADDITIONAL_ITEMS" => array()), "BLOCK_3" => array("MAIN_ITEMS" => array("cat_export_setup" => array("path" => "/bitrix/admin/cat_export_setup.php?lang=" . LANGUAGE_ID . "&back=work_block_3#showtask", "available" => IsModuleInstalled("catalog")), "sale_ymarket" => array("path" => "/bitrix/admin/sale_ymarket.php?lang=" . LANGUAGE_ID . "&back=work_block_3#showtask", "available" => IsModuleInstalled("sale"))), "ADDITIONAL_ITEMS" => array()), "BLOCK_4" => array("MAIN_ITEMS" => array("sale_order" => array("path" => "/bitrix/admin/sale_order.php?lang=" . LANGUAGE_ID . "&back=work_block_4#showtask", "available" => IsModuleInstalled("sale")), "sale_report" => array("path" => "/bitrix/admin/sale_report.php?lang=" . LANGUAGE_ID . "&back=work_block_4#showtask", "available" => IsModuleInstalled("sale")), "client" => array("path" => "/bitrix/admin/sale_buyers.php?lang=" . LANGUAGE_ID . "&pageid=client&back=work_block_4", "available" => IsModuleInstalled("sale")), "sale_account_admin" => array("path" => "/bitrix/admin/sale_account_admin.php?lang=" . LANGUAGE_ID . "&back=work_block_4#showtask", "available" => IsModuleInstalled("sale")), "sale_basket" => array("path" => "/bitrix/admin/sale_basket.php?lang=" . LANGUAGE_ID . "&back=work_block_4#showtask", "available" => IsModuleInstalled("sale"))), "ADDITIONAL_ITEMS" => array()), "BLOCK_5" => array("MAIN_ITEMS" => array("sale_personalization" => array("path" => "/bitrix/admin/sale_personalization.php?lang=" . LANGUAGE_ID . "&back=work_block_5#showtask", "available" => IsModuleInstalled("sale"))), "ADDITIONAL_ITEMS" => array()), "BLOCK_6" => array("MAIN_ITEMS" => array("blog_comment" => array("path" => "/bitrix/admin/blog_comment.php?lang=" . LANGUAGE_ID . "&back=work_block_6#showtask", "available" => IsModuleInstalled("blog")), "ticket_desktop" => array("path" => "/bitrix/admin/ticket_desktop.php?lang=" . LANGUAGE_ID . "&back=work_block_6#showtask", "available" => IsModuleInstalled("support"))), "ADDITIONAL_ITEMS" => array()), "BLOCK_7" => array("MAIN_ITEMS" => array("sale_crm" => array("path" => "/bitrix/admin/sale_crm.php?lang=" . LANGUAGE_ID . "&back=work_block_6#showtask", "available" => IsModuleInstalled("sale")), "storeassist_crm_client" => array("path" => "/bitrix/admin/storeassist_crm_client.php?lang=" . LANGUAGE_ID . "&back=work_block_7#showtask", "available" => true), "storeassist_crm_calls" => array("path" => "/bitrix/admin/storeassist_crm_calls.php?lang=" . LANGUAGE_ID . "&back=work_block_7#showtask", "available" => true)), "ADDITIONAL_ITEMS" => array()))), "HEALTH" => array("BLOCKS" => array("BLOCK_1" => array("MAIN_ITEMS" => array("site_speed" => array("path" => "/bitrix/admin/site_speed.php?lang=" . LANGUAGE_ID . "&back=health_block_1#showtask", "available" => IsModuleInstalled("main")), "composite" => array("path" => "/bitrix/admin/composite.php?lang=" . LANGUAGE_ID . "&back=health_block_1#showtask", "available" => IsModuleInstalled("main")), "bitrixcloud_cdn" => array("path" => "/bitrix/admin/bitrixcloud_cdn.php?lang=" . LANGUAGE_ID . "&back=health_block_1#showtask", "available" => IsModuleInstalled("bitrixcloud")), "perfmon_panel" => array("path" => "/bitrix/admin/perfmon_panel.php?lang=" . LANGUAGE_ID . "&back=health_block_1#showtask", "available" => IsModuleInstalled("perfmon"))), "ADDITIONAL_ITEMS" => array()), "BLOCK_2" => array("MAIN_ITEMS" => array("security_filter" => array("path" => "/bitrix/admin/security_filter.php?lang=" . LANGUAGE_ID . "&back=health_block_2#showtask", "available" => IsModuleInstalled("security")), "dump_auto" => array("path" => "/bitrix/admin/dump_auto.php?lang=" . LANGUAGE_ID . "&back=health_block_2#showtask", "available" => IsModuleInstalled("main")), "security_scanner" => array("path" => "/bitrix/admin/security_scanner.php?lang=" . LANGUAGE_ID . "&back=health_block_2#showtask", "available" => IsModuleInstalled("security")), "bitrixcloud_monitoring_admin" => array("path" => "/bitrix/admin/bitrixcloud_monitoring_admin.php?lang=" . LANGUAGE_ID . "&back=health_block_2#showtask", "available" => IsModuleInstalled("bitrixcloud")), "security_otp" => array("path" => "/bitrix/admin/security_otp.php?lang=" . LANGUAGE_ID . "&back=health_block_2#showtask", "available" => IsModuleInstalled("security"))), "ADDITIONAL_ITEMS" => array()), "BLOCK_3" => array("MAIN_ITEMS" => array("scale_graph" => array("path" => "/bitrix/admin/scale_graph.php?lang=" . LANGUAGE_ID . "&back=health_block_3#showtask", "available" => IsModuleInstalled("scale")), "cluster_index" => array("path" => "/bitrix/admin/cluster_index.php?lang=" . LANGUAGE_ID . "&back=health_block_3#showtask", "available" => IsModuleInstalled("cluster")), "storeassist_virtual" => array("path" => "/bitrix/admin/storeassist_virtual.php?lang=" . LANGUAGE_ID . "&back=health_block_3#showtask", "available" => true)), "ADDITIONAL_ITEMS" => array()), "BLOCK_4" => array("MAIN_ITEMS" => array("site_checker" => array("path" => "/bitrix/admin/site_checker.php?lang=" . LANGUAGE_ID . "&back=health_block_4#showtask", "available" => IsModuleInstalled("main")), "info_vk" => array("path" => "https://vk.com/topic-23581648_24910930", "available" => true), "info_blog" => array("path" => "https://dev.1c-bitrix.ru/community/blogs/product_features/", "available" => true), "info_forum_guest" => array("path" => "https://dev.1c-bitrix.ru/community/forums/forum6/", "available" => true), "info_forum_client" => array("path" => "https://dev.1c-bitrix.ru/community/forums/forum7/", "available" => true), "info_idea" => array("path" => "https://idea.1c-bitrix.ru/category/bitrix/", "available" => true), "info_user_doc" => array("path" => "https://dev.1c-bitrix.ru/user_help/", "available" => true), "info_api_doc" => array("path" => "https://dev.1c-bitrix.ru/api_help/", "available" => true), "support_bitrix" => array("path" => "https://www.1c-bitrix.ru/support/", "available" => true), "info_courses" => array("path" => "http://dev.1c-bitrix.ru/learning/index.php", "available" => true), "support_developer" => array("path" => htmlspecialcharsbx($partnerUrl), "available" => $partnerUrl ? true : false)), "ADDITIONAL_ITEMS" => array()))));
//option of checked items
$arStoreAssistOption = CStoreAssist::getSettingOption();
//check Opening item
if (!in_array("opening", $arStoreAssistOption)) {
if (Bitrix\Main\Config\Option::get("main", "site_stopped", "N") == "N") {
CStoreAssist::setSettingOption("opening", "Y");
$arStoreAssistOption[] = "opening";
}
}
示例8: getProductsMap
/**
* Returns ids map: SKU_PRODUCT_ID => PRODUCT_ID
*
* @param array $originalIds Input products ids.
* @return integer[]
*/
public static function getProductsMap(array $originalIds = array())
{
if (!is_array($originalIds) || !count($originalIds)) {
return array();
}
$newIds = array();
$catalogIterator = \CCatalog::getList(array("IBLOCK_ID" => "ASC"), array("!SKU_PROPERTY_ID" => 0), false, false, array("IBLOCK_ID", "SKU_PROPERTY_ID"));
while ($catalog = $catalogIterator->fetch()) {
$elementIterator = \CIBlockElement::getList(array(), array("ID" => $originalIds, "IBLOCK_ID" => $catalog['IBLOCK_ID']), false, false, array("ID", "IBLOCK_ID", "PROPERTY_" . $catalog['SKU_PROPERTY_ID']));
while ($item = $elementIterator->fetch()) {
$propertyName = "PROPERTY_" . $catalog['SKU_PROPERTY_ID'] . "_VALUE";
$parentId = $item[$propertyName];
if (!empty($parentId)) {
$newIds[$item['ID']] = $parentId;
} else {
$newIds[$item['ID']] = $item['ID'];
}
}
}
// Push missing
foreach ($originalIds as $id) {
if (!isset($newIds[$id])) {
$newIds[$id] = $id;
}
}
// Resort map
$tmpMap = array();
foreach ($originalIds as $id) {
$tmpMap[$id . ""] = $newIds[$id];
}
return $tmpMap;
}