Search by

infrangible / m2-catalog-indexer-flat

infrangible

Building block that lets other Infrangible modules temporarily bypass Magento's flat catalog tables, so exports read complete product and category data.

Package info

github.com/infrangible-dev/m2-catalog-indexer-flat

Homepage

Type:magento2-module

pkg:composer/infrangible/m2-catalog-indexer-flat

Statistics

Installs: 28

Dependents: 1

Suggesters: 0

Stars: 1

Open Issues: 0

2.0.1 2026-11-26 17:35 UTC

This package is auto-updated.

Last update: 2026-11-26 17:39:54 UTC


README

Lets other modules switch off the use of Magento's flat catalog tables for the duration of their own process, without changing the store configuration. The flat tables only contain a selection of attributes, so processes that need complete product or category data, such as the exports of Infrangible Catalog Product Feed, disable them first.

Usage

use Infrangible\CatalogIndexerFlat\Helper\Data as CatalogIndexerFlatHelper;

public function __construct(private CatalogIndexerFlatHelper $catalogIndexerFlatHelper)
{
}

public function execute(): void
{
    $this->catalogIndexerFlatHelper->disableProductFlatIndexer();

    try {
        // product collections created here read the EAV tables
    } finally {
        $this->catalogIndexerFlatHelper->removeDisableProductFlatIndexer();
    }
}
Method Effect
disableProductFlatIndexer() / removeDisableProductFlatIndexer() disables or enables the flat tables of products
disableCategoryFlatIndexer() / removeDisableCategoryFlatIndexer() disables or enables the flat tables of categories
isProductFlatIndexerDisabled() / isCategoryFlatIndexerDisabled() whether the flat tables are disabled by this module

While the flat tables are disabled, Magento's flat states report them as not enabled in the current PHP process, so collections created after the call read the EAV tables. Collections created before keep their state. The setting applies only to the current process: the storefront and other processes continue to use the flat tables if they are enabled in the configuration.

Requirements

  • Magento Open Source or Adobe Commerce 2.4.6 or newer
  • PHP 8.1 or newer

Installation

composer require infrangible/m2-catalog-indexer-flat
bin/magento module:enable Infrangible_CatalogIndexerFlat
bin/magento setup:upgrade

In production mode, also run bin/magento setup:di:compile.

License

Infrangible Catalog Indexer Flat is licensed under the MIT License - see the LICENSE file for details.