public static function PrepareCatalogListItems($addNotSelected = true)
 {
     IncludeModuleLangFile(__FILE__);
     $result = array();
     if ($addNotSelected) {
         $result['0'] = GetMessage('CRM_PRODUCT_CATALOG_NOT_SELECTED');
     }
     $rs = CCrmCatalog::GetList(array('NAME' => 'ASC'), array(), array('ID', 'NAME'));
     while ($ar = $rs->Fetch()) {
         $result[$ar['ID']] = $ar['NAME'];
     }
     return $result;
 }
Example #2
0
<?php

if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!CModule::IncludeModule('crm') || !CModule::IncludeModule('iblock')) {
    return false;
}
global $APPLICATION;
$arCatalogs = array();
$arCatalogs['0'] = GetMessage('CRM_CATALOG_NOT_SELECTED');
$rsCatalogs = CCrmCatalog::GetList(array('NAME' => 'ASC'), array('ACTIVE' => 'Y'), array('ID', 'NAME'));
while ($arCatalog = $rsCatalogs->Fetch()) {
    $catalogID = $arCatalog['ID'];
    $arCatalogs[$catalogID] = '[' . $catalogID . '] ' . $arCatalog['NAME'];
}
$arSections = array();
$catalogID = isset($arCurrentValues['CATALOG_ID']) ? intval($arCurrentValues['CATALOG_ID']) : 0;
if ($catalogID > 0) {
    $arSections[''] = GetMessage('CRM_SECTION_NOT_SELECTED');
    $rsSections = CIBlockSection::GetList(array('left_margin' => 'asc'), array('IBLOCK_ID' => $catalogID, 'GLOBAL_ACTIVE' => 'Y', 'CHECK_PERMISSIONS' => 'N'), false, array('ID', 'NAME', 'DEPTH_LEVEL'));
    while ($arSection = $rsSections->GetNext()) {
        $sectionID = $arSection['ID'];
        $arSections[$sectionID] = str_repeat(' . ', $arSection['DEPTH_LEVEL']) . '[' . $sectionID . '] ' . $arSection['NAME'];
    }
}
$arComponentParameters = array('PARAMETERS' => array('SECTION_COUNT' => array('PARENT' => 'BASE', 'NAME' => GetMessage('CRM_SECTION_COUNT'), 'TYPE' => 'STRING', 'DEFAULT' => '20'), 'CATALOG_ID' => array('PARENT' => 'BASE', 'NAME' => GetMessage('CRM_CATALOG_ID'), 'TYPE' => 'LIST', 'VALUES' => $arCatalogs, 'REFRESH' => 'Y'), 'SECTION_ID' => array('PARENT' => 'BASE', 'NAME' => GetMessage('CRM_PARENT_SECTION_ID'), 'TYPE' => 'LIST', 'VALUES' => $arSections), 'SECTION_ID_PARAM' => array('PARENT' => 'BASE', 'NAME' => GetMessage('CRM_SECTION_ID_PARAM'), 'TYPE' => 'STRING', 'DEFAULT' => 'section_id'), 'PATH_TO_SECTION_LIST' => array('PARENT' => 'BASE', 'NAME' => GetMessage('CRM_PATH_TO_SECTION_LIST'), 'TYPE' => 'STRING', 'DEFAULT' => '?section_id=#section_id#&sections')));
Example #3
0
    $arFields["SORT"] = 100;
    $arFields["NAME"] = "BASE";
    $arFields["USER_GROUP"] = array(1, 2);
    $arFields["USER_GROUP_BUY"] = array(1, 2);
    $basePriceId = CCatalogGroup::Add($arFields);
    if ($basePriceId <= 0) {
        $errMsg[] = Loc::getMessage('CRM_UPDATE_ERR_003');
        return;
    }
}
if ($basePriceId <= 0 && isset($basePrice['ID']) && $basePrice['ID'] > 0) {
    $basePriceId = $basePrice['ID'];
}
unset($basePrice, $dbRes);
$arCatalogId = array();
$dbCatalogList = CCrmCatalog::GetList();
while ($arCatalog = $dbCatalogList->Fetch()) {
    $arCatalogId[] = $arCatalog['ID'];
}
$defCatalogId = CCrmCatalog::EnsureDefaultExists();
if ($defCatalogId > 0) {
    if (!in_array($defCatalogId, $arCatalogId)) {
        $arCatalogId[] = $defCatalogId;
    }
} else {
    $errMsg[] = Loc::getMessage('CRM_UPDATE_ERR_001');
    return;
}
if (!empty($arCatalogId) && empty($errMsg)) {
    $CCatalog = new CCatalog();
    if ($CCatalog) {
Example #4
0
 public static function GetByID($ID)
 {
     $arResult = CCrmEntityHelper::GetCached(self::CACHE_NAME, $ID);
     if (is_array($arResult)) {
         return $arResult;
     }
     $dbRes = CCrmCatalog::GetList(array(), array('ID' => intval($ID)));
     $arResult = $dbRes->Fetch();
     if (is_array($arResult)) {
         CCrmEntityHelper::SetCached(self::CACHE_NAME, $ID, $arResult);
     }
     return $arResult;
 }
Example #5
0
 protected function innerGetList($order, $filter, $select, $navigation, &$errors)
 {
     if (!CCrmProduct::CheckReadPermission(0)) {
         $errors[] = 'Access denied.';
         return false;
     }
     return CCrmCatalog::GetList($order, $filter, false, $navigation, $select, array('IS_EXTERNAL_CONTEXT' => true));
 }