Magento Series: Working with Categories

Categories are where your products live. They are important because they are the main tool buyers use to navigate the Product List Page (PLP), and they systematize the store for the convenience of customers. Learn how to work with Magento (Adobe Commerce) categories in this quick read.

Where to find the category structure of the catalog in Magento

You can find Category information under the Catalog section in the admin panel.

To see a category tree on the Admin sidebar, go to Catalog > Categories.

Category tree

For the category to really be unique and describe the products most closely to reality, an extended category setting is required.

How to add a CMS block to the category page

Page elements are mostly blocks that can be easily managed. These blocks—generally referred to as content blocks, static blocks, or CMS blocks—are modular units that can display fixed (text, images, video) or dynamic information (using widgets) and be placed almost anywhere on a page.

To add content blocks to a category page, follow these steps:

  1. On the Admin sidebar, go to Catalog > Categories.
  2. In the category tree, select the category that you want to edit.
  3. Expand the Content section.
  4. For Add the CMS block, select a block you want to add.
  5. Expand the Display Settings section.
  6. Set the Display Mode to one of the following:
    • Static block only
    • Static block and products
  7. When complete, click Save and review the block display on the storefront (requires cache refresh).

How to set the category permissions

Category access can be limited to specific customer groups or restricted entirely. Category Permissions is not enabled by default, and changing its settings will have a global effect on categories. You can control which customer groups can browse the categories, view product prices, and add items to the cart.

To edit Category Permissions, follow these steps:

  1. Expand the Category Permissions section.
  2. For a multi-site installation, choose the Website where the category permissions apply.
  3. Choose the Customer Group where the category permissions apply.
    • If needed, you can choose a Shared Catalog instead.
  4. Set the following permissions as needed:
    • Browsing Category
    • Display Product Prices
    • Add to Cart
  5. To add another permission rule, click New Permission and repeat the process.
Category permissions

Where the category data is stored in the database

Once a category is created from the Magento (Adobe Commerce) admin panel, the created category data will be inserted into the catalog_category_entity table in Magento.

A complete list of the columns placed within the catalog_category_entity table can be seen below:

entity_idThe unique ID of the entity
attribute_set_idThe ID of the attribute set
parent_idThe ID of the parent category
created_atThe date the category was created
updated_atThe date the category was last updated
pathThe path of the categories used with category IDs separated by a “/” (e.g., 1/2/3)
positionThe position of the category within its level in the tree structure
children_countThe number of children categories that the category contains
levelThe hierarchy level that the category belongs to

Levels:
level 0 – global top-level category; not visible in any way on either FE or BE
level 1 – top-level “root” category of a specific store; different stores can have different root categories
level 2 – top-level categories for a specific store; usually visible in the menu on FE, etc.

As the catalog_category is an EAV entity, there are, of course, other tables, such as catalog_category_entity_text, catalog_category_entity_varchar, etc.

Path, level, parent_id, children_count are all system fields that get automatically defined or updated on category save.

How to make a migration patch to create or edit a category programmatically

Products are created programmatically with migration patches. A patch can create or update products when setup:upgrade is run and on deployment. We use migration patches so that the changes to the database are executed in all environments, including everyone’s local environments.

Need help with Magento (Adobe Commerce) development? scandiweb is the largest certified Magento developer team in the world. Ask us how you can get a dedicated eCommerce team and get the hassle out of web development, design, and the whole eCommerce optimization process. Or send us a message about your specific needs.

If you enjoyed this post, you may also like