Skip to content

Commit 021101c

Browse files
committed
MAGETWO-87442: [EngCom Team] Batch 29. Forwardports to 2.3-develop #1351
- Merge Pull Request magento-engcom/magento2ce#1351 from magento-engcom-team/magento2:batch-29-forwardport-2.3-develop - Merged commits: 1. 70dd5a3 2. 54bc3a1 3. 3debd3f 4. 72c4965 5. e60ecdf 6. 8703b3d 7. bd88ed8 8. 1c70b18 9. 5fd7481 10. 7c61506 11. 2653b8a 12. 917a03f 13. eca73d0 14. 26f3109 15. c223484 16. 3b90ad7 17. ad317c2 18. 53e721c 19. 6114120 20. 63b4839
2 parents 15d1a96 + 63b4839 commit 021101c

File tree

29 files changed

+759
-232
lines changed

29 files changed

+759
-232
lines changed

app/code/Magento/Backend/etc/adminhtml/di.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@
145145
<item name="dev" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN</item>
146146
<item name="general/locale/code" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::DISABLED</item>
147147
</argument>
148+
<argument name="exemptions" xsi:type="array">
149+
<item name="dev/debug/debug_logging" xsi:type="string"/>
150+
</argument>
148151
</arguments>
149152
</type>
150153
<type name="Magento\Backend\Model\Search\Config\Result\Builder">

app/code/Magento/CatalogImportExport/Model/Export/Product.php

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -533,11 +533,12 @@ protected function getMediaGallery(array $productIds)
533533
]
534534
)->joinLeft(
535535
['mgv' => $this->_resourceModel->getTableName('catalog_product_entity_media_gallery_value')],
536-
'(mg.value_id = mgv.value_id AND mgv.store_id = 0)',
536+
'(mg.value_id = mgv.value_id)',
537537
[
538538
'mgv.label',
539539
'mgv.position',
540-
'mgv.disabled'
540+
'mgv.disabled',
541+
'mgv.store_id',
541542
]
542543
)->where(
543544
"mgvte.{$this->getProductEntityLinkField()} IN (?)",
@@ -553,6 +554,7 @@ protected function getMediaGallery(array $productIds)
553554
'_media_label' => $mediaRow['label'],
554555
'_media_position' => $mediaRow['position'],
555556
'_media_is_disabled' => $mediaRow['disabled'],
557+
'_media_store_id' => $mediaRow['store_id'],
556558
];
557559
}
558560

@@ -1001,12 +1003,10 @@ protected function collectRawData()
10011003
unset($data[$itemId][$storeId][self::COL_ADDITIONAL_ATTRIBUTES]);
10021004
}
10031005

1004-
if (!empty($data[$itemId][$storeId]) || $this->hasMultiselectData($item, $storeId)) {
1005-
$attrSetId = $item->getAttributeSetId();
1006-
$data[$itemId][$storeId][self::COL_STORE] = $storeCode;
1007-
$data[$itemId][$storeId][self::COL_ATTR_SET] = $this->_attrSetIdToName[$attrSetId];
1008-
$data[$itemId][$storeId][self::COL_TYPE] = $item->getTypeId();
1009-
}
1006+
$attrSetId = $item->getAttributeSetId();
1007+
$data[$itemId][$storeId][self::COL_STORE] = $storeCode;
1008+
$data[$itemId][$storeId][self::COL_ATTR_SET] = $this->_attrSetIdToName[$attrSetId];
1009+
$data[$itemId][$storeId][self::COL_TYPE] = $item->getTypeId();
10101010
$data[$itemId][$storeId][self::COL_SKU] = htmlspecialchars_decode($item->getSku());
10111011
$data[$itemId][$storeId]['store_id'] = $storeId;
10121012
$data[$itemId][$storeId]['product_id'] = $itemId;
@@ -1082,6 +1082,7 @@ protected function collectMultirawData()
10821082
* @param \Magento\Catalog\Model\Product $item
10831083
* @param int $storeId
10841084
* @return bool
1085+
* @deprecated
10851086
*/
10861087
protected function hasMultiselectData($item, $storeId)
10871088
{
@@ -1140,20 +1141,24 @@ protected function isValidAttributeValue($code, $value)
11401141
* @SuppressWarnings(PHPMD.NPathComplexity)
11411142
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
11421143
*/
1143-
private function appendMultirowData(&$dataRow, &$multiRawData)
1144+
private function appendMultirowData(&$dataRow, $multiRawData)
11441145
{
11451146
$productId = $dataRow['product_id'];
11461147
$productLinkId = $dataRow['product_link_id'];
11471148
$storeId = $dataRow['store_id'];
11481149
$sku = $dataRow[self::COL_SKU];
1150+
$type = $dataRow[self::COL_TYPE];
1151+
$attributeSet = $dataRow[self::COL_ATTR_SET];
11491152

11501153
unset($dataRow['product_id']);
11511154
unset($dataRow['product_link_id']);
11521155
unset($dataRow['store_id']);
11531156
unset($dataRow[self::COL_SKU]);
1157+
unset($dataRow[self::COL_STORE]);
1158+
unset($dataRow[self::COL_ATTR_SET]);
1159+
unset($dataRow[self::COL_TYPE]);
11541160

11551161
if (Store::DEFAULT_STORE_ID == $storeId) {
1156-
unset($dataRow[self::COL_STORE]);
11571162
$this->updateDataWithCategoryColumns($dataRow, $multiRawData['rowCategories'], $productId);
11581163
if (!empty($multiRawData['rowWebsites'][$productId])) {
11591164
$websiteCodes = [];
@@ -1169,11 +1174,13 @@ private function appendMultirowData(&$dataRow, &$multiRawData)
11691174
$additionalImageLabels = [];
11701175
$additionalImageIsDisabled = [];
11711176
foreach ($multiRawData['mediaGalery'][$productLinkId] as $mediaItem) {
1172-
$additionalImages[] = $mediaItem['_media_image'];
1173-
$additionalImageLabels[] = $mediaItem['_media_label'];
1177+
if ((int)$mediaItem['_media_store_id'] === Store::DEFAULT_STORE_ID) {
1178+
$additionalImages[] = $mediaItem['_media_image'];
1179+
$additionalImageLabels[] = $mediaItem['_media_label'];
11741180

1175-
if ($mediaItem['_media_is_disabled'] == true) {
1176-
$additionalImageIsDisabled[] = $mediaItem['_media_image'];
1181+
if ($mediaItem['_media_is_disabled'] == true) {
1182+
$additionalImageIsDisabled[] = $mediaItem['_media_image'];
1183+
}
11771184
}
11781185
}
11791186
$dataRow['additional_images'] =
@@ -1207,6 +1214,21 @@ private function appendMultirowData(&$dataRow, &$multiRawData)
12071214
}
12081215
}
12091216
$dataRow = $this->rowCustomizer->addData($dataRow, $productId);
1217+
} else {
1218+
$additionalImageIsDisabled = [];
1219+
if (!empty($multiRawData['mediaGalery'][$productLinkId])) {
1220+
foreach ($multiRawData['mediaGalery'][$productLinkId] as $mediaItem) {
1221+
if ((int)$mediaItem['_media_store_id'] === $storeId) {
1222+
if ($mediaItem['_media_is_disabled'] == true) {
1223+
$additionalImageIsDisabled[] = $mediaItem['_media_image'];
1224+
}
1225+
}
1226+
}
1227+
}
1228+
if ($additionalImageIsDisabled) {
1229+
$dataRow['hide_from_product_page'] =
1230+
implode(Import::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR, $additionalImageIsDisabled);
1231+
}
12101232
}
12111233

12121234
if (!empty($this->collectedMultiselectsData[$storeId][$productId])) {
@@ -1234,6 +1256,9 @@ private function appendMultirowData(&$dataRow, &$multiRawData)
12341256
$dataRow[self::COL_STORE] = $this->_storeIdToCode[$storeId];
12351257
}
12361258
$dataRow[self::COL_SKU] = $sku;
1259+
$dataRow[self::COL_ATTR_SET] = $attributeSet;
1260+
$dataRow[self::COL_TYPE] = $type;
1261+
12371262
return $dataRow;
12381263
}
12391264

0 commit comments

Comments
 (0)