Skip to content

Commit 5f4ffb3

Browse files
committed
fixed adding product variation layout and sku, gtin value
1 parent 4fa1c33 commit 5f4ffb3

File tree

2 files changed

+27
-17
lines changed

2 files changed

+27
-17
lines changed

src/Modules/SimplCommerce.Module.Catalog/wwwroot/admin/product/product-form.html

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,13 @@ <h2 ng-if="vm.isEditMode">{{::vm.translate.get('Edit Product')}} {{vm.product.na
243243
<div class="col-sm-10">
244244
<table class="table table-striped">
245245
<tr>
246-
<th>{{::vm.translate.get('Option Combinations')}}</th>
247-
<th>{{::vm.translate.get('SKU')}}</th>
248-
<th>{{::vm.translate.get('GTIN')}}</th>
249-
<th>{{::vm.translate.get('Price')}}</th>
250-
<th>{{::vm.translate.get('Old Price')}}</th>
251-
<th>{{::vm.translate.get('Images')}}</th>
252-
<th>{{::vm.translate.get('Actions')}}</th>
246+
<th class="col-md-2">{{::vm.translate.get('Option Combinations')}}</th>
247+
<th class="col-md-2">{{::vm.translate.get('SKU')}}</th>
248+
<th class="col-md-2">{{::vm.translate.get('GTIN')}}</th>
249+
<th class="col-md-2">{{::vm.translate.get('Price')}}</th>
250+
<th class="col-md-2">{{::vm.translate.get('Old Price')}}</th>
251+
<th class="col-md-1">{{::vm.translate.get('Images')}}</th>
252+
<th class="col-md-1">{{::vm.translate.get('Actions')}}</th>
253253
</tr>
254254
<tr ng-repeat="variation in vm.product.variations">
255255
<td>{{variation.name}}</td>
@@ -279,34 +279,40 @@ <h2 ng-if="vm.isEditMode">{{::vm.translate.get('Edit Product')}} {{vm.product.na
279279
</td>
280280
</tr>
281281
<tr ng-show="vm.product.options.length > 0">
282-
<td class="variation-form" colspan="5">
282+
<td class="variation-form" colspan="7">
283283
<ng-form name="addingVariationForm">
284284
<table class="table">
285285
<tr>
286-
<td class="col-sm-4">
286+
<td class="col-md-2">
287287
<div class="form-group row">
288288
<div ng-repeat="option in vm.product.options">
289-
<div class="col-md-4">
289+
<div>
290290
<select class="form-control" ng-model="vm.addingVariation[option.name]"
291291
ng-options="value.key as value.key for value in option.values | filter: vm.filterAddedOptionValue"></select>
292292
</div>
293293
</div>
294294
</div>
295295
</td>
296-
<td class="col-sm-2">
296+
<td class="col-md-2">
297+
<input id="addingVariationSku" type="text" maxlength="100" class="form-control" ng-model="vm.addingVariation.sku" />
298+
</td>
299+
<td class="col-md-2">
300+
<input id="addingVariationGtin" type="text" maxlength="100" class="form-control" ng-model="vm.addingVariation.gtin" />
301+
</td>
302+
<td class="col-md-2">
297303
<div class="input-number">
298304
<input id="addingVariationPrice" type="text" decimal maxlength="10" class="form-control" ng-model="vm.addingVariation.price" />
299305
<label for="addingVariationPrice" class="form-control">{{vm.addingVariation.price | number}}</label>
300306
</div>
301307
</td>
302-
<td class="col-sm-2">
308+
<td class="col-md-2">
303309
<div class="input-number">
304310
<input id="addingVariationOldPrice" type="text" decimal maxlength="10" class="form-control" ng-model="vm.addingVariation.oldPrice" />
305311
<label for="addingVariationOldPrice" class="form-control">{{vm.addingVariation.oldPrice | number}}</label>
306312
</div>
307313
</td>
308-
<td class="col-sm-2"></td>
309-
<td class="col-sm-2"><button type="button" class="btn btn-primary" ng-disabled="!vm.isAddVariationFormValid()" ng-click="vm.addVariation()"><span class="glyphicon glyphicon-plus"></span></button></td>
314+
<td class="col-md-1"></td>
315+
<td class="col-md-1"><button type="button" class="btn btn-primary" ng-disabled="!vm.isAddVariationFormValid()" ng-click="vm.addVariation()"><span class="glyphicon glyphicon-plus"></span></button></td>
310316
</tr>
311317
</table>
312318
</ng-form>

src/Modules/SimplCommerce.Module.Catalog/wwwroot/admin/product/product-form.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@
131131
name: vm.product.name + ' ' + optionCombinations.map(getItemValue).join(' '),
132132
normalizedName : optionCombinations.map(getItemValue).join('-'),
133133
optionCombinations: optionCombinations,
134-
price : vm.product.price
134+
price: vm.product.price,
135+
oldPrice: vm.product.oldPrice
135136
};
136137
vm.product.variations.push(variation);
137138
} else {
@@ -197,12 +198,15 @@
197198
return item.value;
198199
}).join('-'),
199200
optionCombinations: optionCombinations,
200-
price: vm.addingVariation.price || vm.product.price
201+
price: vm.addingVariation.price || vm.product.price,
202+
oldPrice: vm.addingVariation.oldPrice || vm.product.oldPrice,
203+
sku: vm.addingVariation.sku,
204+
gtin: vm.addingVariation.gtin
201205
};
202206

203207
if (!vm.product.variations.find(function (item) { return item.name === variation.name; })) {
204208
vm.product.variations.push(variation);
205-
vm.addingVariation = { price: vm.product.price };
209+
vm.addingVariation = { price: vm.product.price, oldPrice: vm.product.oldPrice };
206210
} else {
207211
toastr.error('The ' + variation.name + ' has been existing');
208212
}

0 commit comments

Comments
 (0)