Log in
Collection

Product\Collection

Magento\Catalog\Model\ResourceModel\Product\Collection

What it does

The Product Collection class is used to retrieve and filter product data from the database in Magento 2.

Developers use this collection to load products with specific attributes, apply filters (like category, price, visibility), sort results, and optimize queries with joins for pricing, categories, and URLs.

It's the primary way to work with multiple products programmatically, whether for display on frontend pages, API responses, or custom business logic.

Public Methods

  • _resetState()
  • getCatalogPreparedSelect()
  • getPriceExpression()
  • getAdditionalPriceExpression()
  • getCurrencyRate()
  • getFlatState()
  • isEnabledFlat()
  • getNewEmptyItem()
  • setEntity()
  • setStore()
  • _loadAttributes()
  • addAttributeToSelect()
  • addIdFilter()
  • addWebsiteNamesToResult()
  • load()
  • addStoreFilter()
  • addWebsiteFilter()
  • getLimitationFilters()
  • addCategoryFilter()
  • addCategoriesFilter()
  • joinMinimalPrice()
  • getMaxAttributeValue()
  • getAttributeValueCountByRange()
  • getAttributeValueCount()
  • getAllAttributeValues()
  • getSelectCountSql()
  • getAllIds()
  • getProductCountSelect()
  • unsProductCountSelect()
  • addCountToCategories()
  • getSetIds()
  • getProductTypeIds()
  • joinUrlRewrite()
  • addUrlRewrite()
  • addMinimalPrice()
  • addFinalPrice()
  • getAllIdsCache()
  • setAllIdsCache()
  • addPriceData()
  • addAttributeToFilter()
  • addTaxPercents()
  • requireTaxPercent()
  • addOptionsToResult()
  • addFilterByRequiredOptions()
  • setVisibility()
  • addAttributeToSort()
  • applyFrontendPriceLimitations()
  • addCategoryIds()
  • addTierPriceData()
  • addTierPriceDataByGroupId()
  • addPriceDataFieldFilter()
  • addMediaGalleryData()
  • getProductEntityMetadata()
  • clear()
  • setOrder()
  • getMaxPrice()
  • getMinPrice()
  • getPriceStandardDeviation()
  • getPricesCount()