...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/integration/main/uiselector/crmproducts.php
- Класс: Bitrix\Crm\Integration\Main\UISelector\CrmProducts
- Вызов: CrmProducts::search
public function search($params = []) { $result = [ 'ITEMS' => [], 'ADDITIONAL_INFO' => [], ]; $entityOptions = (!empty($params['options']) ? $params['options'] : []); $requestFields = (!empty($params['requestFields']) ? $params['requestFields'] : []); $search = $requestFields['searchString']; $prefix = static::getPrefix($entityOptions); if ( $search <> '' && ( empty($entityOptions['enableSearch']) || $entityOptions['enableSearch'] != 'N' ) ) { $filter = $this->getSearchFilter($search, $entityOptions); if ($filter === false) { return $result; } $select = $this->getSearchSelect(); $pricesSelect = $vatSelect = []; $select = CCrmProduct::distributeProductSelect($select, $pricesSelect, $vatSelect); $res = CCrmProduct::getList( $this->getSearchOrder(), $filter, $select, 50 ); $products = $productsIdList = []; while ($productFields = $res->fetch()) { foreach ($pricesSelect as $fieldName) { $productFields[$fieldName] = null; } foreach ($vatSelect as $fieldName) { $productFields[$fieldName] = null; } $productsIdList[] = $productFields['ID']; $products[$productFields['ID']] = $productFields; } CCrmProduct::obtainPricesVats($products, $productsIdList, $pricesSelect, $vatSelect); unset($productsIdList, $pricesSelect, $vatSelect); $resultItems = []; foreach ($products as $product) { $resultItems[$prefix . $product['ID']] = static::prepareEntity($product, $entityOptions); } $resultItems = $this->appendItemsByIds($resultItems, $search, $entityOptions); $resultItems = $this->processResultItems($resultItems, $entityOptions); $result["ITEMS"] = $resultItems; } return $result; }