<<

NAME

ProductOpener::TaxonomySuggestions - suggests taxonomy entries for dropdown, autocomplete etc.

DESCRIPTION

get_taxonomy_suggestions_with_synonyms ($tagtype, $search_lc, $string, $context_ref, $options_ref )

Generate taxonomy suggestions with matched synonyms information.

get_taxonomy_suggestions ($tagtype, $search_lc, $string, $context_ref, $options_ref )

Generate taxonomy suggestions (without matched synonyms information).

Parameters

$tagtype id of the taxonomy (required)

$search_lc language of parameters (categories, shape, material etc.) and of the returned suggestions (required)

$string string to query (e.g. for autocompletion) (optional)

$context_ref context object

Hash of fields that can be taken into account to generate relevant suggestions

- country: derived from the cc parameter - categories: comma separated list of categories (tags ids or strings in the $search_lc language) - shape: packaging shape (tag id or string in the $search_lc language)

Note

The results of this function are cached for 1 day using memcached. Restart memcached if you want fresh results (e.g. when taxonomy are category stats change).

generate_sorted_list_of_taxonomy_entries($tagtype, $search_lc, $context_ref)

Generate a sorted list of canonicalized taxonomy entries from which we will generate suggestions

generate_popular_suggestions_according_to_context($tagtype, $search_lc, $context_ref, $seen_tags_ref)

Given a specific context (e.g. the product's country, categories, or the packaging component shape), we can generate popular suggestions sorted by popularity in this context.

Currently supports packaging_shapes and packaging_materials

For other taxonomy types, an empty list is returned.

add_sorted_entries_to_tags($tags_ref, $seen_tags_ref, $entries_ref, $tagtype, $search_lc)

Add packaging entries (shapes or materials) sorted by frequency for a specific country, category and shape (for materials)

Parameters

$tags_ref points to the list we want to appends tags to

$seen_tags_ref point to a hashmap of entries already in $tags_ref

$entries_ref point to a hashmap where keys are tags and values represent tag priority

$tagtype - type of tag necessary to use right translations for alphabetical sort (see Tags.pm)

$search_lc - is the target language for translations

filter_suggestions_matching_string_with_synonyms ($tags_ref, $tagtype, $search_lc, $string, $options_ref)

Filter a list of potential taxonomy suggestions matching a string with matched synonyms information.

filter_suggestions_matching_string ($tags_ref, $tagtype, $search_lc, $string, $options_ref)

Filter a list of potential taxonomy suggestions matching a string (without matched synonyms information).

By priority, the function returns: - taxonomy entries that match the input string at the beginning - taxonomy entries that contain the input string - taxonomy entries that contain words contained in the input string (with other words between)

Parameters

$tags_ref reference to an array of tags that needs to be filtered

$tagtype the type of tag

$search_lc language code of taxonomy suggestions to return

$string string to search

$options_ref hash of options

- limit: limit of number of results - format (not yet defined and implemented)

Return value

An array of suggestions hashes with the following fields: - tag: the tag to suggest - matched_synonym: the synonym that matched the input string

<<