How to Use Flat Catalog in Magento 2? (10 Minutes)

how to use flat catalog in magento 2

Magento 2’s Flat Catalog is a feature that dynamically creates tables, neatly organizing product attributes into rows of data. These tables are updated automatically, and with optimized indexing, they not only speed up catalog processing but also make cart price rule execution lightning-fast.

In this guide, we’ll teach you how to use Magento 2’s Flat Catalog in detail. Say goodbye to complex SQL queries and hello to a more efficient, responsive, and agile online store.

What is The Flat Catalog in Magento 2?

As you might know, there are 2 data models in Magento 2, namely EAV Catalog and Flat Catalog.

  • EAV Catalog: On one hand, the EAV Catalog is an entity attribute value database model. Every column data value is stored in its corresponding data type table. Moreover, the EAV Catalog allows us to add as many custom attributes as possible. However, the thing is that since the product attributes are stored in various tables, so as to get the data it will take a lot of time as well as trigger many actions. As the result, it might affect negatively your store performance.
  • Flat Catalog: The Flat Catalog, on the other hand, has to use only one table. More specifically, it will take all product attributes in a multi-column table and be updated automatically based on your cron job.

Advantages of using Flat Catalog: Enhancing the speed of catalog and cart price rules process. In other words, it will contribute to boosting your performance.

Note: Magento now advises against using the flat catalog as a best practice. Continuing to use this feature can lead to performance issues and indexing problems.

How to Enable A Flat Catalog in Magento 2

Step 1: Navigate to The Catalog

Go to the Admin Panel, navigate to STORES, and choose Configuration (under Settings)

(Admin Panel => STORES => Configuration)

flat catalog magento 2

On the left panel, please tap CATALOG and select Catalog in the dropdown.

use flat catalog in magento 2

Step 2: Enable Flat Catalog

Firstly, you must expand the Storefront section.

Secondly, uncheck the box Use system value next to the Use Flat Catalog Category and set it to Yes.

Thirdly, you must also set the Use Flat Catalog Product to Yes.

magento 2 flat catalog

Finally, save the config after you finish.

Step 3: Refresh Cache

There will be a message that requests you to refresh the cache.

How to Check The Results on The Frontend

There are 2 methods to see the results, one for a single product and the other for multiple products. We will show you both of them.

Checking the results for the single product

Go to the Admin Panel, navigate to PRODUCTS and choose Catalog (under Inventory)

(Admin Panel => PRODUCTS => Category)

enable flat catalog in magento 2
set up flat catalog magento 2

Choose a product you want to edit (double-click on it or click on the Edit button).

Add the tail “_DEMO” to the product name as the following and then save it.

Now, you can access your homepage, search for the product you have edited as well as browse that item through the navigation menu to make a comparison.

Checking the results for multiple products

Go to the Admin Panel, navigate to PRODUCTS, and choose Categories (under Inventory)

(Admin Panel => PRODUCTS => Categories)

flat catalog in magento 2

Next, in the category tree on the left, choose any category, then click on the Add Subcategory button. After that, set the category name (e.g.: Test).

set up flat catalog in magento 2

To continue, let’s expand the Products in the Category section, and check on the product(s) you want to add to the new category. Finally, save the new category.

Once again, to see the result, you must come back to your homepage and search for the new category in the navigation menu.

We have shown you the basic definition of the flat catalog in Magento 2 and more importantly, how to set up and check its results on your storefront. If you have any problems when following this tutorial, be free to ask us by leaving a comment below. See you in the next tutorial!

See More Our Magento “How To” Series:

Magento 2 Product Types: Everything Merchants Should Know

How To Config RSS Feeds In Magento 2

How To Create And Manage Newsletters In Magento 2

How To Create And Manage Coupon Codes In Magento 2

How To Create New Cart Price Rules In Magento 2

How To Create New Catalog Price Rule In Magento 2

Leave a Reply

Your email address will not be published. Required fields are marked *