Skip to content

Commit 2991a00

Browse files
author
Alexander Akimov
authored
Merge pull request #1063 from magento-dragons/PR-1904
[Dragons] BugFixes
2 parents f1033b2 + b65d62c commit 2991a00

File tree

8 files changed

+30
-13
lines changed

8 files changed

+30
-13
lines changed

app/code/Magento/ConfigurableImportExport/Model/Import/Product/Type/Configurable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ protected function _collectSuperDataLabels($data, $productSuperAttrId, $productI
720720
$label = isset($variationLabels[$data['_super_attribute_code']])
721721
? $variationLabels[$data['_super_attribute_code']]
722722
: $attrParams['frontend_label'];
723-
$this->_superAttributesData['labels'][] = [
723+
$this->_superAttributesData['labels'][$productSuperAttrId] = [
724724
'product_super_attribute_id' => $productSuperAttrId,
725725
'store_id' => 0,
726726
'use_default' => $label ? 0 : 1,

app/code/Magento/ConfigurableProduct/Model/AttributeOptionProvider.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ private function getAttributeOptionsSelect(AbstractAttribute $superAttribute, $p
7777
'default_option_value.value'
7878
),
7979
'default_title' => 'default_option_value.value',
80+
'super_attribute_label' => 'attribute_label.value',
8081
]
8182
)->joinInner(
8283
['product_entity' => $this->attributeResource->getTable('catalog_product_entity')],
@@ -126,6 +127,16 @@ private function getAttributeOptionsSelect(AbstractAttribute $superAttribute, $p
126127
]
127128
),
128129
[]
130+
)->joinLeft(
131+
['attribute_label' => $this->attributeResource->getTable('catalog_product_super_attribute_label')],
132+
implode(
133+
' AND ',
134+
[
135+
'super_attribute.product_super_attribute_id = attribute_label.product_super_attribute_id',
136+
'attribute_label.store_id = ' . \Magento\Store\Model\Store::DEFAULT_STORE_ID
137+
]
138+
),
139+
[]
129140
)->where(
130141
'super_attribute.product_id = ?',
131142
$productId

app/code/Magento/Swatches/Block/Adminhtml/Attribute/Edit/Options/AbstractSwatch.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ public function __construct(
7878
/**
7979
* Create store values
8080
*
81-
* @codeCoverageIgnore
81+
* Method not intended to escape HTML entities
82+
* Escaping will be applied in template files
83+
*
8284
* @param integer $storeId
8385
* @param integer $optionId
8486
* @return array
@@ -88,10 +90,8 @@ protected function createStoreValues($storeId, $optionId)
8890
$value = [];
8991
$storeValues = $this->getStoreOptionValues($storeId);
9092
$swatchStoreValue = isset($storeValues['swatch']) ? $storeValues['swatch'] : null;
91-
$value['store' . $storeId] = isset($storeValues[$optionId]) ?
92-
$this->escapeHtml($storeValues[$optionId]) : '';
93-
$value['swatch' . $storeId] = isset($swatchStoreValue[$optionId]) ?
94-
$this->escapeHtml($swatchStoreValue[$optionId]) : '';
93+
$value['store' . $storeId] = isset($storeValues[$optionId]) ? $storeValues[$optionId] : '';
94+
$value['swatch' . $storeId] = isset($swatchStoreValue[$optionId]) ? $swatchStoreValue[$optionId] : '';
9595

9696
return $value;
9797
}

app/code/Magento/Swatches/Block/Adminhtml/Attribute/Edit/Options/Visual.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ class Visual extends AbstractSwatch
1919
/**
2020
* Create store values
2121
*
22-
* @codeCoverageIgnore
22+
* Method not intended to escape HTML entities
23+
* Escaping will be applied in template files
24+
*
2325
* @param integer $storeId
2426
* @param integer $optionId
2527
* @return array
@@ -38,16 +40,16 @@ protected function createStoreValues($storeId, $optionId)
3840
}
3941

4042
if (isset($storeValues[$optionId])) {
41-
$value['store' . $storeId] = $this->escapeHtml($storeValues[$optionId]);
43+
$value['store' . $storeId] = $storeValues[$optionId];
4244
}
4345

4446
if (isset($swatchStoreValue[$optionId])) {
45-
$value['defaultswatch' . $storeId] = $this->escapeHtml($swatchStoreValue[$optionId]);
47+
$value['defaultswatch' . $storeId] = $swatchStoreValue[$optionId];
4648
}
4749

4850
$swatchStoreValue = $this->reformatSwatchLabels($swatchStoreValue);
4951
if (isset($swatchStoreValue[$optionId])) {
50-
$value['swatch' . $storeId] = $this->escapeHtml($swatchStoreValue[$optionId]);
52+
$value['swatch' . $storeId] = $swatchStoreValue[$optionId];
5153
}
5254

5355
return $value;

dev/tests/integration/testsuite/Magento/ConfigurableImportExport/Model/Export/RowCustomizerTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,9 @@ public function testPrepareData()
4444
'sku=simple_10,test_configurable=Option 1|sku=simple_20,test_configurable=Option 2',
4545
$result['configurable_variations']
4646
);
47+
$this->assertEquals(
48+
'test_configurable=Test Configurable',
49+
$result['configurable_variation_labels']
50+
);
4751
}
4852
}

dev/tests/integration/testsuite/Magento/ConfigurableImportExport/Model/Import/Product/Type/ConfigurableTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function testConfigurableImport($pathToFile, $productName, $optionSkuList
134134
$this->assertArrayHasKey('frontend_label', $productAttributeData);
135135
$this->assertEquals('Test Configurable', $productAttributeData['frontend_label']);
136136
$this->assertArrayHasKey('label', $optionData);
137-
$this->assertEquals('test_configurable', $optionData['label']);
137+
$this->assertEquals('test_configurable_custom_label', $optionData['label']);
138138
$this->assertArrayHasKey('use_default', $optionData);
139139
$this->assertArrayHasKey('options', $optionData);
140140
$this->assertEquals('Option 1', $optionData['options'][0]['label']);
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
sku,store_view_code,attribute_set_code,product_type,name,description,short_description,weight,product_online,tax_class_name,visibility,price,url_key,display_product_options_in,map_price,additional_attributes,qty,out_of_stock_qty,use_config_min_qty,is_qty_decimal,allow_backorders,use_config_backorders,min_cart_qty,use_config_min_sale_qty,max_cart_qty,use_config_max_sale_qty,is_in_stock,notify_on_stock_below,use_config_notify_stock_qty,manage_stock,use_config_manage_stock,use_config_qty_increments,qty_increments,use_config_enable_qty_inc,enable_qty_increments,is_decimal_divided,website_id,configurable_variations,configurable_variation_labels,associated_skus
22
Configurable 1-Option 1,,Default,simple,Configurable 1-Option 1,,,,1,Taxable Goods,Not Visible Individually,10,configurable-1-option-1,Block after Info Column,,"attribute_with_option=Option Label,has_options=0,quantity_and_stock_status=In Stock,required_options=0,test_configurable=Option 1",99999,0,0,0,0,1,1,0,0,0,1,,1,1,0,0,1,0,0,0,1,,,
33
Configurable 1-Option 2,,Default,simple,Configurable 1-Option 2,,,,1,Taxable Goods,Not Visible Individually,10,configurable-1-option-2,Block after Info Column,,"has_options=0,quantity_and_stock_status=In Stock,required_options=0,test_configurable=Option 2",99999,0,0,0,0,1,1,0,0,0,1,,1,1,0,0,1,0,0,0,1,,,
4-
Configurable 1,,Default,configurable,Configurable 1,,,,1,Taxable Goods,"Catalog, Search",10,configurable-1,Block after Info Column,,"has_options=1,quantity_and_stock_status=In Stock,required_options=0",0,0,0,0,0,1,1,0,0,0,1,,1,0,0,0,1,0,0,0,1,"sku=Configurable 1-Option 1,test_configurable=Option 1|sku=Configurable 1-Option 2,test_configurable=Option 2",test_configurable=test_configurable,
4+
Configurable 1,,Default,configurable,Configurable 1,,,,1,Taxable Goods,"Catalog, Search",10,configurable-1,Block after Info Column,,"has_options=1,quantity_and_stock_status=In Stock,required_options=0",0,0,0,0,0,1,1,0,0,0,1,,1,0,0,0,1,0,0,0,1,"sku=Configurable 1-Option 1,test_configurable=Option 1|sku=Configurable 1-Option 2,test_configurable=Option 2",test_configurable=test_configurable_custom_label,
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
sku,store_view_code,attribute_set_code,product_type,name,description,short_description,weight,product_online,tax_class_name,visibility,price,url_key,display_product_options_in,map_price,additional_attributes,qty,out_of_stock_qty,use_config_min_qty,is_qty_decimal,allow_backorders,use_config_backorders,min_cart_qty,use_config_min_sale_qty,max_cart_qty,use_config_max_sale_qty,is_in_stock,notify_on_stock_below,use_config_notify_stock_qty,manage_stock,use_config_manage_stock,use_config_qty_increments,qty_increments,use_config_enable_qty_inc,enable_qty_increments,is_decimal_divided,website_id,configurable_variations,configurable_variation_labels,associated_skus
22
Configurable 1-Option 1,,Default,simple,Configurable 1-Option 1,,,,1,Taxable Goods,Not Visible Individually,10,configurable-1-option-1,Block after Info Column,,"attribute_with_option=Option Label,has_options=0,quantity_and_stock_status=In Stock,required_options=0,test_configurable=Option 1",99999,0,0,0,0,1,1,0,0,0,1,,1,1,0,0,1,0,0,0,1,,,
33
Configurable 1-Option 2,,Default,simple,Configurable 1-Option 2,,,,1,Taxable Goods,Not Visible Individually,10,configurable-1-option-2,Block after Info Column,,"has_options=0,quantity_and_stock_status=In Stock,required_options=0,test_configurable=Option 2",99999,0,0,0,0,1,1,0,0,0,1,,1,1,0,0,1,0,0,0,1,,,
4-
12345,,Default,configurable,12345,,,,1,Taxable Goods,"Catalog, Search",10,12345,Block after Info Column,,"has_options=1,quantity_and_stock_status=In Stock,required_options=0",0,0,0,0,0,1,1,0,0,0,1,,1,0,0,0,1,0,0,0,1,"sku=Configurable 1-Option 1,test_configurable=Option 1|sku=Configurable 1-Option 2,test_configurable=Option 2",test_configurable=test_configurable,
4+
12345,,Default,configurable,12345,,,,1,Taxable Goods,"Catalog, Search",10,12345,Block after Info Column,,"has_options=1,quantity_and_stock_status=In Stock,required_options=0",0,0,0,0,0,1,1,0,0,0,1,,1,0,0,0,1,0,0,0,1,"sku=Configurable 1-Option 1,test_configurable=Option 1|sku=Configurable 1-Option 2,test_configurable=Option 2",test_configurable=test_configurable_custom_label,

0 commit comments

Comments
 (0)