Sunnysideup\Ecommerce\ProductsAndGroups\Builders\BaseProductList
The starting base of the Products.
This is basically a list of products for a product group where we take into consider:
a. sub-groups
b. default filters (e.g. only show if AllowPurchase is true)
Most of the time, you do not need to use this class at all, because the FinalProductList class
creates it for you and a FinalProductList is basically like this list but then ready to apply filters and sorts.
That is, a BaseProduct List CAN NOT BE CHANGE
A final Product list is ALWAYS filtered and sorted.
- Author: : Nicolaas [at] Sunny Side Up .co.nz
Synopsis
class BaseProductList
extends AbstractProductsAndGroupsList
{
- // members
- protected static array $singleton_caches = ;
- protected string $buyableClassName = '';
- protected integer $levelOfProductsToShow = 0;
- protected string $searchString = '';
- protected string $cacheKey = '';
- protected RelatedProductGroups $productGroupListProvider;
- protected array $blockedProductsIds = ;
- protected array $alsoShowProductsIds = ;
- protected array $parentGroupIds = ;
- protected array $alsoShowParentIds = ;
- protected array $filterForCandidateCategoryIds = ;
- protected static array $excluded_products = ;
- protected static array $checked_products = ;
- private static array' $default_product_filter = ;
- private static array $group_filter_candidates_sort = ;
- // Inherited members from AbstractProductsAndGroupsList
- protected DataList $products;
- protected ProductGroup $rootGroup;
- // methods
- public void __construct()
- public void init()
- public static void apply_default_filter_to_products()
- public static void inst()
- public void generateCacheKey()
- public void setBuyableClassName()
- public void getBuyableClassName()
- public void getShowProductLevelsArray()
- public void setLevelOfProductsToShow()
- public void setSearchString()
- public void getLevelOfProductsToShow()
- public void getAlsoShowProductsIds()
- public void getAlsoShowProducts()
- public void getFilterForCandidateCategoryIds()
- public void getFilterForCandidateCategories()
- public void getParentGroupIds()
- public void getParentGroups()
- public void getAlsoShowParentIds()
- public void getAlsoShowParents()
- public SS_List getGroups()
- public RelatedProductGroups getProductGroupListProvider()
- public void getExcludedProducts()
- public void getBlockedProductIds()
- public void setCacheKey()
- protected void buildDefaultList()
- protected void applyDefaultFilters()
- protected void applyGroupOrSearchFilter()
- protected void applySearchFilter()
- protected void applyGroupFilterInner()
- protected void removeExcludedProducts()
- protected void hasCache()
- protected void loadCache()
- protected void storeInCache()
- protected void getCachekey()
- // Inherited methods from AbstractProductsAndGroupsList
- public final void setRootGroup()
- public final void setProducts()
- public final ProductGroup getRootGroup()
- public final SS_List getProducts()
- public final void getProductIds()
- public final void getRawCount()
- public final void hasMoreThanOne()
- public final void getDirectProducts()
- public final void getDirectProductsExclusingAlsoShow()
- public final void getDirectProductsWithAlsoShow()
- public final void getAlsoShowProductsFromRootGroupExclusive()
- public final void getChildProductsInclusive()
- public final void getChildProductsExclusive()
- public abstract void getAlsoShowProductsIds()
- public abstract void getAlsoShowProducts()
- public final void getAlsoShowProductsExclusive()
- public abstract void getFilterForCandidateCategoryIds()
- public abstract void getFilterForCandidateCategories()
- public final void getParentGroupIdsBasedOnProducts()
- public final void getParentGroupsBasedOnProducts()
- public final void getParentGroupsBasedOnProductsExcludingRootGroup()
- public final void getDirectParentGroupsInclusive()
- public final void getDirectParentGroupsExclusive()
- public abstract void getParentGroupIds()
- public abstract void getParentGroups()
- public final void getParentGroupsExclusive()
- public abstract void getAlsoShowParentIds()
- public abstract void getAlsoShowParents()
- public final void getAlsoShowProductsProductGroupInclusive()
- public final void getAlsoShowProductsProductGroupsExclusive()
- public void getApplyerClassName()
- public BaseApplyer getApplyer()
- protected ProductGroupSchema getProductGroupSchema()
- protected final void getBuyableTableNameName()
- protected string getStage()
- protected void turnIdListIntoProductGroups()
Hierarchy
Tasks
Line | Task |
---|---|
96+ | : EcommerceCache candidate |
111+ | : EcommerceCache candidate |
191+ | : EcommerceCache candidate |
213+ | : EcommerceCache candidate |
224+ | : EcommerceCache candidate |
288+ | : EcommerceCache candidate |
319+ | : EcommerceCache candidate |
Members
private
- $default_product_filter
—
Sunnysideup\Ecommerce\ProductsAndGroups\Builders\array'
default filter for products: show in search and allow purchase are recommended. - $group_filter_candidates_sort
protected
- $alsoShowParentIds — array
- $alsoShowProductsIds — array
- $blockedProductsIds
—
array
A list of relevant buyables that can not be purchased and therefore should be excluded. - $buyableClassName — string
- $cacheKey — string
- $checked_products — array
- $excluded_products — array
- $filterForCandidateCategoryIds — array
- $levelOfProductsToShow — int
- $parentGroupIds — array
- $productGroupListProvider — Sunnysideup\Ecommerce\ProductsAndGroups\Builders\RelatedProductGroups
- $products — SilverStripe\ORM\DataList
- $rootGroup — Sunnysideup\Ecommerce\Pages\ProductGroup
- $searchString — string
- $singleton_caches
—
array
keep the lists in memory.
Methods
protected
- applyDefaultFilters() — add default filters.
- applyGroupFilterInner()
- applyGroupOrSearchFilter() — apply group filters to products.
- applySearchFilter()
- buildDefaultList() — create a starting point.
- getCachekey()
- hasCache() — is there a cache available?
- loadCache() — loads the following variables: - products - blockedProductsIds - blockedProductsIds - alsoShowProductsIds - parentGroupIds.
- removeExcludedProducts() — Generate Excluded products that can not be purchased.
- storeInCache() — sets the following variables: - products - blockedProductsIds - alsoShowProductsIds - parentGroupIds.
public
- __construct()
- apply_default_filter_to_products()
- generateCacheKey()
- getAlsoShowParentIds()
- getAlsoShowParents()
- getAlsoShowProducts()
- getAlsoShowProductsIds()
- getBlockedProductIds()
- getBuyableClassName()
- getExcludedProducts()
- getFilterForCandidateCategories()
- getFilterForCandidateCategoryIds()
- getGroups() — Returns children ProductGroup pages of this group.
- getLevelOfProductsToShow() — how many children, grand-children, etc.. levels do we provide?
- getParentGroupIds()
- getParentGroups()
- getProductGroupListProvider() — Returns a list of {@link RelatedProductGroups}.
- getShowProductLevelsArray()
- init()
- inst()
- setBuyableClassName() — Override the class of buyable to display. Usually this is limited to `Product` but can be tailored to display specific subclasses.
- setCacheKey()
- setLevelOfProductsToShow()
- setSearchString()
Inherited from Sunnysideup\Ecommerce\ProductsAndGroups\Builders\AbstractProductsAndGroupsList
protected
- getBuyableTableNameName()
- getProductGroupSchema()
- getStage() — Returns a versioned record stage table suffix (i.e "" or "_Live").
- turnIdListIntoProductGroups()
public
- getAlsoShowParentIds()
- getAlsoShowParents()
- getAlsoShowProducts()
- getAlsoShowProductsExclusive() — like getAlsoShowProductsInclusive, but then without the Children from all groups i.e. exclude ones that have one of the groups as Parent.
- getAlsoShowProductsFromRootGroupExclusive()
- getAlsoShowProductsIds()
- getAlsoShowProductsProductGroupInclusive() — List of All Also Show Product Parents Excluding the Root Group INCLUDING any other Direct Parent Groups.
- getAlsoShowProductsProductGroupsExclusive() — List of All Also Show Product Parents Excluding the Root Group AND EXCLUDING any Parent Groups.
- getApplyer()
- getApplyerClassName()
- getChildProductsExclusive() — child products (including indirect children, but also show excluded).
- getChildProductsInclusive() — child products (including indirect children).
- getDirectParentGroupsExclusive() — With the current product list, return all the {@link ProductGroup} instances that the products are displayed under. This only returns the direct parents.
- getDirectParentGroupsInclusive() — This is the inverse of ProductGroupsFromAlsoShowProducts.
- getDirectProducts()
- getDirectProductsExclusingAlsoShow()
- getDirectProductsWithAlsoShow()
- getFilterForCandidateCategories()
- getFilterForCandidateCategoryIds()
- getParentGroupIds() — ids for getParentGroups.
- getParentGroupIdsBasedOnProducts()
- getParentGroups() — parent groups that come from the natural hierarchy the baselist knows about these.
- getParentGroupsBasedOnProducts() — KEY METHOD!
- getParentGroupsBasedOnProductsExcludingRootGroup() — Given the products for this page, retrieve the parent groups excluding the current one.
- getParentGroupsExclusive() — hierarchy parent groups excluding any parent groups that are included in AlsoShow.
- getProductIds() — IDs of all the products.
- getProducts() — Key Method! Returns a raw list of all the matching products without any pagination.
- getRawCount() — Returns the total number of products available before pagination is applied.
- getRootGroup()
- hasMoreThanOne() — Is there more than x products.
- setProducts() — Key Method! Returns a raw list of all the matching products without any pagination.
- setRootGroup() — Set the root {@link ProductGroup} to display the products from.