Closed
Description
Magneto 2.3.x
Preconditions (*)
- Render product listing
Proposal to optimize or replace getUsedProductCollection
in call
\Magento\ConfigurableProduct\Model\Product\Type\Configurable::isSalable
since it can affect performance
e.g. create alias for getUsedProductCollection
-> getLinkedProductCollection
and use this method in isSalable
additionally store its result to prevent multiple DB calls.
Steps to reproduce (*)
- Render prices on product listing
- Check if product is saleable
Expected result (*)
- plugin
\Magento\Swatches\Model\Plugin\Configurable::afterGetUsedProductCollection
is not called afterisSaleable
call \Magento\ConfigurableProduct\Model\Product\Type\Configurable::isSalable
stores result since it can be called twice
Actual result (*)
- plugin
\Magento\Swatches\Model\Plugin\Configurable::afterGetUsedProductCollection
is called when isSaleable checks - Multiple call of
\Magento\ConfigurableProduct\Model\Product\Type\Configurable::isSalable
affects performance since the result is not cached andafterGetUsedProductCollection
called