infrangible / m2-catalog-indexer-flat
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
Type:magento2-module
pkg:composer/infrangible/m2-catalog-indexer-flat
Requires
- php: >=8.1
- infrangible/m2-foundation: ~3.0.1
- magento/framework: ~103.0.6
- magento/module-catalog: ~104.0.0
Requires (Dev)
- infrangible/phpstan-magento: ~1.2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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.