Skip to content

Commit 3e13adb

Browse files
OlgaVasyltsungemscng
authored andcommitted
MAGETWO-57153: [Backport] - [Github] Custom options not displayed correctly on a store view level magento#2908 magento#5885 - for 2.1
1 parent a958a55 commit 3e13adb

File tree

6 files changed

+7
-13
lines changed

6 files changed

+7
-13
lines changed

app/code/Magento/Catalog/Model/Product/Option/Repository.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,9 @@ public function save(\Magento\Catalog\Api\Data\ProductCustomOptionInterface $opt
135135
{
136136
/** @var string $productSku */
137137
$productSku = $option->getProductSku();
138-
139138
if (!$productSku) {
140139
throw new CouldNotSaveException(__('ProductSku should be specified'));
141140
}
142-
143141
/** @var \Magento\Catalog\Model\Product $product */
144142
$product = $this->productRepository->get($productSku);
145143
/** @var \Magento\Framework\EntityManager\EntityMetadataInterface $metadata */
@@ -148,13 +146,10 @@ public function save(\Magento\Catalog\Api\Data\ProductCustomOptionInterface $opt
148146
$option->setData('store_id', $product->getStoreId());
149147

150148
if ($option->getOptionId()) {
151-
152149
$options = $product->getOptions();
153-
154150
if (!$options) {
155151
$options = $this->getProductOptions($product);
156152
}
157-
158153
$persistedOption = array_filter(
159154
$options,
160155
function ($iOption) use ($option) {
@@ -171,7 +166,6 @@ function ($iOption) use ($option) {
171166
$originalValues = $persistedOption->getValues();
172167
/** @var array $newValues */
173168
$newValues = $option->getData('values');
174-
175169
if ($newValues) {
176170
$newValues = $this->markRemovedValues($newValues, $originalValues);
177171
$option->setData('values', $newValues);

app/code/Magento/Catalog/Model/Product/Option/Validator/Select.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,9 @@ protected function validateOptionValue(Option $option)
5151
$storeId = $option->getProduct()->getStoreId();
5252
}
5353
foreach ($values as $value) {
54-
5554
if (isset($value['is_delete']) && (bool)$value['is_delete']) {
5655
continue;
5756
}
58-
5957
$type = isset($value['price_type']) ? $value['price_type'] : null;
6058
$price = isset($value['price']) ? $value['price'] : null;
6159
$title = isset($value['title']) ? $value['title'] : null;

app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/Initialization/HelperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public function testInitialize()
197197
$optionsData = [
198198
'option1' => ['is_delete' => true, 'name' => 'name1', 'price' => 'price1', 'option_id' => ''],
199199
'option2' => ['is_delete' => false, 'name' => 'name1', 'price' => 'price1', 'option_id' => '13'],
200-
'option3' => ['is_delete' => false, 'name' => 'name1', 'price' => 'price1', 'option_id' => '14']
200+
'option3' => ['is_delete' => false, 'name' => 'name1', 'price' => 'price1', 'option_id' => '14'],
201201
];
202202
$productData = [
203203
'stock_data' => ['stock_data'],

app/code/Magento/Catalog/Test/Unit/Model/Product/Option/RepositoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class RepositoryTest extends \PHPUnit_Framework_TestCase
4141
*
4242
* @var CollectionFactory|\PHPUnit_Framework_MockObject_MockObject
4343
*/
44-
protected $optionCollectionFactory;
44+
private $optionCollectionFactory;
4545

4646
/**
4747
* @var \PHPUnit_Framework_MockObject_MockObject

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ public function testModifyData()
114114
CustomOptions::FIELD_TITLE_NAME => 'option1',
115115
CustomOptions::FIELD_STORE_TITLE_NAME => 'Option Store Title',
116116
CustomOptions::FIELD_IS_USE_DEFAULT => false
117-
], [
117+
],
118+
[
118119
CustomOptions::FIELD_TITLE_NAME => 'option2',
119120
CustomOptions::FIELD_STORE_TITLE_NAME => null,
120121
CustomOptions::FIELD_IS_USE_DEFAULT => true,
@@ -123,7 +124,8 @@ public function testModifyData()
123124
CustomOptions::FIELD_TITLE_NAME => 'value1',
124125
CustomOptions::FIELD_STORE_TITLE_NAME => 'Option Value Store Title',
125126
CustomOptions::FIELD_IS_USE_DEFAULT => false
126-
], [
127+
],
128+
[
127129
CustomOptions::FIELD_TITLE_NAME => 'value2',
128130
CustomOptions::FIELD_STORE_TITLE_NAME => null,
129131
CustomOptions::FIELD_IS_USE_DEFAULT => true

dev/tests/integration/testsuite/Magento/CatalogImportExport/_files/product_export_data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
'title' => 'Option 1 & Value 3"',
4242
'price' => '3.00',
4343
'price_type' => 'fixed'
44-
]
44+
],
4545
]
4646
],
4747
[

0 commit comments

Comments
 (0)