11 use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
27 private $linkedProductSelectBuilder;
32 private $collectionFactory;
37 private $storeManager;
44 private $linkedProductMap;
55 CollectionFactory $collectionFactory,
59 $this->linkedProductSelectBuilder = $linkedProductSelectBuilder;
60 $this->collectionFactory = $collectionFactory;
69 $key = $this->storeManager->getStore()->getId() .
'-' .
$product->getId();
70 if (!isset($this->linkedProductMap[$key])) {
71 $productIds = $this->resource->getConnection()->fetchCol(
72 '(' . implode(
') UNION (', $this->linkedProductSelectBuilder->build(
$product->getId())) .
')' 75 $this->linkedProductMap[$key] = $this->collectionFactory->create()
76 ->addAttributeToSelect(
77 [
'price',
'special_price',
'special_from_date',
'special_to_date',
'tax_class_id']
82 return $this->linkedProductMap[$key];
__construct(ResourceConnection $resourceConnection, LinkedProductSelectBuilderInterface $linkedProductSelectBuilder, CollectionFactory $collectionFactory, StoreManagerInterface $storeManager)
getProducts(ProductInterface $product)