getCategory

getCategory ( string search , boolean _usePath , boolean _isCloserSearch , boolean _returnList ) : int_or_array

Returns the corresponding category ID in all registered in the cache list. You must refresh this cache every time you add a new element on your site. Else the list will be obsolete.
Use activeFlexibleComparaison to ignore for example accent differences in the search.

See also

updateCategories
activeFlexibleComparaison

Parameters

search

what you search in the list.

_usePath (optional)

• if false (default), category name is used
• if true, category path is used (with parent categories)

_isCloserSearch (optional)

• if false (default), the function returns the corresponding ID if there is an exact matching and null else
• if true, it returns everytime something. In IA algorithm compares textual similarities and returns the closer element ID.

_returnList (optional)

• if false (default), it returns an ID
• if true, it returns a list of IDs. So if isCloserSearch=false, it returns all elements with a name equal to the search. If isCloserSearch=true, it returns all the list ordered by proximity.