Log in
Collection

Category\Collection

Magento\Catalog\Model\ResourceModel\Category\Collection

What it does

This collection class retrieves and manages groups of category entities from the database in Magento 2.

Developers use it to load categories with various filters (by ID, level, path, active status), join URL rewrites, and optionally calculate product counts for each category.

It's commonly used in catalog navigation, category trees, and anywhere multiple categories need to be fetched with specific criteria.

Public Methods

  • _resetState()
  • addIdFilter()
  • setLoadProductCount()
  • setProductStoreId()
  • getProductStoreId()
  • load()
  • loadProductCount()
  • addPathFilter()
  • joinUrlRewrite()
  • addIsActiveFilter()
  • addNameToResult()
  • addUrlRewriteToResult()
  • addPathsFilter()
  • addLevelFilter()
  • addRootLevelFilter()
  • addNavigationMaxDepthFilter()
  • addOrderField()
  • getProductWebsiteTable()
  • getProductTable()