C
C
countZer02021-04-16 09:57:36
1C-Bitrix
countZer0, 2021-04-16 09:57:36

Search implementation examples?

Hello!

There is a search task that should search for product SKUs that are in the property
. For example, there is an SKU 12345, you need to make the search work on both 12345 and 123-45 and 12-345
And that would work on an incomplete input, for example, if enter 123, the search will return the result with all elements for which the article number begins with 123

Tell me examples of implementation

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Gritsuk, 2021-04-16
@winer

At the very least, you need to add the SKU property to the search index .
Further options are possible:
1) Connect the search.page component and check if the search will work as you need. Maybe it will just "take off" out of the box.
2) If it does not work as it should, you will need to finish:
- Decide on the characters from which you need to clear the article when searching.
- Create a new property Article, which would participate in the search. Fill it in onBeforeIblockElementUpdate and onBeforeIblockElementAdd events . Before filling, clear of unnecessary characters.
- Add a property to the search index, as described above.
- Customize componentsearch.page. You will have to change the line with $q to clear unnecessary characters, as we did above. $q = trim($_REQUEST["q"]);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question