ecomdev / magento2-product-data-preloader

ecomdev/magento2-product-data-preloader

Magento 2 Product Data Pre-Loader FTW

magento2-module Compatibility: 2.4.7-2.4.9 Code Quality: Fail Tests: N/A Security: Pass MIT

Product Data Pre-Loader

Magento platform code and third-party extensions in a lot of cases produce redundant database queries on product collections load.

This module provides an easy way to pre-load data for product collections like prices, stock data, and many more by using different types of load types.
Right now it supports 3 types of loaded product collections:

  • list Products that are using price index in selection, so it is safe to use stale index data for data loader
  • cart Products that are used to calculate customers shopping cart and require accurate data to be loaded from database
  • other Products that are not falling into any of the above categories

In order to pre-load data for a product collection, you need to implement EcomDev\ProductDataPreLoader\DataService\DataLoader interface with such methods:

  • isApplicable(string $type): bool method that is used to decide if your loader compatible with specific product collection type.
  • load(ScopeFilter $filter, ProductWrapper[] $products): array method that preloads data into LoadService that can be used later to access data by your loader id.

Custom loaders should be added to LoadService object via DI configuration like this:

<type name="EcomDev\ProductDataPreLoader\DataService\LoadService">
    <arguments>
        <argument name="loaders" xsi:type="array">
            <item name="my_custom_loader" xsi:type="object">My\Module\Loader\MyCustomLoader</item>
        </argument>
    </arguments>
</type>

Installation

Given EOL of Composer 1 all new packagist packages are not published for some time. So best way to keep your install up-to-date is to use Composer 2.0.

composer require ecomdev/magento2-product-data-preloader

No changelog yet

The vendor hasn't published a changelog. Tagged releases appear in the Versions tab.

Versions
Version Stability QA Status Compatibility Released
1.1.1 stable Fail Magento 2.4.7-2.4.9 Details 2023-02-06 20:13:30
1.1.0 stable Not tested Not yet tested Details 2022-11-21 20:42:43
1.0.0 stable Not tested Not yet tested Details 2021-08-21 21:28:10

Requires 5

Package Constraint
magento/framework *
magento/module-catalog ~103.0|~104.0
magento/module-quote ~101.0
magento/module-customer ~102.0|~103.0
php ~7.2|~8.0

Requires-dev 4

Package Constraint
phpstan/phpstan ^0.12.86
squizlabs/php_codesniffer ^3.6.0
phpunit/phpunit ~9.5
ecomdev/magento2-test-essentials dev-main

Compatibility

Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.

Compatibility matrix (Magento × PHP)
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 Pass Pass
2.4.8 Pass Pass
2.4.9 Pass Pass

Code Quality

Advisory checks against the module's source. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge — a phpcs finding can't make a module incompatible.

Static analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

Static analysis results
Tool Status Findings Summary
PHPCS Warning 28 28 warnings (ruleset: Magento2) — 5 auto-fixable with phpcbf
PHPMD Warning 3 3 rule violations (UnusedFormalParameter:3)
Cpd Pass 0
Composer validate Info 1 valid; 1 advisory note (composer validate --strict)

PHPStan

Type-checks the module's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases. Cell → details modal.

PHPStan results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 2 2
2.4.8 2 2
2.4.9 2 2

Tests

Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.

Unit tests

Unit tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

Integration tests

Integration tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

Security

Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.

Security results
Tool Status Findings Summary
Composer audit Pass 0
Malware scan Pass 0
License
MIT
Make it pay

Turn an existing module into recurring revenue.

If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.