Skip to content

Commit f1e0f27

Browse files
committed
MAGETWO-58933: Delete paging functionality for cofigurable product variations
- Revert "Merge pull request #253 from magento-performance/MAGETWO-55785" - This reverts commit b2cceb7, reversing changes made to b716af7.
1 parent c150f6c commit f1e0f27

File tree

13 files changed

+110
-616
lines changed

13 files changed

+110
-616
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/Save.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ public function execute()
7373
$productTypeId = $this->getRequest()->getParam('type');
7474
if ($data) {
7575
try {
76-
$data = $this->unserializeData($data);
7776
$product = $this->initializationHelper->initialize($this->productBuilder->build($this->getRequest()));
7877
$this->productTypeManager->processProduct($product);
7978

@@ -158,29 +157,6 @@ public function execute()
158157
return $resultRedirect;
159158
}
160159

161-
/**
162-
* @param array $data
163-
* @return array
164-
*/
165-
private function unserializeData($data)
166-
{
167-
if (isset($data["configurable-matrix-serialized"])) {
168-
$configurableMatrixSerialized = $data["configurable-matrix-serialized"];
169-
if ($configurableMatrixSerialized != null && !empty($configurableMatrixSerialized)) {
170-
$data["variations-matrix"] = json_decode($configurableMatrixSerialized, true);
171-
unset($data["configurable-matrix-serialized"]);
172-
}
173-
}
174-
if (isset($data["associated_product_ids_serialized"])) {
175-
$associatedProductIdsSerialized = $data["associated_product_ids_serialized"];
176-
if ($associatedProductIdsSerialized != null && !empty($associatedProductIdsSerialized)) {
177-
$data["associated_product_ids"] = json_decode($associatedProductIdsSerialized, true);
178-
unset($data["associated_product_ids_serialized"]);
179-
}
180-
}
181-
return $data;
182-
}
183-
184160
/**
185161
* Notify customer when image was not deleted in specific case.
186162
* TODO: temporary workaround must be eliminated in MAGETWO-45306

app/code/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Configurable.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,8 @@ public function afterInitialize(
5555
$this->productType->setUsedProductAttributeIds($attributes, $product);
5656

5757
$product->setNewVariationsAttributeSetId($setId);
58-
$associatedProductIds = $this->request->getPost('associated_product_ids_serialized', '[]');
59-
if ($associatedProductIds !== null && !empty($associatedProductIds)) {
60-
$associatedProductIds = json_decode($associatedProductIds, true);
61-
}
62-
$variationsMatrix = $this->request->getParam('configurable-matrix-serialized', '[]');
63-
if ($variationsMatrix !== null && !empty($variationsMatrix)) {
64-
$variationsMatrix = json_decode($variationsMatrix, true);
65-
}
58+
$associatedProductIds = $this->request->getPost('associated_product_ids', []);
59+
$variationsMatrix = $this->request->getParam('variations-matrix', []);
6660
if (!empty($variationsMatrix)) {
6761
$generatedProductIds = $this->variationHandler->generateSimpleProducts($product, $variationsMatrix);
6862
$associatedProductIds = array_merge($associatedProductIds, $generatedProductIds);

app/code/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Initialization/Helper/Plugin/UpdateConfigurations.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ public function afterInitialize(
4747
\Magento\Catalog\Model\Product $configurableProduct
4848
) {
4949
$configurations = $this->request->getParam('configurations', []);
50-
if ($this->request->getParam('configurations_serialized')) {
51-
$configurations = json_decode($this->request->getParam('configurations_serialized'), true);
52-
}
5350
$configurations = $this->variationHandler->duplicateImagesForVariations($configurations);
5451
foreach ($configurations as $productId => $productData) {
5552
/** @var \Magento\Catalog\Model\Product $product */

app/code/Magento/ConfigurableProduct/Test/Unit/Controller/Adminhtml/Product/Initialization/Helper/Plugin/ConfigurableTest.php

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,23 +79,19 @@ public function testAfterInitializeIfAttributesNotEmptyAndActionNameNotGenerateV
7979
{
8080
$this->productMock->expects($this->once())->method('getTypeId')->willReturn(ConfigurableProduct::TYPE_CODE);
8181
$associatedProductIds = ['key' => 'value'];
82-
$associatedProductIdsSerialized = json_encode($associatedProductIds);
8382
$generatedProductIds = ['key_one' => 'value_one'];
8483
$expectedArray = ['key' => 'value', 'key_one' => 'value_one'];
8584
$attributes = ['key' => 'value'];
8685
$postValue = 'postValue';
87-
$variationsMatrix = ['variationKey' => 'variationValue'];
88-
$variationsMatrixSerialized = json_encode($variationsMatrix);
89-
9086
$postValueMap = [
9187
['new-variations-attribute-set-id', null, $postValue],
92-
['associated_product_ids_serialized', '[]', $associatedProductIdsSerialized],
88+
['associated_product_ids', [], $associatedProductIds],
9389
['affect_configurable_product_attributes', null, $postValue],
9490
];
9591
$this->requestMock->expects($this->any())->method('getPost')->will($this->returnValueMap($postValueMap));
9692

9793
$paramValueMap = [
98-
['configurable-matrix-serialized', '[]', $variationsMatrixSerialized],
94+
['variations-matrix', [], $postValue],
9995
['attributes', null, $attributes],
10096
];
10197
$this->requestMock->expects($this->any())->method('getParam')->will($this->returnValueMap($paramValueMap));
@@ -114,7 +110,7 @@ public function testAfterInitializeIfAttributesNotEmptyAndActionNameNotGenerateV
114110
'generateSimpleProducts'
115111
)->with(
116112
$this->productMock,
117-
$variationsMatrix
113+
$postValue
118114
)->will(
119115
$this->returnValue($generatedProductIds)
120116
);
@@ -127,17 +123,16 @@ public function testAfterInitializeIfAttributesNotEmptyAndActionNameGenerateVari
127123
{
128124
$this->productMock->expects($this->once())->method('getTypeId')->willReturn(ConfigurableProduct::TYPE_CODE);
129125
$associatedProductIds = ['key' => 'value'];
130-
$associatedProductIdsSerialized = json_encode($associatedProductIds);
131126
$attributes = ['key' => 'value'];
132127
$postValue = 'postValue';
133128
$valueMap = [
134129
['new-variations-attribute-set-id', null, $postValue],
135-
['associated_product_ids_serialized', '[]', $associatedProductIdsSerialized],
130+
['associated_product_ids', [], $associatedProductIds],
136131
['affect_configurable_product_attributes', null, $postValue],
137132
];
138133
$this->requestMock->expects($this->any())->method('getPost')->will($this->returnValueMap($valueMap));
139134
$paramValueMap = [
140-
['variations-matrix', '[]', '[]'],
135+
['variations-matrix', [], []],
141136
['attributes', null, $attributes],
142137
];
143138
$this->requestMock->expects($this->any())->method('getParam')->will($this->returnValueMap($paramValueMap));

app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/summary.phtml

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,30 @@
1313

1414
<div class="admin__data-grid-wrap admin__data-grid-wrap-static">
1515
<!-- ko if: gridNew().length -->
16-
<!-- ko template: {name: getGridTemplate(), data: {
17-
grid: gridNew,
18-
paging: pagingNew,
19-
id: getGridId(),
20-
title: $t('New Product Review'),
21-
note: $t('Here are the products you\'re about to create.')
22-
}} --><!-- /ko -->
16+
<!-- ko template: {name: getGridTemplate(), data: {
17+
grid: gridNew,
18+
id: getGridId(),
19+
title: $t('New Product Review'),
20+
note: $t('Here are the products you\'re about to create.')
21+
}} --><!-- /ko -->
2322
<!-- /ko -->
2423

2524
<!-- ko if: gridExisting().length -->
26-
<!-- ko template: {name: getGridTemplate(), data: {
27-
paging: pagingExisting,
28-
grid: gridExisting,
29-
id: getGridId(),
30-
title: $t('Associated Products'),
31-
note: $t('You created these products for this configuration.')
32-
}} --><!-- /ko -->
25+
<!-- ko template: {name: getGridTemplate(), data: {
26+
grid: gridExisting,
27+
id: getGridId(),
28+
title: $t('Associated Products'),
29+
note: $t('You created these products for this configuration.')
30+
}} --><!-- /ko -->
3331
<!-- /ko -->
3432

3533
<!-- ko if: gridDeleted().length -->
36-
<!-- ko template: {name: getGridTemplate(), data: {
37-
paging: pagingDeleted,
38-
grid: gridDeleted,
39-
id: getGridId(),
40-
title: $t('Disassociated Products'),
41-
note: $t('These products are not associated.')
42-
}} --><!-- /ko -->
34+
<!-- ko template: {name: getGridTemplate(), data: {
35+
grid: gridDeleted,
36+
id: getGridId(),
37+
title: $t('Disassociated Products'),
38+
note: $t('These products are not associated.')
39+
}} --><!-- /ko -->
4340
<!-- /ko -->
4441
</div>
4542
</div>

app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/matrix.phtml

Lines changed: 30 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@ $currencySymbol = $block->getCurrencySymbol();
4242
</div>
4343
<!-- /ko -->
4444
</div>
45-
<div class="admin__data-grid-header">
46-
<div class="admin__data-grid-header-row row row-gutter">
47-
<div class="col-xs-12">
48-
<!-- ko template: { name: "ui/grid/paging/paging", data: paging } --><!-- /ko -->
49-
</div>
50-
</div>
51-
</div>
5245
<div class="admin__data-grid-wrap admin__data-grid-wrap-static">
5346
<table class="data-grid">
5447
<thead>
@@ -83,12 +76,12 @@ $currencySymbol = $block->getCurrencySymbol();
8376
</thead>
8477
<tbody data-bind="foreach: {data: productMatrix, as: 'variation'}">
8578
<tr data-role="row" data-bind="css: { _disabled: !variation.status, even: $index() % 2 },
86-
attr: { 'data-row-number': variation.variationKey }">
79+
attr: { 'data-row-number': $index() }">
8780
<td class="col-image" data-column="image">
8881
<div class="actions split actions-image-uploader">
8982
<div class="action-upload action split" data-action="upload-image">
9083
<!-- ko if: $parent.isShowPreviewImage(variation) -->
91-
<img data-bind='attr: {src: $parent.getVariationImage(variation)}' class="variation"
84+
<img data-bind='attr: {src: variation.images.preview}' class="variation"
9285
data-role="image"/>
9386
<!-- /ko -->
9487
<!-- ko if: variation.editable-->
@@ -126,39 +119,27 @@ $currencySymbol = $block->getCurrencySymbol();
126119
<!-- /ko -->
127120
<!-- ko if: variation.editable -->
128121
<input type="text" class="required-entry" data-bind="
129-
attr: {
130-
id: $parent.getRowId(variation, 'name'),
131-
name: $parent.getVariationRowName(variation, 'name')
132-
},
133-
value: variation.name
134-
"/>
122+
attr: {id: $parent.getRowId(variation, 'name'),
123+
name: $parent.getVariationRowName(variation, 'name'),
124+
value: variation.sku}"/>
135125
<input type="hidden" data-bind="
136-
attr: {
137-
id: $parent.getRowId(variation, 'configurable_attribute'),
138-
name: $parent.getVariationRowName(variation, 'configurable_attribute')
139-
},
140-
value: variation.attribute
141-
"/>
126+
attr: {id: $parent.getRowId(variation, 'configurable_attribute'),
127+
name: $parent.getVariationRowName(variation, 'configurable_attribute'),
128+
value: variation.attribute}"/>
142129
<!-- /ko -->
143130
<input type="hidden" data-role="status" data-bind="
144-
attr: {
145-
name: $parent.getVariationRowName(variation, 'status')
146-
},
147-
value: variation.status
148-
"/>
131+
attr: {name: $parent.getVariationRowName(variation, 'status'),
132+
value: variation.status}"/>
149133
</td>
150134
<td class="col-sku" data-column="sku">
151135
<!-- ko ifnot: variation.editable -->
152136
<!-- ko text: variation.sku --><!--/ko-->
153137
<!-- /ko -->
154138
<!-- ko if: variation.editable -->
155-
<input type="text" class="required-entry" data-bind="
156-
attr: {
157-
id: $parent.getRowId(variation, 'sku'),
158-
name: $parent.getVariationRowName(variation, 'sku')
159-
},
160-
value: variation.sku
161-
"/>
139+
<input type="text" class="required-entry"
140+
data-bind="attr: {id: $parent.getRowId(variation, 'sku'),
141+
name: $parent.getVariationRowName(variation, 'sku'),
142+
value: variation.sku}"/>
162143
<!-- /ko -->
163144
</td>
164145
<td class="col-price" data-column="price">
@@ -167,16 +148,12 @@ $currencySymbol = $block->getCurrencySymbol();
167148
<!-- /ko -->
168149
<!-- ko if: variation.editable -->
169150
<div class="addon">
170-
<input type="text" id="" class="required-entry validate-zero-or-greater" data-bind="
171-
attr: {
172-
id: $parent.getRowId(variation, 'price'),
173-
name: $parent.getVariationRowName(variation, 'price')
174-
},
175-
value: variation.price,
176-
event: {
177-
keyup: validatePrice()
178-
}
179-
"/>
151+
<input type="text"
152+
id=""
153+
class="required-entry validate-zero-or-greater"
154+
data-bind="attr: {id: $parent.getRowId(variation, 'price'),
155+
name: $parent.getVariationRowName(variation, 'price'),
156+
value: variation.price}"/>
180157
<label class="addafter"
181158
data-bind="attr: {for: $parent.getRowId(variation, 'price')">
182159
<strong data-bind="text: $parent.getCurrencySymbol()"></strong>
@@ -189,27 +166,23 @@ $currencySymbol = $block->getCurrencySymbol();
189166
<!-- ko text: variation.quantity --><!--/ko-->
190167
<!-- /ko -->
191168
<!-- ko if: variation.editable -->
192-
<input type="text" class="validate-zero-or-greater" data-bind="
193-
attr: {
194-
id: $parent.getRowId(variation, 'qty'),
195-
name: $parent.getVariationRowName(variation, 'quantity_and_stock_status/qty')
196-
},
197-
value: variation.quantity
198-
"/>
169+
<input type="text"
170+
class="validate-zero-or-greater"
171+
data-bind="attr: {id: $parent.getRowId(variation, 'qty'),
172+
name: $parent.getVariationRowName(variation, 'quantity_and_stock_status/qty'),
173+
value: variation.quantity}"/>
199174
<!-- /ko -->
200175
</td>
201176
<td class="col-weight" data-column="weight">
202177
<!-- ko ifnot: variation.editable -->
203178
<!-- ko text: variation.weight --><!--/ko-->
204179
<!-- /ko -->
205180
<!-- ko if: variation.editable -->
206-
<input type="text" class="validate-zero-or-greater" data-bind="
207-
attr: {
208-
id: $parent.getRowId(variation, 'weight'),
209-
name: $parent.getVariationRowName(variation, 'weight')
210-
},
211-
value: variation.weight
212-
"/>
181+
<input type="text" class="validate-zero-or-greater"
182+
data-bind="
183+
attr: {id: $parent.getRowId(variation, 'weight'),
184+
name: $parent.getVariationRowName(variation, 'weight'),
185+
value: variation.weight}"/>
213186
<!-- /ko -->
214187
</td>
215188
<!-- ko foreach: variation.options -->
@@ -254,9 +227,6 @@ $currencySymbol = $block->getCurrencySymbol();
254227
</td>
255228
</tr>
256229
</tbody>
257-
<input type="hidden" name="configurable-matrix-serialized" data-bind="value: productMatrixSerialized"/>
258-
<input type="hidden" name="associated_product_ids_serialized" data-bind="value: associatedProductsSerialized"/>
259-
<input type="hidden" name="configurations_serialized" data-bind="value: configurationsSerialized"/>
260230
</table>
261231
</div>
262232
</div>

app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/paging/sizes.js

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

0 commit comments

Comments
 (0)