Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ProductBundle] fix persistance of spefiic-product-price-rule label #1472

Merged
merged 3 commits into from
Aug 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -143,7 +143,6 @@ coreshop.product.specificprice.object.item = Class.create(coreshop.rules.item, {
},

getSaveData: function () {

var saveData;

if (!this.settingsForm.getForm()) {
Expand All @@ -158,8 +157,7 @@ coreshop.product.specificprice.object.item = Class.create(coreshop.rules.item, {
saveData['id'] = this.data.id;
}

return saveData;

return coreshop.helpers.convertDotNotationToObject(saveData);
},

getId: function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,22 @@ coreshop.helpers.requestNicePathData = function (targets, responseHandler) {
}.bind(this)
});
};

coreshop.helpers.convertDotNotationToObject = function (data) {
var obj = {};

Object.keys(data).forEach(function (key) { //loop through the keys in the object
var val = data[key]; //grab the value of this key
var step = obj; //reference the object that holds the values
key.split(".").forEach(function (part, index, arr) { //split the parts and loop
if (index === arr.length - 1) { //If we are at the last index, than we set the value
step[part] = val;
} else if (step[part] === undefined) { //If we have not seen this key before, create an object
step[part] = {};
}
step = step[part]; //Step up the object we are referencing
});
});

return obj;
};
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,6 @@ coreshop.resource.item = Class.create({
},

convertDotNotationToObject: function (data) {
var obj = {};

Object.keys(data).forEach(function (key) { //loop through the keys in the object
var val = data[key]; //grab the value of this key
var step = obj; //reference the object that holds the values
key.split(".").forEach(function (part, index, arr) { //split the parts and loop
if (index === arr.length - 1) { //If we are at the last index, than we set the value
step[part] = val;
} else if (step[part] === undefined) { //If we have not seen this key before, create an object
step[part] = {};
}
step = step[part]; //Step up the object we are referencing
});
});

return obj;
return coreshop.helpers.convertDotNotationToObject(data);
}
});