forked from ripenecommerce/magento2-patches
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPatch-Magento_Catalog-M2.1.5EE-addMediaGalleryData-compatibility.patch
35 lines (28 loc) · 1.53 KB
/
Patch-Magento_Catalog-M2.1.5EE-addMediaGalleryData-compatibility.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 05366543b48073ef99869251231811ad37098d60 Mon Sep 17 00:00:00 2001
From: etessari <[email protected]>
Date: Fri, 31 Mar 2017 16:47:07 +0200
Subject: [PATCH] fix addMediaGalleryData compatibility EE
---
Model/ResourceModel/Product/Collection.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Model/ResourceModel/Product/Collection.php b/Model/ResourceModel/Product/Collection.php
index 66b4511..e23ebc3 100644
--- a/Model/ResourceModel/Product/Collection.php
+++ b/Model/ResourceModel/Product/Collection.php
@@ -2214,7 +2214,8 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Collection\Abstrac
$items = $this->getItems();
$select->where('entity.' . $linkField . ' IN (?)', array_map(function ($item) {
- return $item->getId();
+ $linkField = $this->getMetadataPool()->getMetadata(ProductInterface::class)->getLinkField();
+ return $item->getData($linkField);
}, $items));
foreach ($this->getConnection()->fetchAll($select) as $row) {
@@ -2222,7 +2223,7 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Collection\Abstrac
}
foreach ($items as $item) {
- $mediaEntries = isset($mediaGalleries[$item->getId()]) ? $mediaGalleries[$item->getId()] : [];
+ $mediaEntries = isset($mediaGalleries[$item->getData($linkField)]) ? $mediaGalleries[$item->getData($linkField)] : [];
$this->getGalleryReadHandler()->addMediaDataToProduct($item, $mediaEntries);
}
--
2.8.1