SilverCart\Model\Pages\SearchResultsPage
page type to display search results.
- Author: Sebastian Diel <sdiel@pixeltricks.de>
- Copyright: 2017 pixeltricks GmbH
- License: see license file in modules root directory
Synopsis
class SearchResultsPage
extends ProductGroupPage
{
- // constants
- const SESSION_KEY_SEARCH_QUERY = 'SilverCart.SearchQuery';
- const SESSION_KEY_SEARCH_CATEGORY = 'SilverCart.SearchCategory';
- const SESSION_KEY_SEARCH_CONTEXT = 'SilverCart.SearchContext';
- // Inherited constants from ProductGroupPage
- const META_TITLE_BEHAVIOR_NONE = 'none';
- const META_TITLE_BEHAVIOR_PREFIX = 'prefix';
- const META_TITLE_BEHAVIOR_SUFFIX = 'suffix';
- // members
- private static string $table_name = 'SilvercartSearchResultsPage';
- private static string $allowed_children = 'none';
- private static string $icon = "silvercart/silvercart:client/img/page_icons/metanavigation_page_search-file.gif";
- private static array $db = ;
- // Inherited members from ProductGroupPage
- protected array $cachedProducts;
- protected $manufacturers;
- protected static array $activeProducts;
- protected boolean $getCMSFieldsIsCalled;
- protected PaginatedList $paginationContext;
- protected $cacheKeyParts;
- protected $cacheKey;
- // methods
- public string singular_name()
- public string plural_name()
- public array fieldLabels()
- public FieldList getCMSFields()
- public string getMetaTitle()
- public string RelativeLink()
- public string PlainLink()
- public string QueryLink()
- public array CacheKeyParts()
- public static string getCurrentSearchQuery()
- public static void setCurrentSearchQuery()
- public static string getCurrentSearchCategory()
- public static void setCurrentSearchCategory()
- public static string getCurrentSearchContext()
- public static void setCurrentSearchContext()
- // Inherited methods from ProductGroupPage
- public void __construct()
- public string singular_name()
- public string plural_name()
- public string LinkingMode()
- public string Link()
- public string CanonicalLink()
- public string OriginalLink()
- public string BackLink()
- public SiteTree BackPage()
- public bool isInternalUrl()
- public array fieldLabels()
- public FieldList getCMSFields()
- public array getMirroredProductIDs()
- public boolean drawCMSFields()
- public bool hasProductsOrChildren()
- public bool hasProductCount()
- public static array getFlatChildPageIDsForPage()
- public ArrayData ActiveProducts()
- public ArrayList getManufacturers()
- public bool isActive()
- public bool isFirstPage()
- public ProductGroupPageController getContextController()
- public DataList|false getProductsForced()
- public DataList|false getProducts()
- public PaginatedList getProductsFromChildren()
- public SS_List getProductsFromChildrenList()
- public string getProductsFromChildrenFilter()
- public PaginatedList getProductsToDisplay()
- public DataList getProductsInherited()
- public DataList getNewProducts()
- public ArrayData getNewProductsForTemplate()
- public bool ShowNewProducts()
- public DataList getPreorderableProducts()
- public ArrayData getPreorderableProductsForTemplate()
- public bool ShowPreorderableProducts()
- public string getMetaDescription()
- public string getMetaTitle()
- public string getPlainMetaTitle()
- public string getAfterMetaTitle()
- public string getproductsPerPage()
- public string getproductGroupsPerPage()
- public string getuseContentFromParent()
- public string getDoNotShowProducts()
- public bool getShowNewProducts()
- protected void onBeforeWrite()
- public void onBeforeDelete()
- public ProductGroupHolder getProductGroupHolderPage()
- public string getBreadcrumbTitle()
- public string getProductsOnPagesString()
- public PaginatedList getPaginationContext()
- public void setPaginationContext()
- public void updateLastEditedForCache()
- public string OriginalBreadcrumbs()
- public ArrayList getBreadcrumbItems()
- public array CacheKeyParts()
- public string CacheKey()
- public DBHTMLText BeforeInsertWidgetAreaContent()
- public ArrayList ExtendedDynamicProductGroupNavigationItems()
- public bool IsProductGroupPage()
- // Inherited methods from ExtensibleDataObject
- protected void beforeRequireDefaultRecords()
- protected void beforeUpdateCMSActions()
- protected void beforeUpdateFieldLabels()
- protected void beforeUpdateProvidePermissions()
- public array defaultFieldLabels()
- public static void reset_field_labels()
- protected array scaffoldFieldLabels()
Hierarchy
Constants
Name | Value |
---|---|
SESSION_KEY_SEARCH_QUERY | 'SilverCart.SearchQuery' |
SESSION_KEY_SEARCH_CATEGORY | 'SilverCart.SearchCategory' |
SESSION_KEY_SEARCH_CONTEXT | 'SilverCart.SearchContext' |
META_TITLE_BEHAVIOR_NONE | 'none' |
META_TITLE_BEHAVIOR_PREFIX | 'prefix' |
META_TITLE_BEHAVIOR_SUFFIX | 'suffix' |
Members
private
- $allowed_children
—
array
Set allowed children for this page. - $db
—
array
Attributes. - $icon
—
string
We set a custom icon for this page type here - $table_name
—
string
DB table name
protected
- $activeProducts
—
array
Contains the number of all active Products for this page for caching purposes. - $cacheKey
—
string
Cache key for this product group - $cacheKeyParts
—
array
Cache key parts for this product group - $cachedProducts
—
array
Saves the result from $this->getProducts() - $defaultFieldLabels
—
array
Default field labels. - $getCMSFieldsIsCalled
—
boolean
Indicator to check whether getCMSFields is called - $manufacturers
—
boolean
Contains all manufacturers of the products contained in this product group page. - $paginationContext
—
SilverStripe\ORM\PaginatedList
Optional pagination context. If not set, the return value of getProducts() will be used.
Methods
public
- CacheKeyParts() — Returns the cache key parts for the current search context query and category.
- PlainLink() — Returns the plain link without search query.
- QueryLink() — Returns the link for the given search query.
- RelativeLink() — Adds the current search query to the link.
- fieldLabels() — Field labels for display in tables.
- getCMSFields() — Return all fields of the backend.
- getCurrentSearchCategory() — Returns the current search category out of the session store.
- getCurrentSearchContext() — Returns the current search context out of the session store.
- getCurrentSearchQuery() — Returns the current search query out of the session store.
- getMetaTitle() — Returns the meta title. If not set, the meta-title of the single product in detail view or the title of the SiteTree object will be returned
- plural_name() — Returns the translated plural name of the object. If no translation exists the class name will be returned.
- setCurrentSearchCategory() — Sets the current search category.
- setCurrentSearchContext() — Sets the current search context.
- setCurrentSearchQuery() — Sets the current search query.
- singular_name() — Returns the translated singular name of the object. If no translation exists the class name will be returned.
Inherited from SilverCart\Model\Pages\ProductGroupPage
protected
- onBeforeWrite() — Adds a ParentID if not available.
public
- ActiveProducts() — Returns the active products for this page.
- BackLink() — Returns the back link
- BackPage() — Returns the back page
- BeforeInsertWidgetAreaContent() — Returns custom content to render before the content widget area, injected by extensions.
- CacheKey() — Returns the cache key for this product group
- CacheKeyParts() — Returns the cache key parts for this product group
- CanonicalLink() — Returns the relative canonical link.
- IsProductGroupPage() — Returns whether this is a ProductGroupPage, so true..
- Link() — builds the ProductPages link according to its custom URL rewriting rule
- LinkingMode() — Overwrites the function LinkingMode in SiteTree Other than the default behavior current should be returned for the product category defined via session. This is neccessary for products that are mirrored into a category.
- OriginalBreadcrumbs() — Returns the pages original breadcrumbs
- OriginalLink() — returns the original page link. This is needed by the breadcrumbs. When a product detail view is requested, the default method self::Link() will return a modified link to the products detail view. This controller handles both (product group views and product detail views), so a product detail view won't have a related parent to show in breadcrumbs. The controller itself will be the parent, so there must be two different links for one controller.
- ShowNewProducts() — Returns whether to show new products or not.
- ShowPreorderableProducts() — Returns whether to show new products or not.
- drawCMSFields() — Indicates wether the CMS Fields should be drawn.
- fieldLabels() — Field labels for display in tables.
- getAfterMetaTitle() — Returns the string to render after the original meta title.
- getBreadcrumbItems() — Adds the product title to the bradcrumbs if the current page is a product detail page.
- getBreadcrumbTitle() — Returns the title including the parent product group titles.
- getCMSFields() — Return all fields of the backend.
- getContextController() — Returns the current context controller.
- getDoNotShowProducts() — Returns the DoNotShowProducts setting.
- getFlatChildPageIDsForPage() — Returns a flat array containing the ID of all child pages of the given page.
- getManufacturers() — Returns all Manufacturers of the groups products.
- getMetaDescription() — Returns the meta description. If not set, it will be generated by it's related products or the single product in detail view
- getMetaTitle() — Returns the meta title. If not set, the meta-title of the single product in detail view or the title of the SiteTree object will be returned
- getMirroredProductIDs() — Returns all Product IDs that have this group set as mirror group.
- getNewProducts() — Returns all new products of this group and all children.
- getNewProductsForTemplate() — Returns the new products in an ArrayData format to use in a template.
- getPaginationContext() — Returns the pagination context.
- getPlainMetaTitle() — Returns the plain meta title.
- getPreorderableProducts() — Returns all pre-orderable products of this group and all children.
- getPreorderableProductsForTemplate() — Returns the pre-orderable products in an ArrayData format to use in a template.
- getProductGroupHolderPage() — Returns the first ProductGroupHolder page.
- getProducts() — All products of this group
- getProductsForced() — All products of this group forced (independent of DoNotShowProducts setting)
- getProductsFromChildren() — Returns the products of all children (recursively) of the current product group page.
- getProductsFromChildrenFilter() — Returns the products of all children (recursively) of the current product group page.
- getProductsFromChildrenList() — Returns the products of all children (recursively) of the current product group page.
- getProductsInherited() — Returns all product of this group and all children.
- getProductsOnPagesString() — Returns a string to display how many products on how many pages are found
- getProductsToDisplay() — Returns the related products or the products of the child product groups.
- getShowNewProducts() — Returns the ShowNewProducts setting.
- getproductGroupsPerPage() — Returns the productGroupsPerPage setting.
- getproductsPerPage() — Returns the productsPerPage setting.
- getuseContentFromParent() — Returns the useContentFromParent setting.
- hasProductCount() — Returns true, when the products count is equal $count
- hasProductsOrChildren() — Checks if ProductGroup has children or products.
- isActive() — Returns whether the actual view is filtered by this manufacturer or not.
- isFirstPage() — Returns whether the current view is the first page of the product list or not
- isInternalUrl() — Returns whether the given url is an internal url
- onBeforeDelete() — Set LastEdited field to now for the ProductGroupHolder.
- plural_name() — Returns the translated plural name of the object. If no translation exists the class name will be returned.
- setPaginationContext() — Sets the pagination context.
- singular_name() — Returns the translated singular name of the object. If no translation exists the class name will be returned.
- updateLastEditedForCache() — Updates the LastEditedForCache property for Stage and Live version.
Inherited from SilverCart\ORM\ExtensibleDataObject
protected
- beforeRequireDefaultRecords() — Allows user code to hook into DataObject::requireDefaultRecords() prior to requireDefaultRecords being called on extensions.
- beforeUpdateCMSActions() — Allows user code to hook into DataObject::getCMSActions prior to updateCMSActions being called on extensions.
- beforeUpdateFieldLabels() — Allows user code to hook into DataObject::fieldLabels() prior to updateFieldLabels being called on extensions.
- beforeUpdateProvidePermissions() — Allows user code to hook into DataObject::updateProvidePermissions() prior to providePermissions being called on extensions.
- scaffoldFieldLabels() — Returns the default field labels for this DataObject.
public
- defaultFieldLabels() — Returns the default field labels.
- reset_field_labels() — Resets the field label cache.