Skip to content

Commit db1307f

Browse files
committed
Minor fix when adding a product variant attribute
1 parent 7b7fcdb commit db1307f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Presentation/SmartStore.Web/Administration/Controllers/ProductController.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2970,18 +2970,21 @@ public ActionResult ProductVariantAttributeInsert(GridCommand command, ProductMo
29702970
{
29712971
ProductId = model.ProductId,
29722972
// Use ProductAttribute property (not ProductAttributeId) because appropriate property is stored in it.
2973-
ProductAttributeId = int.Parse(model.ProductAttribute),
2973+
ProductAttributeId = model.ProductAttribute.ToInt(),
29742974
TextPrompt = model.TextPrompt,
29752975
CustomData = model.CustomData,
29762976
IsRequired = model.IsRequired,
29772977
// Use AttributeControlType property (not AttributeControlTypeId) because appropriate property is stored in it.
2978-
AttributeControlTypeId = int.Parse(model.AttributeControlType),
2978+
AttributeControlTypeId = model.AttributeControlType.ToInt((int)AttributeControlType.DropdownList),
29792979
DisplayOrder = model.DisplayOrder1
29802980
};
29812981

29822982
try
29832983
{
2984-
_productAttributeService.InsertProductVariantAttribute(pva);
2984+
if (pva.ProductAttributeId != 0)
2985+
{
2986+
_productAttributeService.InsertProductVariantAttribute(pva);
2987+
}
29852988
}
29862989
catch (Exception ex)
29872990
{

0 commit comments

Comments
 (0)