Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
73689a1
MAGETWO-90803: phpunit.xml files should be ignored by Magento/Test/In…
rganin May 4, 2018
0857531
Merge branch '2.3-develop' of github.com:magento/magento2ce into 2.3-…
rganin May 21, 2018
ac51a3c
MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907
rganin Jun 4, 2018
dc1400e
MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907
rganin Jun 4, 2018
18cb5bd
MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907
rganin Jun 4, 2018
d3c682e
MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907
rganin Jun 5, 2018
8d275f7
MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907
rganin Jun 5, 2018
89052b6
MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907
rganin Jun 5, 2018
f3d5e73
MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907
rganin Jun 5, 2018
8a5ff8f
MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907
rganin Jun 7, 2018
718a699
MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907
rganin Jun 7, 2018
92e925e
MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907
rganin Jun 7, 2018
eb3c70e
merge magento/2.3-develop into magento-earl-grey/MAGETWO-91570
Jun 8, 2018
11541db
merge magento/2.3-develop into magento-earl-grey/MAGETWO-91570
Jun 11, 2018
8313fc3
MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907
rganin Jun 12, 2018
025d23c
Merge branch '2.3-develop' of github.com:magento/magento2ce into MAGE…
rganin Jun 12, 2018
9cf29a6
Merge branch 'MAGETWO-91570' of github.com:magento-earl-grey/magento2…
rganin Jun 12, 2018
aa9f0f0
MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907
rganin Jun 12, 2018
983370f
merge magento/2.3-develop into magento-earl-grey/MAGETWO-91570
Jun 13, 2018
13927e3
MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907
rganin Jun 13, 2018
e3a04cb
Merge branch 'MAGETWO-91570' of github.com:magento-earl-grey/magento2…
rganin Jun 13, 2018
d3e8f82
MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907
rganin Jun 13, 2018
05e5df7
merge magento/2.3-develop into magento-earl-grey/MAGETWO-91570
Jun 13, 2018
2328833
MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907
rganin Jun 13, 2018
019cf68
Merge branch 'MAGETWO-91570' of github.com:magento-earl-grey/magento2…
rganin Jun 13, 2018
1a22d95
MAGETWO-91570: [2.2.x] - [Github]Can not save attribute #5907
rganin Jun 14, 2018
f8b3385
Merge pull request #2673 from magento-earl-grey/MAGETWO-91570
cpartica Jun 14, 2018
6cbf708
hitesh-wagento Jun 5, 2018
4189521
hitesh-wagento Jun 5, 2018
6ceaf1b
hitesh-wagento Jun 5, 2018
b651610
hitesh-wagento Jun 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class Save extends Attribute
* @var LayoutFactory
*/
private $layoutFactory;

/**
* @var Presentation
*/
Expand Down Expand Up @@ -124,6 +125,7 @@ public function execute()
{
$data = $this->getRequest()->getPostValue();
if ($data) {
$this->preprocessOptionsData($data);
$setId = $this->getRequest()->getParam('set');

$attributeSet = null;
Expand Down Expand Up @@ -313,6 +315,28 @@ public function execute()
return $this->returnResult('catalog/*/', [], ['error' => true]);
}

/**
* Extract options data from serialized options field and append to data array.
*
* This logic is required to overcome max_input_vars php limit
* that may vary and/or be inaccessible to change on different instances.
*
* @param array $data
* @return void
*/
private function preprocessOptionsData(&$data)
{
if (isset($data['serialized_options'])) {
$serializedOptions = json_decode($data['serialized_options'], JSON_OBJECT_AS_ARRAY);
foreach ($serializedOptions as $serializedOption) {
$option = [];
parse_str($serializedOption, $option);
$data = array_replace_recursive($data, $option);
}
}
unset($data['serialized_options']);
}

/**
* @param string $path
* @param array $params
Expand Down
34 changes: 31 additions & 3 deletions app/code/Magento/Catalog/view/adminhtml/web/js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ define([
'jquery/ui',
'prototype',
'form',
'validation'
'validation',
'mage/translate'
], function (jQuery, mageTemplate, rg) {
'use strict';

return function (config) {
var attributeOption = {
var optionPanel = jQuery('#manage-options-panel'),
optionsValues = [],
editForm = jQuery('#edit_form'),
attributeOption = {
table: $('attribute-options-table'),
itemCount: 0,
totalItems: 0,
Expand Down Expand Up @@ -150,7 +154,7 @@ define([
attributeOption.remove(event);
});

jQuery('#manage-options-panel').on('render', function () {
optionPanel.on('render', function () {
attributeOption.ignoreValidate();

if (attributeOption.rendered) {
Expand All @@ -176,7 +180,31 @@ define([
});
});
}
editForm.on('submit', function () {
optionPanel.find('input')
.each(function () {
if (this.disabled) {
return;
}

if (this.type === 'checkbox' || this.type === 'radio') {
if (this.checked) {
optionsValues.push(this.name + '=' + jQuery(this).val());
}
} else {
optionsValues.push(this.name + '=' + jQuery(this).val());
}
});
jQuery('<input>')
.attr({
type: 'hidden',
name: 'serialized_options'
})
.val(JSON.stringify(optionsValues))
.prependTo(editForm);
optionPanel.find('table')
.replaceWith(jQuery('<div>').text(jQuery.mage.__('Sending attribute values as package.')));
});
window.attributeOption = attributeOption;
window.optionDefaultInputType = attributeOption.getOptionInputType();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use Magento\Swatches\Model\Swatch;

/**
* Class Save
* Plugin for product attribute save controller.
*/
class Save
{
Expand All @@ -24,7 +24,17 @@ class Save
public function beforeDispatch(Attribute\Save $subject, RequestInterface $request)
{
$data = $request->getPostValue();

if (isset($data['frontend_input'])) {
//Data is serialized to overcome issues caused by max_input_vars value if it's modification is unavailable.
//See subject controller code and comments for more info.
if (isset($data['serialized_swatch_values'])
&& in_array($data['frontend_input'], ['swatch_visual', 'swatch_text'])
) {
$data['serialized_options'] = $data['serialized_swatch_values'];
unset($data['serialized_swatch_values']);
}

switch ($data['frontend_input']) {
case 'swatch_visual':
$data[Swatch::SWATCH_INPUT_TYPE_KEY] = Swatch::SWATCH_INPUT_TYPE_VISUAL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,8 @@ define([
};

$(function () {
var editForm = $('#edit_form');

$('#frontend_input').bind('change', function () {
swatchProductAttributes.bindAttributeInputType();
});
Expand All @@ -427,6 +429,34 @@ define([
$('.attribute-popup .collapse, [data-role="advanced_fieldset-content"]')
.collapsable()
.collapse('hide');

editForm.on('submit', function () {
var activePanel,
swatchValues = [],
swatchVisualPanel = $('#swatch-visual-options-panel'),
swatchTextPanel = $('#swatch-text-options-panel');

activePanel = swatchTextPanel.is(':visible') ? swatchTextPanel : swatchVisualPanel;

activePanel
.find('table input')
.each(function () {
swatchValues.push(this.name + '=' + $(this).val());
});

$('<input>')
.attr({
type: 'hidden',
name: 'serialized_swatch_values'
})
.val(JSON.stringify(swatchValues))
.prependTo(editForm);

[swatchVisualPanel, swatchTextPanel].forEach(function (el) {
$(el).find('table')
.replaceWith($('<div>').text($.mage.__('Sending swatch values as package.')));
});
});
});

window.saveAttributeInNewSet = swatchProductAttributes.saveAttributeInNewSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
padding: @block-auth__dropdown__padding;
}
}

.authentication-wrapper {
float: right;
margin-top: -1.5*@indent__xl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@
.payment-option-title {
.lib-css(padding-left, @checkout-payment-option-content__padding__xl);
}

.payment-option-content {
.payment-option-inner {
+ .actions-toolbar {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@
}
}
}

.row-error {
td {
border-top: none;
Expand Down Expand Up @@ -285,6 +286,7 @@
.lib-css(max-width, @checkout-shipping-address__max-width);
}
}

.table-checkout-shipping-method {
width: auto;
}
Expand Down Expand Up @@ -324,6 +326,7 @@
}
}
}

.table-checkout-shipping-method {
min-width: 500px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
.actions-toolbar:not(:last-child) {
margin-bottom: @indent__xl;
}

.fieldset {
.nested {
.field:not(.choice) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,24 @@
.shipping-item {
margin-left:84px;
}

.shipping-label {
font-weight: @font-weight__bold;
margin-right: @indent__s;
}

.shipping-address {
font-weight: @font-weight__regular;
}

.error-block {
color: @color-red10;

.error-label {
font-weight: @font-weight__bold;
margin-right: @indent__s;
}

.error-description {
font-weight: @font-weight__regular;
}
Expand All @@ -64,6 +68,7 @@
.order-id {
float:left;
}

.shipping-item {
margin-left:100px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@
}
}
}

.opc-wrapper {
.form-login,
.form-shipping-address {
Expand All @@ -307,6 +308,7 @@
padding-bottom: @indent__base;
}
}

.table-checkout-shipping-method {
width: auto;
}
Expand Down Expand Up @@ -346,6 +348,7 @@
}
}
}

.table-checkout-shipping-method {
min-width: 500px;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
& when (@media-common = true) {
.box-tocart {
.action.instant-purchase {
&:extend(.abs-button-l all);
&:extend(.abs-button-responsive all);
.box-tocart {
.action.instant-purchase {
&:extend(.abs-button-l all);
&:extend(.abs-button-responsive all);

&:not(:last-child) {
margin-bottom: 15px;
}
&:not(:last-child) {
margin-bottom: 15px;
}

vertical-align: top;
vertical-align: top;
}
}
}
}

//
// Desktop
// _____________________________________________

.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
.box-tocart {
.action.instant-purchase {
margin-bottom: 0;
margin-right: 1%;
width: 49%;
.box-tocart {
.action.instant-purchase {
margin-bottom: 0;
margin-right: 1%;
width: 49%;
}
}
}
}
Loading