Skip to content

Performance of isSalable method check on configurable product #26065

Closed
@ilnytskyi

Description

@ilnytskyi

Magneto 2.3.x

Preconditions (*)

  1. 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 (*)

  1. Render prices on product listing
  2. Check if product is saleable

Expected result (*)

  1. plugin \Magento\Swatches\Model\Plugin\Configurable::afterGetUsedProductCollection is not called after isSaleable call
  2. \Magento\ConfigurableProduct\Model\Product\Type\Configurable::isSalable stores result since it can be called twice

Actual result (*)

  1. plugin \Magento\Swatches\Model\Plugin\Configurable::afterGetUsedProductCollection is called when isSaleable checks
  2. Multiple call of \Magento\ConfigurableProduct\Model\Product\Type\Configurable::isSalable affects performance since the result is not cached and afterGetUsedProductCollection called

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions