diff --git a/Libraries/Hotcakes.Commerce/Catalog/Variant.cs b/Libraries/Hotcakes.Commerce/Catalog/Variant.cs
index 5484427ea..c2ffa3486 100644
--- a/Libraries/Hotcakes.Commerce/Catalog/Variant.cs
+++ b/Libraries/Hotcakes.Commerce/Catalog/Variant.cs
@@ -71,6 +71,11 @@ public Variant()
///
public decimal Price { get; set; }
+ ///
+ /// The Custom Property to add further variant details
+ ///
+ public string CustomProperty { get; set; }
+
///
/// These are the options that define the variant.
///
diff --git a/Libraries/Hotcakes.Commerce/Catalog/VariantRepository.cs b/Libraries/Hotcakes.Commerce/Catalog/VariantRepository.cs
index ff2321cb1..cfd752766 100644
--- a/Libraries/Hotcakes.Commerce/Catalog/VariantRepository.cs
+++ b/Libraries/Hotcakes.Commerce/Catalog/VariantRepository.cs
@@ -66,6 +66,7 @@ protected override void CopyDataToModel(hcc_Variants data, Variant model)
}
model.Sku = data.Sku ?? string.Empty;
model.StoreId = data.StoreId;
+ model.CustomProperty = data.CustomProperty;
}
protected override void CopyModelToData(hcc_Variants data, Variant model)
@@ -76,6 +77,7 @@ protected override void CopyModelToData(hcc_Variants data, Variant model)
data.SelectionData = Json.ObjectToJson(model.Selections);
data.Sku = model.Sku;
data.StoreId = model.StoreId;
+ data.CustomProperty = model.CustomProperty;
}
diff --git a/Libraries/Hotcakes.Commerce/Data/EF/HccDbContext.edmx b/Libraries/Hotcakes.Commerce/Data/EF/HccDbContext.edmx
index 1b118d851..1917353fc 100644
--- a/Libraries/Hotcakes.Commerce/Data/EF/HccDbContext.edmx
+++ b/Libraries/Hotcakes.Commerce/Data/EF/HccDbContext.edmx
@@ -756,7 +756,7 @@
-
+
@@ -1551,7 +1551,8 @@
-
+
+
@@ -3542,6 +3543,7 @@
+
@@ -4364,7 +4366,7 @@
-
+
@@ -5763,6 +5765,7 @@
+
@@ -6251,7 +6254,7 @@
-
+
diff --git a/Libraries/Hotcakes.Commerce/Data/EF/hcc_Variants.cs b/Libraries/Hotcakes.Commerce/Data/EF/hcc_Variants.cs
index 7b286be14..e40f17d44 100644
--- a/Libraries/Hotcakes.Commerce/Data/EF/hcc_Variants.cs
+++ b/Libraries/Hotcakes.Commerce/Data/EF/hcc_Variants.cs
@@ -20,7 +20,8 @@ public partial class hcc_Variants
public decimal Price { get; set; }
public string SelectionData { get; set; }
public long StoreId { get; set; }
-
+ public string CustomProperty { get; set; }
+
public virtual hcc_Product hcc_Product { get; set; }
}
}
diff --git a/Website/DesktopModules/Hotcakes/Core/Admin/Catalog/ProductChoices_Variants.aspx b/Website/DesktopModules/Hotcakes/Core/Admin/Catalog/ProductChoices_Variants.aspx
index 1bbbf8225..927589976 100644
--- a/Website/DesktopModules/Hotcakes/Core/Admin/Catalog/ProductChoices_Variants.aspx
+++ b/Website/DesktopModules/Hotcakes/Core/Admin/Catalog/ProductChoices_Variants.aspx
@@ -19,7 +19,7 @@
title: "Edit Variant",
width: 500,
height: 'auto',
- maxHeight: 500,
+ maxHeight: 600,
parentElement: '#<%=pnlEditVariant.ClientID%>',
close: function () {
<%= ClientScript.GetPostBackEventReference(lnkCancel, "") %>
@@ -120,8 +120,17 @@
+
+
-
diff --git a/Website/DesktopModules/Hotcakes/Core/Admin/Catalog/ProductChoices_Variants.aspx.cs b/Website/DesktopModules/Hotcakes/Core/Admin/Catalog/ProductChoices_Variants.aspx.cs
index 4f9ea44cd..2f6b88688 100644
--- a/Website/DesktopModules/Hotcakes/Core/Admin/Catalog/ProductChoices_Variants.aspx.cs
+++ b/Website/DesktopModules/Hotcakes/Core/Admin/Catalog/ProductChoices_Variants.aspx.cs
@@ -171,6 +171,8 @@ protected void btnSave_Click(object sender, EventArgs e)
item.Price = Money.RoundCurrency(p);
}
+ item.CustomProperty = txtVariantCustomProperty.Text;
+
if (ucVariantImage.HasFile)
{
DiskStorage.CopyProductVariantImage(HccApp.CurrentStore.Id, ProductId, item.Bvin,
@@ -194,6 +196,7 @@ private void ShowDialog()
lblVariantDescription.Text = GetVariantDescription(variant);
txtVariantSku.Text = string.IsNullOrEmpty(variant.Sku) ? _currentProduct.Sku : variant.Sku;
txtVariantPrice.Text = (variant.Price < 0 ? _currentProduct.SitePrice : variant.Price).ToString("c");
+ txtVariantCustomProperty.Text = variant.CustomProperty;
ucVariantImage.ImageUrl = DiskStorage.ProductVariantImageUrlMedium(HccApp, _currentProduct.Bvin,
_currentProduct.ImageFileSmall, variant.Bvin, HccApp.IsCurrentRequestSecure());
diff --git a/Website/DesktopModules/Hotcakes/Core/Admin/Catalog/ProductChoices_Variants.aspx.designer.cs b/Website/DesktopModules/Hotcakes/Core/Admin/Catalog/ProductChoices_Variants.aspx.designer.cs
index 7ba976370..ad2d0af39 100644
--- a/Website/DesktopModules/Hotcakes/Core/Admin/Catalog/ProductChoices_Variants.aspx.designer.cs
+++ b/Website/DesktopModules/Hotcakes/Core/Admin/Catalog/ProductChoices_Variants.aspx.designer.cs
@@ -165,6 +165,15 @@ public partial class ProductChoices_Variants {
///
protected global::System.Web.UI.WebControls.TextBox txtVariantPrice;
+ ///
+ /// txtVariantCustomProperty control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.TextBox txtVariantCustomProperty;
+
///
/// lnkSaveVariant control.
///
diff --git a/Website/DesktopModules/Hotcakes/Providers/DataProviders/SqlDataProvider/03.02.03.SqlDataProvider b/Website/DesktopModules/Hotcakes/Providers/DataProviders/SqlDataProvider/03.02.03.SqlDataProvider
new file mode 100644
index 000000000..74083edc0
--- /dev/null
+++ b/Website/DesktopModules/Hotcakes/Providers/DataProviders/SqlDataProvider/03.02.03.SqlDataProvider
@@ -0,0 +1,12 @@
+/*
+ Issue #221
+ SI: SI: Add Special Properties to Variants
+ https://github.com/HotcakesCommerce/hotcakes-commerce-core/issues/221
+*/
+/* Add property to Product Choice Variants */
+IF NOT EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '{objectQualifier}hcc_Variants' AND COLUMN_NAME = 'CustomProperty')
+BEGIN
+ ALTER TABLE {databaseOwner}[{objectQualifier}hcc_Variants] ADD
+ [CustomProperty] [nvarchar](max) NOT NULL DEFAULT ''
+END
+GO