Skip to main content

MixListPage

This mixin provides all the functionality for the list page data in an e-commerce application. It includes properties such as the type of list page, Graphql for the listPageInfo query, and base filters for the page. The mixin also includes methods for load more, load previous, sort change, and filter change, along with computed properties for the current selection, filter selection, and query parameters for the product list. Additionally, the mixin has several computed properties that determine the type of list page and the number of active filters.

The mixin is designed to be used with a Graphql based e-commerce application and provides a comprehensive set of tools to manage the data and behavior of the list page. Whether you're building a product list for a category, brand, or search result, this mixin has you covered.

All functionality for the list page Data:

  • isInitialRequest: true
  • initVariables: {}
  • baseFilters: {}
  • userSkip: 0
  • sort: vm.$config.productListDefaultSort
  • defaultSort: vm.$config.productListDefaultSort
  • listInfo: null
  • filters: {}
  • userSelection: null
  • filterParamQuery: {}
  • skipProductsQuery: false
  • relocateTimeout: null
  • URLparamsRead: false
  • filtersSet: false
  • userHasPaged: false
  • productsFetched: false

Props

NameDescriptionTypeRequiredDefault
typeType of list page'category', 'brand', 'search', 'favorites', 'all'false-
infoQueryGraphql for the listPageInfo queryObjecttrue-
currentAliasCurrent alias for the pageStringfalse-
currentPathCurrent url path for the pageStringfalse-
filtersVarsBase filters for this pageObjectfalse{}
implicitFacetsAutomatically applied parameters, added through routing. Can be used for section style routing. See Ekotextil for implementation example.Arrayfalse[]
excludeFacetsExclude facets by facet idsArrayfalse[]

Methods

MethodDescriptionParameters
loadMoreLoad next chunk of products-
loadPrevLoad previous chunk of products-
getScrollHeightGet the current scroll height of the page, used to keep scroll in the right position while loading previous products-
sortChangeHandlerUpdate the sort settingnew value (String)
filterChangeHandlerUpdate the filter selectionsnew value (Object)
resetFiltersResetting the filter selections-
resetCurrentPageReset paging state-
pushURLParamsSet filter selection in URL-
setPagingStateSets current page from URL or saved state-
initProductListRun to init the product list-
relocateProductRunned to relocate product on page after back navigating-
setupUserSelectionSetting up the current user selection from store-
setupFiltersSetting up all filtersfilters (Object)
updateFiltersUpdating all filtersfilters (Object)
setNewCountUsed to set new count of filtersbase filters (Array), new filters (Array)
getSortedFiltersSorting all filters into groupsfilters (Object)
getReadableParamsSetting up params for filter in URLfilter selection (Array)
switchToCanonicalOr404Switching to canonical url if different from route path-
handleFilteredRoutesRoutingControls routing between filtered paths on the same category/brand etc-

Computed

ComputedTypeDescriptionFrom Store
isNostoRequestBooleanCondition to skip nosto requestNo
skipNumberCurrent number of products to skip when queryingNo
filterURLparamsObjectReturns the filter object used to query products based on filtersNo
modifierStringThe modifer class for the list pageNo
isListBooleanIs this list page of type list?No
isCategoryBooleanIs this list page of type category?No
isBrandBooleanIs this list page of type brand?No
isCampaignBooleanIs this list page of type discountCampaign?No
isSearchBooleanIs this list page of type search?No
isAllBooleanIs this list page of type all?No
selectionObjectCurrent selectionNo
productsQueryFilterObjectReturns the filter object for the productsQueryVarsNo
totalFiltersActiveNumberNumber of total filters activeNo
filterSelectionActiveBooleanIs a filter selection made?No
nostoQueryVarsObjectReturns the variable object with the query parameters for the nosto product listNo
productsQueryVarsObjectReturns the variable object with the query parameters for the product listNo
loadMoreQueryVarsObjectReturns the variable object for loading more productsNo
loadPrevQueryVarsObjectReturns the variable object for loading previous productsNo
skeletonProductsArrayReturns an array of empty objects with same lengt as pageSizeNo
widgetAreaFiltersArrayReturns array of widget filtersNo
breadcrumbsCurrentObjectCurrent bredcrumb infoNo
showControlsBooleanShow filters and other controlsNo

MixIns

MixIn
MixMetaReplacement
MixListPagination
MixApolloRefetch