50 private $metadataPool;
57 private $productEntityLinkField;
64 private $productEntityIdentifierField;
81 $this->productTypeModels = $typeModels;
92 if (!$this->oldSkus) {
117 $sku = strtolower($sku);
118 $this->newSkus[$sku] =
$data;
130 $sku = strtolower($sku);
131 if (isset($this->newSkus[$sku])) {
132 $this->newSkus[$sku][$key] =
$data;
144 $sku = strtolower($sku);
145 return $this->newSkus[$sku] ??
null;
158 $columns = [
'entity_id',
'type_id',
'attribute_set_id',
'sku'];
159 if ($this->getProductEntityLinkField() != $this->getProductIdentifierField()) {
160 $columns[] = $this->getProductEntityLinkField();
162 foreach ($this->productFactory->create()->getProductEntitiesInfo(
$columns) as
$info) {
163 $typeId =
$info[
'type_id'];
164 $sku = strtolower(
$info[
'sku']);
166 'type_id' => $typeId,
167 'attr_set_id' =>
$info[
'attribute_set_id'],
168 'entity_id' =>
$info[
'entity_id'],
169 'supported_type' => isset($this->productTypeModels[$typeId]),
170 $this->getProductEntityLinkField() =>
$info[$this->getProductEntityLinkField()],
181 private function getMetadataPool()
183 if (!$this->metadataPool) {
185 ->get(\
Magento\Framework\EntityManager\MetadataPool::class);
187 return $this->metadataPool;
195 private function getProductEntityLinkField()
197 if (!$this->productEntityLinkField) {
198 $this->productEntityLinkField = $this->getMetadataPool()
199 ->getMetadata(\
Magento\Catalog\Api\Data\ProductInterface::class)
202 return $this->productEntityLinkField;
210 private function getProductIdentifierField()
212 if (!$this->productEntityIdentifierField) {
213 $this->productEntityIdentifierField = $this->getMetadataPool()
214 ->getMetadata(\
Magento\Catalog\Api\Data\ProductInterface::class)
215 ->getIdentifierField();
217 return $this->productEntityIdentifierField;
setTypeModels($typeModels)
__construct(\Magento\Catalog\Model\ProductFactory $productFactory)
setNewSkuData($sku, $key, $data)
foreach( $_productCollection as $_product)() ?>" class $info