Sunnysideup\Ecommerce\ProductsAndGroups\Applyers\ProductSearchFilter
provides data on the user.
Synopsis
class ProductSearchFilter
extends BaseApplyer
{
- // constants
- const KEY_FOR_SORTER = 'relevant';
- const PARTIAL_CACHE_FIELDS_TO_CACHE = ;
- const OPTIONS_FOR_SORT = ;
- // Inherited constants from BaseApplyer
- const DEFAULT_NAME = 'default';
- const SQL_PARAM_PLACEHOLDER = '[[PARAMS_GO_HERE]]';
- // members
- protected bool $debug = false;
- protected bool $productListIsFiltered = false;
- protected array $rawData = ;
- protected string $keywordPhrase = '';
- protected array $extraBuyableFieldsToSearchFullText = ;
- protected array $productIds = ;
- protected array $productGroupIds = ;
- protected integer $resultArrayPos = 0;
- protected string $baseClassNameForBuyables = '';
- protected string $baseClassNameForGroups = ProductGroup::class;
- protected bool $useBooleanSearch = true;
- protected integer $maximumNumberOfResults = 0;
- protected $productsForGroups;
- protected static array $groupCache = ;
- protected static DataList $groupListCache;
- protected static DataList $debugString = '';
- private static bool $use_product_search_table = true;
- private static array $options = ;
- private static bool $use_partial_cache = true;
- private static string $custom_id_method_to_retrieve_products = '';
- private static array $default_product_filter = ;
- private static array $in_group_sort_sql = ;
- // Inherited members from BaseApplyer
- protected ProductGroup $baseListOwner;
- protected FinalProductList $finalProductList;
- protected DataList $products;
- protected string $selectedOption;
- protected boolean $applied;
- protected array|string $selectedOptionParams;
- // methods
- public static void keyword_sanitised()
- public void apply()
- public void getTitle()
- public void getLastSearchPhrase()
- public void getProductIds()
- public DataList getProductGroupAsList()
- public void getProductGroupIds()
- public void getHasResults()
- public void getDebugOutputString()
- public void setBaseListForGroups()
- public void setSearchKeyword()
- public void setExtraBuyableFieldsToSearchFullText()
- public void setBaseClassNameForBuyables()
- public void setBaseClassNameForGroups()
- public void setMaximumNumberOfResults()
- protected void applyStart()
- protected void runFullProcessFromCache()
- protected void runFullProcess()
- protected void runKeywordSearch()
- protected void doProcessSetup()
- protected void doKeywordCleanup()
- protected void doKeywordReplacements()
- protected void doProductSearch()
- protected void maxToAdd()
- protected void doGroupSearch()
- protected void addToResults()
- protected void addToResultsInner()
- protected bool weHaveEnoughResults()
- protected void createBaseList()
- protected void doPriceSearch()
- protected void doAdvancedSearch()
- protected void debugOutput()
- protected void hasMinMaxSearch()
- protected void getSearchApi()
- protected void getHashBasedOnRawData()
- protected void getProductListIsFiltered()
- // Inherited methods from BaseApplyer
- public void __construct()
- public abstract BaseApplyer apply()
- public void getOptions()
- public void getProducts()
- public void getSelectedOption()
- public void getSelectedOptionParams()
- public void getOptionsMap()
- public void getTitle()
- public array|string getSql()
- public void getRequiresData()
- public void IsShowFullList()
- public mixed checkOption()
- protected array|string sqlPlaceholderReplacer()
- protected void applyStart()
- protected void applyEnd()
- // Inherited methods from PartialObjectCache
- protected void partialCacheApplyVariablesFromCache()
- protected void partialCacheGetSerializedObject()
- protected void partialCacheSetCacheForHash()
- protected void partialCacheGetCacheForHash()
- protected void partialCacheApplyCacheFromHash()
- protected mixed partialCacheArrayToObject()
- protected void partialCacheGetFieldsToCache()
Hierarchy
Extends
Uses
Tasks
Line | Task |
---|---|
490 | consider using |
Constants
Name | Value |
---|---|
KEY_FOR_SORTER | 'relevant' |
PARTIAL_CACHE_FIELDS_TO_CACHE | |
OPTIONS_FOR_SORT | |
DEFAULT_NAME | 'default' |
SQL_PARAM_PLACEHOLDER | '[[PARAMS_GO_HERE]]' |
Members
private
- $custom_id_method_to_retrieve_products
—
string
e.g. IDForSearchResults. - $default_product_filter
—
array
Default selection criteria for products. - $in_group_sort_sql
—
array
when we do not know the relevance then sort like this. - $options
—
array
make sure that these do not exist as a URLSegment. - $use_partial_cache
—
Sunnysideup\Ecommerce\ProductsAndGroups\Applyers\bool
do we use the cache at all. - $use_product_search_table — Sunnysideup\Ecommerce\ProductsAndGroups\Applyers\bool
protected
- $applied
- $baseClassNameForBuyables
—
string
class name of the buyables to search at this stage, you can only search one type of buyable at any one time e.g. only products or only mydataobject. - $baseClassNameForGroups
—
string
class name of the buyables to search at this stage, you can only search one type of buyable at any one time e.g. only products or only mydataobject. - $baseListOwner
—
Sunnysideup\Ecommerce\Pages\ProductGroup
a product group that creates the base list. - $debug
—
Sunnysideup\Ecommerce\ProductsAndGroups\Applyers\bool
set to TRUE to show the search logic. - $debugString — SilverStripe\ORM\DataList
- $extraBuyableFieldsToSearchFullText — array
- $finalProductList
—
Sunnysideup\Ecommerce\ProductsAndGroups\Builders\FinalProductList
final product list object, always present. - $groupCache
—
array
results for groups. - $groupListCache — SilverStripe\ORM\DataList
- $hasCache — Sunnysideup\Ecommerce\Traits\bool
- $keywordPhrase
—
string
processed keyword. - $maximumNumberOfResults
—
int
Maximum number of results to return we limit this because otherwise the system will choke the assumption is that no user is really interested in looking at tons of results. - $productGroupIds
—
array
product groups found. - $productIds
—
array
array of IDs of the results found so far. - $productListIsFiltered
—
Sunnysideup\Ecommerce\ProductsAndGroups\Applyers\bool
Is this product list filtered or can we rely on Product::get()->filter(['ShowInSearch']). - $products — SilverStripe\ORM\DataList
- $productsForGroups
- $rawData
—
array
Fields are: - Keyword - MinimumPrice - MaximumPrice - OnlyThisSection. - $resultArrayPos
—
int
Number of results found so far. - $selectedOption — string
- $selectedOptionParams — Sunnysideup\Ecommerce\ProductsAndGroups\Applyers\array|string
- $useBooleanSearch
—
Sunnysideup\Ecommerce\ProductsAndGroups\Applyers\bool
this is mysql specific, see: https://dev.mysql.com/doc/refman/5.0/en/fulltext-boolean.html.
Methods
protected
- addToResults() — add items to list.
- addToResultsInner() — returns false if we can add more.
- applyStart()
- createBaseList()
- debugOutput()
- doAdvancedSearch()
- doGroupSearch() — search for groups.
- doKeywordCleanup() — cleanup keyword phrase.
- doKeywordReplacements() — replace keywords with better ones we also need them for groups!
- doPriceSearch() — filter baselist for price min and max.
- doProcessSetup() — set up basics, using data.
- doProductSearch() — search for products.
- getHashBasedOnRawData()
- getProductListIsFiltered()
- getSearchApi()
- hasMinMaxSearch()
- maxToAdd() — how many more can we add?
- runFullProcess() — run process from ProductGroup.
- runFullProcessFromCache()
- runKeywordSearch()
- weHaveEnoughResults() — do we need more results?
public
- apply()
- getDebugOutputString()
- getHasResults()
- getLastSearchPhrase() — they search phrase used.
- getProductGroupAsList()
- getProductGroupIds()
- getProductIds()
- getTitle()
- keyword_sanitised()
- setBaseClassNameForBuyables()
- setBaseClassNameForGroups()
- setBaseListForGroups()
- setExtraBuyableFieldsToSearchFullText()
- setMaximumNumberOfResults()
- setSearchKeyword()
Inherited from Sunnysideup\Ecommerce\ProductsAndGroups\Applyers\BaseApplyer
protected
- applyEnd()
- applyStart()
- sqlPlaceholderReplacer() — get the sql for an option.
public
- IsShowFullList() — get the sql for an option.
- apply() — manipulates the product lists.
- checkOption() — check for one option. If no return value is specified then all of the options are returned.
- getOptions()
- getOptionsMap() — dropdown list of options.
- getProducts()
- getRequiresData() — get the UsesParamData for an option.
- getSelectedOption()
- getSelectedOptionParams()
- getSql() — get the sql for an option.
- getTitle() — get the title for an option.
Inherited from Sunnysideup\Ecommerce\Traits\PartialObjectCache
protected
- partialCacheApplyCacheFromHash() — apply to objects.
- partialCacheApplyVariablesFromCache() — apply any available cache.
- partialCacheArrayToObject() — turns an array of ClassName and ID into objects.
- partialCacheGetCacheForHash() — return array of values from hash.
- partialCacheGetFieldsToCache()
- partialCacheGetSerializedObject()
- partialCacheSetCacheForHash() — return true on successful caching.