Skip to content

Commit

Permalink
Merge pull request #215 from magento-sparta/MDVA-33
Browse files Browse the repository at this point in the history
[SUPPORT] MDVA-33: Format of SKUs for auto generated simple products associated to a configurable product follow the name not the sku of the parent configurable
  • Loading branch information
slavvka committed Nov 27, 2015
2 parents 48de512 + 3d4ab48 commit 115f70f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ if ($variations) {
</a>
<!-- /ko -->
<!-- ko ifnot: variation.readonly -->
<input type="text" data-bind="attr: {id: $parent.getRowId(variation, 'name'), name: $parent.getVariationRowName(variation, 'name'), value: variation.sku}"/>
<input type="text" data-bind="attr: {id: $parent.getRowId(variation, 'name'), name: $parent.getVariationRowName(variation, 'name'), value: variation.name}"/>
<input type="hidden" data-bind="attr: {id: $parent.getRowId(variation, 'configurable_attribute'), name: $parent.getVariationRowName(variation, 'configurable_attribute'), value: variation.attribute}"/>
<input type="hidden" data-role="status" data-bind="attr: {name: $parent.getVariationRowName(variation, 'status'), value: variation.status}"/>
<!-- /ko -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,22 @@ define([
},
generateGrid: function (variations, getSectionValue) {
//['a1','b1','c1','d1'] option = {label:'a1', value:'', section:{img:'',inv:'',pri:''}}
var productSku = this.variationsComponent().getProductValue('sku');
var productName = this.variationsComponent().getProductValue('name');
var productPrice = this.variationsComponent().getProductValue('price');
this.variations = [];
return _.map(variations, function (options) {
var variation = [], images, sku, quantity, price;
var variation = [], images, sku, name, quantity, price;
images = getSectionValue('images', options);
variation.push(images);
sku = productName + _.reduce(options, function (memo, option) {

var suffix = _.reduce(options, function (memo, option) {
return memo + '-' + option.label;
}, '');
sku = productSku + suffix;
variation.push(sku);
name = productName + suffix;

quantity = getSectionValue('quantity', options);
variation.push(quantity);
//attributes
Expand All @@ -66,7 +71,8 @@ define([
price = getSectionValue('price', options);
price = price || productPrice;
variation.push('$ ' + price);
this.variations.push({options: options, images: images, sku: sku, quantity: quantity, price: price});
this.variations.push({options: options, images: images, sku: sku, name: name,
quantity: quantity, price: price});
return variation;
}, this);
},
Expand Down

0 comments on commit 115f70f

Please sign in to comment.