Log in
Model

Category

Magento\Catalog\Model\Category

What it does

The Category model represents a product category in Magento 2's catalog system.

Developers use this class to retrieve, create, update, and manage category data including hierarchy (parent/child relationships), URLs, products, display settings, and store assignments.

It handles category-specific operations like moving categories in the tree, getting product collections, managing anchors, and triggering reindexing.

Public Methods

  • getUseFlatResource()
  • getUrlInstance()
  • getTreeModel()
  • getTreeModelInstance()
  • move()
  • getDefaultAttributeSetId()
  • getProductCollection()
  • getAttributes()
  • getProductsPosition()
  • getStoreIds()
  • getStoreId()
  • setStoreId()
  • getUrl()
  • getCategoryIdUrl()
  • formatUrlKey()
  • getImageUrl()
  • getParentCategory()
  • getParentId()
  • getParentIds()
  • getCustomDesignDate()
  • getDesignAttributes()
  • getAllChildren()
  • getChildren()
  • getPathInStore()
  • checkId()
  • getPathIds()
  • getLevel()
  • verifyIds()
  • hasChildren()
  • getRequestPath()
  • getName()
  • beforeDelete()
  • getAnchorsAbove()
  • getProductCount()
  • getCategories()
  • getParentCategories()
  • getChildrenCategories()
  • getParentDesignCategory()
  • isInRootCategoryList()
  • getAvailableSortBy()
  • getAvailableSortByOptions()
  • getDefaultSortBy()
  • validate()
  • afterSave()
  • getCacheTags()
  • reindex()
  • afterDeleteCommit()
  • getIdentities()
  • getPath()
  • getPosition()
  • getChildrenCount()
  • getCreatedAt()
  • getUpdatedAt()
  • getIsActive()
  • getCategoryId()
  • getDisplayMode()
  • getIncludeInMenu()
  • getUrlKey()
  • getChildrenData()
  • __toArray()
  • toFlatArray()
  • setParentId()
  • setName()
  • setIsActive()
  • setPosition()
  • setLevel()
  • setUpdatedAt()
  • setCreatedAt()
  • setPath()
  • setAvailableSortBy()
  • setIncludeInMenu()
  • setProductCount()
  • setChildrenData()
  • getExtensionAttributes()
  • setExtensionAttributes()