SilverCart\Model\Pages\ProductGroupPageController
ProductGroupPage Controller class.
This controller handles the actions for product group views and product detail
views.
- Author: Sebastian Diel <sdiel@pixeltricks.de>
- Copyright: 2017 pixeltricks GmbH
- License: see license file in modules root directory
Synopsis
class ProductGroupPageController
extends PageController
{
- // members
- protected integer $totalNumberOfProducts = 0;
- public static array $registeredFilterPlugins = ;
- protected array $groupProducts = ;
- protected Product|null $detailViewProduct = NULL;
- protected array $listFilters = ;
- protected integer $SQL_start = 0;
- protected array $widgetOutput = ;
- public bool $forceLoadOfWidgets = true;
- protected PaginatedList|null $viewableChildren = NULL;
- protected array $productDetailViewParams = ;
- protected array $sqlOffsets = ;
- private static array $allowed_actions = ;
- protected Product $product = NULL;
- protected ArrayList $sortableFrontendFields = NULL;
- protected $currentSortableFrontendFieldLabel = NULL;
- // methods
- public bool canRegisterFilterPlugin()
- public string CacheKeyProductGroupPageControls()
- public static void registerFilterPlugin()
- protected void init()
- public ProductGroupPageSelectorsForm ProductGroupPageSelectorsForm()
- public int getTotalNumberOfProducts()
- public ProductGroupPageController setTotalNumberOfProducts()
- public ProductGroupPageController addTotalNumberOfProducts()
- public DBHTMLText getSubNavigation()
- public ProductGroupPage getTopProductGroup()
- public string OriginalLink()
- public int CurrentOffset()
- public DataList getProductsForced()
- public PaginatedList getProducts()
- public array CacheKeyParts()
- public string CacheKey()
- public array getGroupProducts()
- public void setGroupProducts()
- public DataList getRandomProducts()
- public int getProductsPerPageSetting()
- public static void setProductsPerPage()
- public static int|null getProductsPerPage()
- public ArrayList getSortableFrontendFields()
- public string getCurrentSortableFrontendFieldLabel()
- public int getSqlOffset()
- public PaginatedList getViewableChildren()
- public bool HasMoreViewableChildrenThan()
- public int getSqlOffsetForProductGroups()
- public bool HasMorePagesThan()
- public bool HasMoreProductsThan()
- public bool HasLessProductsThan()
- public DBHTMLText getPageContent()
- public DBHTMLText detail()
- public HTTPResponse chsffopt()
- public HTTPResponse chpppopt()
- public Product getProduct()
- public ProductGroupPageController setProduct()
- public HTTPResponse handleRequest()
- public mixed handleAction()
- public boolean hasAction()
- public bool checkAccessAction()
- public SSViewer getViewer()
- public ViewableData_Customised customise()
- protected string ProductDetailView()
- protected void ProductDetailViewParams()
- public bool isProductDetailView()
- public Product getDetailViewProduct()
- public string getListFilters()
- protected string DetailViewProductMetaTags()
- protected string|false DetailViewProductMetaTitle()
- public bool isFiltered()
- public bool isFilteredByPlugin()
- public bool isFilteredByManufacturer()
- public void addListFilter()
- public boolean isFirstPage()
- public ArrayList getInjectedProducts()
Hierarchy
Extends
- PageController
Members
private
- $allowed_actions
—
array
List of allowed actions.
protected
- $SQL_start
—
int
Used for offset calculation of the SQL query that retrieves the products for this page. - $currentSortableFrontendFieldLabel
—
string
Current sortable frontend field label. - $detailViewProduct
—
SilverCart\Model\Pages\Product|null
Contains the Product object that is used for the detail view or null. Used for caching. - $groupProducts
—
array
Contains a DataList of products for this page or null. Used for caching. - $listFilters
—
array
Contains filters for the SQL query that retrieves the products for this page. - $product
—
SilverCart\Model\Product\Product
Detail product to show - $productDetailViewParams
—
array
Product detail view parameters - $sortableFrontendFields
—
SilverStripe\ORM\ArrayList
Sortable frontend fields as ArrayList. - $sqlOffsets
—
array
Current SQL offset - $totalNumberOfProducts
—
int
Contains the total number of products for this page. - $viewableChildren
—
SilverCart\Model\Pages\PaginatedList|null
Contains the viewable children of this page for caching purposes. - $widgetOutput
—
array
Contains the output of all WidgetSets of the parent page
public
- $forceLoadOfWidgets
—
SilverCart\Model\Pages\bool
Makes widgets of parent pages load when subpages don't have any attributed. - $registeredFilterPlugins
—
array
Contains a list of all registered filter plugins.
Methods
protected
- DetailViewProductMetaTags() — Because of a url rule defined for this page type in the _config.php, the function MetaTags does not work anymore.
- DetailViewProductMetaTitle() — for SEO reasons this pages attribute MetaTitle gets overwritten with the products MetaTitle Remember: search engines evaluate 64 characters of the MetaTitle only
- ProductDetailView() — renders a product detail view template (if requested)
- ProductDetailViewParams() — renders a product detail view template (if requested)
- init() — execute these statements on object call
public
- CacheKey() — Returns the cache key for this product group
- CacheKeyParts() — Returns the cache key parts for this product group
- CacheKeyProductGroupPageControls() — Returns the cache key for the product group page list view.
- CurrentOffset() — Returns the offset of the current page for pagination.
- HasLessProductsThan() — Indicates wether the resultset of the product query returns less products than the number given (defaults to 10).
- HasMorePagesThan() — Indicates wether the resultset of the product query returns more items than the number given (defaults to 10).
- HasMoreProductsThan() — Indicates wether the resultset of the product query returns more products than the number given (defaults to 10).
- HasMoreViewableChildrenThan() — Indicates wether there are more viewable product groups than the given number.
- 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.
- ProductGroupPageSelectorsForm() — Returns the ProductGroupPageSelectorsForm.
- addListFilter() — Adds a filter to filter the groups product list.
- addTotalNumberOfProducts() — Adds the given number to the total number of products for the current controller.
- canRegisterFilterPlugin() — Indicates wether a filter plugin can be registered for the current view.
- checkAccessAction() — Overwrites access handling if a product detail view is called.
- chpppopt() — chpppopt stands for "CHange Products Per Page Option".
- chsffopt() — chsffopt stands for "CHange Sortable Frontend Field Option".
- customise() — Merge some arbitrary data in with this object. This method returns a {@link ViewableData_Customised} instance with references to both this and the new custom data.
- detail() — Action to show a product detail page.
- getCurrentSortableFrontendFieldLabel() — Returns the current sortable frontend field label.
- getDetailViewProduct() — returns the chosen product when requesting a product detail view.
- getGroupProducts() — Returns the products (all or by the given hash key)
- getInjectedProducts() — Returns injected products
- getListFilters() — Returns the SQL filter statement for the current query.
- getPageContent() — Returns $Content of the page. If it's empty and the option is set to use the content of a parent page we try to find the first parent page with content and deliver that.
- getProduct() — Returns the detail product to show
- getProducts() — All products of this group
- getProductsForced() — All products of this group forced (independent of DoNotShowProducts setting)
- getProductsPerPage() — Returns the products per page count.
- getProductsPerPageSetting() — Returns the number of products per page according to where it is set.
- getRandomProducts() — All products of this group
- getSortableFrontendFields() — Returns the sortable frontend fields as ArrayList.
- getSqlOffset() — Return the start value for the limit part of the sql query that retrieves the product list for the current product group page.
- getSqlOffsetForProductGroups() — Return the start value for the limit part of the sql query that retrieves the product group list for the current product group page.
- getTopProductGroup() — returns the top product group (first product group under ProductGroupHolder)
- getTotalNumberOfProducts() — Returns the total number of products for the current controller.
- getViewableChildren() — All viewable product groups of this group.
- getViewer() — Return an SSViewer object to process the data Manipulates the SSViewer in case of a product detail view.
- handleAction() — handles the requested action.
- handleRequest() — Workaround to be able to access the current HTTPRequest in self::getDetailViewProduct().
- hasAction() — Overwrites checking for an existing action if a product detail view is called.
- isFiltered() — Checks whether the product list filtered by any filter plugin or by manufacturer.
- isFilteredByManufacturer() — Checks whether the product list should be filtered by manufacturer.
- isFilteredByPlugin() — Checks whether the product list is filtered by any filter plugin.
- isFirstPage() — Returns whether the current view is the first page of the product list or not
- isProductDetailView() — checks whether the requested view is an product detail view or a product group view.
- registerFilterPlugin() — Registers an object as a filter plugin. Before getting the result set the method 'filter' is called on the plugin. It has to return an array with filters to deploy on the query.
- setGroupProducts() — Sets the products (all or by the given hash key)
- setProduct() — Sets the detail product to show
- setProductsPerPage() — Sets the products per page count.
- setTotalNumberOfProducts() — Set the total number of products for the current controller.