Skip to content

Commit dbdb772

Browse files
Merge branch '2.3-develop' into forwardport-2.3-develop-magento-magento2-13408
2 parents 960d58c + 1dcb55d commit dbdb772

File tree

294 files changed

+18799
-600
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

294 files changed

+18799
-600
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/Catalog/Model/ResourceModel/Eav/Attribute.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,16 @@ public function afterSave()
230230
return parent::afterSave();
231231
}
232232

233+
/**
234+
* Is attribute enabled for flat indexing
235+
*
236+
* @return bool
237+
*/
238+
public function isEnabledInFlat()
239+
{
240+
return $this->_isEnabledInFlat();
241+
}
242+
233243
/**
234244
* Is attribute enabled for flat indexing
235245
*

app/code/Magento/Catalog/Test/Unit/Block/Product/View/GalleryTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\Catalog\Test\Unit\Block\Product\View;
77

8+
/**
9+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
10+
*/
811
class GalleryTest extends \PHPUnit\Framework\TestCase
912
{
1013
/**

app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/EavTest.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class EavTest extends AbstractModifierTest
187187
* @var ObjectManager
188188
*/
189189
protected $objectManager;
190-
190+
191191
/**
192192
* @var Eav
193193
*/
@@ -324,7 +324,7 @@ protected function setUp()
324324
$this->eavAttributeMock->expects($this->any())
325325
->method('load')
326326
->willReturnSelf();
327-
327+
328328
$this->eav =$this->getModel();
329329
$this->objectManager->setBackwardCompatibleProperty(
330330
$this->eav,
@@ -490,6 +490,10 @@ public function testSetupAttributeMetaDefaultAttribute($productId, $productRequi
490490
->method('getNote')
491491
->willReturn($note);
492492

493+
$this->productAttributeMock->expects($this->any())
494+
->method('getDefaultFrontendLabel')
495+
->willReturn(new Phrase('mylabel'));
496+
493497
$attributeMock = $this->getMockBuilder(AttributeInterface::class)
494498
->setMethods(['getValue'])
495499
->disableOriginalConstructor()
@@ -561,7 +565,7 @@ private function defaultNullProdNotNewAndRequired()
561565
'required' => true,
562566
'notice' => null,
563567
'default' => null,
564-
'label' => null,
568+
'label' => new Phrase('mylabel'),
565569
'code' => 'code',
566570
'source' => 'product-details',
567571
'scopeLabel' => '',
@@ -588,7 +592,7 @@ private function defaultNullProdNotNewAndNotRequired()
588592
'required' => false,
589593
'notice' => null,
590594
'default' => null,
591-
'label' => null,
595+
'label' => new Phrase('mylabel'),
592596
'code' => 'code',
593597
'source' => 'product-details',
594598
'scopeLabel' => '',
@@ -615,7 +619,7 @@ private function defaultNullProdNewAndNotRequired()
615619
'required' => false,
616620
'notice' => null,
617621
'default' => 'required_value',
618-
'label' => null,
622+
'label' => new Phrase('mylabel'),
619623
'code' => 'code',
620624
'source' => 'product-details',
621625
'scopeLabel' => '',
@@ -642,7 +646,7 @@ private function defaultNullProdNewAndRequired()
642646
'required' => false,
643647
'notice' => null,
644648
'default' => 'required_value',
645-
'label' => null,
649+
'label' => new Phrase('mylabel'),
646650
'code' => 'code',
647651
'source' => 'product-details',
648652
'scopeLabel' => '',
@@ -669,7 +673,7 @@ private function defaultNullProdNewAndRequiredAndFilledNotice()
669673
'required' => false,
670674
'notice' => __('example notice'),
671675
'default' => 'required_value',
672-
'label' => null,
676+
'label' => new Phrase('mylabel'),
673677
'code' => 'code',
674678
'source' => 'product-details',
675679
'scopeLabel' => '',

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ public function setupAttributeMeta(ProductAttributeInterface $attribute, $groupC
580580
'required' => $attribute->getIsRequired(),
581581
'notice' => $attribute->getNote() === null ? null : __($attribute->getNote()),
582582
'default' => (!$this->isProductExists()) ? $attribute->getDefaultValue() : null,
583-
'label' => $attribute->getDefaultFrontendLabel(),
583+
'label' => __($attribute->getDefaultFrontendLabel()),
584584
'code' => $attribute->getAttributeCode(),
585585
'source' => $groupCode,
586586
'scopeLabel' => $this->getScopeLabel($attribute),

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)