Download the PHP package ecomdev/magento2-product-data-preloader without Composer
On this page you can find all versions of the php package ecomdev/magento2-product-data-preloader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ecomdev/magento2-product-data-preloader
More information about ecomdev/magento2-product-data-preloader
Files in ecomdev/magento2-product-data-preloader
Package magento2-product-data-preloader
Short Description Magento 2 Product Data Pre-Loader FTW
License MIT
Informations about the package magento2-product-data-preloader
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 loadercart
Products that are used to calculate customers shopping cart and require accurate data to be loaded from databaseother
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 intoLoadService
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:
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.
Usage Example
This sample module implements optimistic preloader for configurable product data without taking into account simple product status for:
- Price of configurable product on product list
- Stock availability from MSI for configurable product
- Minimal tier price across simple products for configurable
All versions of magento2-product-data-preloader with dependencies
magento/module-catalog Version ~103.0|~104.0
magento/module-quote Version ~101.0
magento/module-customer Version ~102.0|~103.0
php Version ~7.2|~8.0