Skip to content

Commit

Permalink
MAGETWO-87442: [EngCom Team] Batch 29. Forwardports to 2.3-develop #1351
Browse files Browse the repository at this point in the history


 - 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
  • Loading branch information
ishakhsuvarov committed Feb 5, 2018
2 parents 15d1a96 + 63b4839 commit 021101c
Show file tree
Hide file tree
Showing 29 changed files with 759 additions and 232 deletions.
3 changes: 3 additions & 0 deletions app/code/Magento/Backend/etc/adminhtml/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@
<item name="dev" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::HIDDEN</item>
<item name="general/locale/code" xsi:type="const">Magento\Config\Model\Config\Structure\ElementVisibilityInterface::DISABLED</item>
</argument>
<argument name="exemptions" xsi:type="array">
<item name="dev/debug/debug_logging" xsi:type="string"/>
</argument>
</arguments>
</type>
<type name="Magento\Backend\Model\Search\Config\Result\Builder">
Expand Down
53 changes: 39 additions & 14 deletions app/code/Magento/CatalogImportExport/Model/Export/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -533,11 +533,12 @@ protected function getMediaGallery(array $productIds)
]
)->joinLeft(
['mgv' => $this->_resourceModel->getTableName('catalog_product_entity_media_gallery_value')],
'(mg.value_id = mgv.value_id AND mgv.store_id = 0)',
'(mg.value_id = mgv.value_id)',
[
'mgv.label',
'mgv.position',
'mgv.disabled'
'mgv.disabled',
'mgv.store_id',
]
)->where(
"mgvte.{$this->getProductEntityLinkField()} IN (?)",
Expand All @@ -553,6 +554,7 @@ protected function getMediaGallery(array $productIds)
'_media_label' => $mediaRow['label'],
'_media_position' => $mediaRow['position'],
'_media_is_disabled' => $mediaRow['disabled'],
'_media_store_id' => $mediaRow['store_id'],
];
}

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

if (!empty($data[$itemId][$storeId]) || $this->hasMultiselectData($item, $storeId)) {
$attrSetId = $item->getAttributeSetId();
$data[$itemId][$storeId][self::COL_STORE] = $storeCode;
$data[$itemId][$storeId][self::COL_ATTR_SET] = $this->_attrSetIdToName[$attrSetId];
$data[$itemId][$storeId][self::COL_TYPE] = $item->getTypeId();
}
$attrSetId = $item->getAttributeSetId();
$data[$itemId][$storeId][self::COL_STORE] = $storeCode;
$data[$itemId][$storeId][self::COL_ATTR_SET] = $this->_attrSetIdToName[$attrSetId];
$data[$itemId][$storeId][self::COL_TYPE] = $item->getTypeId();
$data[$itemId][$storeId][self::COL_SKU] = htmlspecialchars_decode($item->getSku());
$data[$itemId][$storeId]['store_id'] = $storeId;
$data[$itemId][$storeId]['product_id'] = $itemId;
Expand Down Expand Up @@ -1082,6 +1082,7 @@ protected function collectMultirawData()
* @param \Magento\Catalog\Model\Product $item
* @param int $storeId
* @return bool
* @deprecated
*/
protected function hasMultiselectData($item, $storeId)
{
Expand Down Expand Up @@ -1140,20 +1141,24 @@ protected function isValidAttributeValue($code, $value)
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
private function appendMultirowData(&$dataRow, &$multiRawData)
private function appendMultirowData(&$dataRow, $multiRawData)
{
$productId = $dataRow['product_id'];
$productLinkId = $dataRow['product_link_id'];
$storeId = $dataRow['store_id'];
$sku = $dataRow[self::COL_SKU];
$type = $dataRow[self::COL_TYPE];
$attributeSet = $dataRow[self::COL_ATTR_SET];

unset($dataRow['product_id']);
unset($dataRow['product_link_id']);
unset($dataRow['store_id']);
unset($dataRow[self::COL_SKU]);
unset($dataRow[self::COL_STORE]);
unset($dataRow[self::COL_ATTR_SET]);
unset($dataRow[self::COL_TYPE]);

if (Store::DEFAULT_STORE_ID == $storeId) {
unset($dataRow[self::COL_STORE]);
$this->updateDataWithCategoryColumns($dataRow, $multiRawData['rowCategories'], $productId);
if (!empty($multiRawData['rowWebsites'][$productId])) {
$websiteCodes = [];
Expand All @@ -1169,11 +1174,13 @@ private function appendMultirowData(&$dataRow, &$multiRawData)
$additionalImageLabels = [];
$additionalImageIsDisabled = [];
foreach ($multiRawData['mediaGalery'][$productLinkId] as $mediaItem) {
$additionalImages[] = $mediaItem['_media_image'];
$additionalImageLabels[] = $mediaItem['_media_label'];
if ((int)$mediaItem['_media_store_id'] === Store::DEFAULT_STORE_ID) {
$additionalImages[] = $mediaItem['_media_image'];
$additionalImageLabels[] = $mediaItem['_media_label'];

if ($mediaItem['_media_is_disabled'] == true) {
$additionalImageIsDisabled[] = $mediaItem['_media_image'];
if ($mediaItem['_media_is_disabled'] == true) {
$additionalImageIsDisabled[] = $mediaItem['_media_image'];
}
}
}
$dataRow['additional_images'] =
Expand Down Expand Up @@ -1207,6 +1214,21 @@ private function appendMultirowData(&$dataRow, &$multiRawData)
}
}
$dataRow = $this->rowCustomizer->addData($dataRow, $productId);
} else {
$additionalImageIsDisabled = [];
if (!empty($multiRawData['mediaGalery'][$productLinkId])) {
foreach ($multiRawData['mediaGalery'][$productLinkId] as $mediaItem) {
if ((int)$mediaItem['_media_store_id'] === $storeId) {
if ($mediaItem['_media_is_disabled'] == true) {
$additionalImageIsDisabled[] = $mediaItem['_media_image'];
}
}
}
}
if ($additionalImageIsDisabled) {
$dataRow['hide_from_product_page'] =
implode(Import::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR, $additionalImageIsDisabled);
}
}

if (!empty($this->collectedMultiselectsData[$storeId][$productId])) {
Expand Down Expand Up @@ -1234,6 +1256,9 @@ private function appendMultirowData(&$dataRow, &$multiRawData)
$dataRow[self::COL_STORE] = $this->_storeIdToCode[$storeId];
}
$dataRow[self::COL_SKU] = $sku;
$dataRow[self::COL_ATTR_SET] = $attributeSet;
$dataRow[self::COL_TYPE] = $type;

return $dataRow;
}

Expand Down
Loading

0 comments on commit 021101c

Please sign in to comment.