Skip to content

Commit 5e303ca

Browse files
committed
Merge branch 'develop' into MAGETWO-58516
2 parents 1a3f946 + f39ad29 commit 5e303ca

File tree

86 files changed

+2218
-1425
lines changed

Some content is hidden

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

86 files changed

+2218
-1425
lines changed

app/code/Magento/BundleImportExport/Model/Export/RowCustomizer.php

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,7 @@ private function getShipmentTypeValue($type)
331331
protected function cleanNotBundleAdditionalAttributes($dataRow)
332332
{
333333
if (!empty($dataRow['additional_attributes'])) {
334-
$additionalAttributes = explode(
335-
ImportModel::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR,
336-
$dataRow['additional_attributes']
337-
);
334+
$additionalAttributes = $this->parseAdditionalAttributes($dataRow['additional_attributes']);
338335
$dataRow['additional_attributes'] = $this->getNotBundleAttributes($additionalAttributes);
339336
}
340337

@@ -349,17 +346,38 @@ protected function cleanNotBundleAdditionalAttributes($dataRow)
349346
*/
350347
protected function getNotBundleAttributes($additionalAttributes)
351348
{
352-
$cleanedAdditionalAttributes = '';
353-
foreach ($additionalAttributes as $attribute) {
354-
list($attributeCode, $attributeValue) = explode(ImportProductModel::PAIR_NAME_VALUE_SEPARATOR, $attribute);
355-
if (!in_array('bundle_' . $attributeCode, $this->getBundleColumns())) {
356-
$cleanedAdditionalAttributes .= $attributeCode
357-
. ImportProductModel::PAIR_NAME_VALUE_SEPARATOR
358-
. $attributeValue
359-
. ImportModel::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR;
349+
$filteredAttributes = [];
350+
foreach ($additionalAttributes as $code => $value) {
351+
if (!in_array('bundle_' . $code, $this->getBundleColumns())) {
352+
$filteredAttributes[] = $code . ImportProductModel::PAIR_NAME_VALUE_SEPARATOR . $value;
360353
}
361354
}
355+
return implode(ImportModel::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR, $filteredAttributes);
356+
}
362357

363-
return rtrim($cleanedAdditionalAttributes, ImportModel::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR);
358+
/**
359+
* Retrieves additional attributes as array code=>value.
360+
*
361+
* @param string $additionalAttributes
362+
* @return array
363+
*/
364+
private function parseAdditionalAttributes($additionalAttributes)
365+
{
366+
$attributeNameValuePairs = explode(ImportModel::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR, $additionalAttributes);
367+
$preparedAttributes = [];
368+
$code = '';
369+
foreach ($attributeNameValuePairs as $attributeData) {
370+
//process case when attribute has ImportModel::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR inside its value
371+
if (strpos($attributeData, ImportProductModel::PAIR_NAME_VALUE_SEPARATOR) === false) {
372+
if (!$code) {
373+
continue;
374+
}
375+
$preparedAttributes[$code] .= ImportModel::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR . $attributeData;
376+
continue;
377+
}
378+
list($code, $value) = explode(ImportProductModel::PAIR_NAME_VALUE_SEPARATOR, $attributeData, 2);
379+
$preparedAttributes[$code] = $value;
380+
}
381+
return $preparedAttributes;
364382
}
365383
}

app/code/Magento/BundleImportExport/Test/Unit/Model/Export/Product/RowCustomizerTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,16 @@ public function testAddHeaderColumns()
178178
public function testAddData()
179179
{
180180
$preparedData = $this->rowCustomizerMock->prepareData($this->productResourceCollection, [1]);
181-
$attributes = 'attribute=1,sku_type=1,price_type=1,price_view=1,weight_type=1,values=values,shipment_type=1';
181+
$attributes = 'attribute=1,sku_type=1,attribute2="Text",price_type=1,price_view=1,weight_type=1,'
182+
. 'values=values,shipment_type=1,attribute3=One,Two,Three';
182183
$dataRow = [
183184
'sku' => 'sku1',
184185
'additional_attributes' => $attributes
185186
];
186187
$preparedRow = $preparedData->addData($dataRow, 1);
187188
$expected = [
188189
'sku' => 'sku1',
189-
'additional_attributes' => 'attribute=1',
190+
'additional_attributes' => 'attribute=1,attribute2="Text",attribute3=One,Two,Three',
190191
'bundle_price_type' => 'fixed',
191192
'bundle_shipment_type' => 'separately',
192193
'bundle_sku_type' => 'fixed',

app/code/Magento/Catalog/Test/Unit/Block/Adminhtml/Product/Options/AjaxTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function testToHtml()
5353
->disableOriginalConstructor()
5454
->setMethods(['dispatch'])
5555
->getMock();
56-
$eventManager->expects($this->once())->method('dispatch')->will($this->returnValue(true));
56+
$eventManager->expects($this->exactly(2))->method('dispatch')->will($this->returnValue(true));
5757

5858
$scopeConfig = $this->getMockBuilder(\Magento\Framework\App\Config::class)
5959
->setMethods(['getValue'])

app/code/Magento/Catalog/Test/Unit/Block/Product/Widget/NewWidgetTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function testGetProductsCount()
186186

187187
protected function generalGetProductCollection()
188188
{
189-
$this->eventManager->expects($this->once())->method('dispatch')
189+
$this->eventManager->expects($this->exactly(2))->method('dispatch')
190190
->will($this->returnValue(true));
191191
$this->scopeConfig->expects($this->once())->method('getValue')->withAnyParameters()
192192
->willReturn(false);

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,6 @@ private function getTierPriceStructure($tierPricePath)
493493
'data' => [
494494
'config' => [
495495
'componentType' => Field::NAME,
496-
'component' => 'Magento_Catalog/js/form/element/price-input',
497496
'formElement' => Input::NAME,
498497
'dataType' => Price::NAME,
499498
'label' => __('Price'),

app/code/Magento/Catalog/view/adminhtml/web/js/form/element/price-input.js

Lines changed: 0 additions & 15 deletions
This file was deleted.

app/code/Magento/Catalog/view/adminhtml/web/template/form/element/price-input.html

Lines changed: 0 additions & 22 deletions
This file was deleted.

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

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2423,20 +2423,34 @@ private function _parseAdditionalAttributes($rowData)
24232423
if (empty($rowData['additional_attributes'])) {
24242424
return $rowData;
24252425
}
2426+
$rowData = array_merge($rowData, $this->parseAdditionalAttributes($rowData['additional_attributes']));
2427+
return $rowData;
2428+
}
24262429

2427-
$attributeNameValuePairs = explode($this->getMultipleValueSeparator(), $rowData['additional_attributes']);
2428-
foreach ($attributeNameValuePairs as $attributeNameValuePair) {
2429-
$separatorPosition = strpos($attributeNameValuePair, self::PAIR_NAME_VALUE_SEPARATOR);
2430-
if ($separatorPosition !== false) {
2431-
$key = substr($attributeNameValuePair, 0, $separatorPosition);
2432-
$value = substr(
2433-
$attributeNameValuePair,
2434-
$separatorPosition + strlen(self::PAIR_NAME_VALUE_SEPARATOR)
2435-
);
2436-
$rowData[$key] = $value === false ? '' : $value;
2430+
/**
2431+
* Retrieves additional attributes as array code=>value.
2432+
*
2433+
* @param string $additionalAttributes
2434+
* @return array
2435+
*/
2436+
private function parseAdditionalAttributes($additionalAttributes)
2437+
{
2438+
$attributeNameValuePairs = explode($this->getMultipleValueSeparator(), $additionalAttributes);
2439+
$preparedAttributes = [];
2440+
$code = '';
2441+
foreach ($attributeNameValuePairs as $attributeData) {
2442+
//process case when attribute has ImportModel::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR inside its value
2443+
if (strpos($attributeData, self::PAIR_NAME_VALUE_SEPARATOR) === false) {
2444+
if (!$code) {
2445+
continue;
2446+
}
2447+
$preparedAttributes[$code] .= $this->getMultipleValueSeparator() . $attributeData;
2448+
continue;
24372449
}
2450+
list($code, $value) = explode(self::PAIR_NAME_VALUE_SEPARATOR, $attributeData, 2);
2451+
$preparedAttributes[$code] = $value;
24382452
}
2439-
return $rowData;
2453+
return $preparedAttributes;
24402454
}
24412455

24422456
/**

app/code/Magento/CatalogInventory/Model/Stock/Status.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function getWebsiteId()
100100
*/
101101
public function getStockId()
102102
{
103-
return $this->getData(self::KEY_WEBSITE_ID);
103+
return $this->getData(self::KEY_STOCK_ID);
104104
}
105105

106106
/**

app/code/Magento/CatalogSearch/Block/Advanced/Result.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public function __construct(
6464
*/
6565
protected function _prepareLayout()
6666
{
67+
$this->pageConfig->getTitle()->set($this->getPageTitle());
6768
$breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
6869
if ($breadcrumbs) {
6970
$breadcrumbs->addCrumb(
@@ -84,6 +85,16 @@ protected function _prepareLayout()
8485
return parent::_prepareLayout();
8586
}
8687

88+
/**
89+
* Get page title
90+
*
91+
* @return \Magento\Framework\Phrase
92+
*/
93+
private function getPageTitle()
94+
{
95+
return __('Advanced Search Results');
96+
}
97+
8798
/**
8899
* Set order options
89100
*

0 commit comments

Comments
 (0)