D
D
Diversia2017-05-30 08:49:07
PHP
Diversia, 2017-05-30 08:49:07

What is the principle of creating a live search by infoblock elements for Bitrix?

It is necessary to make a live search for the elements of the infoblock in Bitrix. There is a form in which there is a select field. The data in the select must be loaded dynamically from the infoblock. The infoblock has about 10,000 elements. The bootstrap-select plugin is used as a plugin to change the select view . The user enters a phrase in the select, then the list of found dynamically should be loaded. There are other fields in the form that should also be saved along with the select. Select can be multiple in the form (this is important).

I assume that you need to make a request through Jquery to the desired file. The file must contain CIBlockElement::GetList. Depending on the search phrase, the option fields in the select should change. With the help of Jquery, you need to make a request to the file and in the option output (insert into select via the selector) the list of found elements in the infoblock (CIBlockElement::GetList).

Questions:

  • Did I describe the logic of work correctly? What is the best way to implement live search?
  • On what event to start accessing a file for searching?
  • What is the best plugin to use for selecting elements from select? I saw somewhere that when an element was selected, it was added to the list with a cross (which, like tags, can be removed by clicking). Needed with bootstrap support. Please advise!
  • How fast will it work? There is no point in caching the output, i.e. search phrases will always be different. An entry-level VPS, but optimized for Bitrix with PHP 7 (performance 132 points).

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya, 2017-05-30
@rpsv

1. Create a file like "/api/[something].list.php"
2. In it, describe the logic of work (CIBlockElement and that's it).
3. In the form, make a request to this file
. Actually, this will be enough.
I do not advise you to make some kind of general service, such as "iblock.list", since passing request parameters like "IBLOCK_ID", "ID", ... in the clear is not cool at all. Of course, you can pre-encrypt data (for example, AES), but do you need this hemorrhoids?
Concerning productivity: do search in a substring (normal LIKE). If it takes too long, you can create a full-text index on the field ( www.mysql.ru/docs/man/Fulltext_Search.html ) or make a regular index and search by the initial string, i.e. LIKE"

A
Alexey Emelyanov, 2017-05-30
@babarun

I would take the bitrix:search.title component as a basis and redesign its template.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question