Even better would be to replace them with checkboxes which could be used to turn on/off the Published flag, like this:
Replace:
Code:
ltPublished.Text = (myrow["Published"].ToString() == "0" ? "No" : "Yes");
With this:
Code:
ltPublished.Text = "<input type=\"checkbox\" name=\"Published_" + myrow["VariantID"].ToString() + "\"" + CommonLogic.IIF(myrow["Published"].ToString() == "1", " checked ","") + ">";
And in, entityProductVariantsOverview.aspx.cs protected void btnUpdate_Click(object sender, EventArgs e) around about line 365+
Replace:
Code:
DB.ExecuteSQL("update ProductVariant set IsDefault=0 where ProductID=" + pID.ToString());
with this:
Code:
DB.ExecuteSQL("update ProductVariant set IsDefault=0, Published=0 where ProductID=" + pID.ToString());
This sets all of the ProductVariants to UnPublished at the beginning of the update function. Then
Replace this:
Code:
for (int i = 0; i <= Request.Form.Count - 1; i++)
{
if (Request.Form.Keys[i].IndexOf("DisplayOrder_") != -1)
{
String[] keys = Request.Form.Keys[i].Split('_');
int VariantID = Localization.ParseUSInt(keys[1]);
int DispOrd = 1;
try
{
DispOrd = Localization.ParseUSInt(Request.Form[Request.Form.Keys[i]]);
}
catch { }
DB.ExecuteSQL("update productvariant set DisplayOrder=" + DispOrd.ToString() + " where VariantID=" + VariantID.ToString());
}
}
with this:
Code:
for (int i = 0; i <= Request.Form.Count - 1; i++)
{
if (Request.Form.Keys[i].IndexOf("DisplayOrder_") != -1)
{
String[] keys = Request.Form.Keys[i].Split('_');
int VariantID = Localization.ParseUSInt(keys[1]);
int DispOrd = 1;
try
{
DispOrd = Localization.ParseUSInt(Request.Form[Request.Form.Keys[i]]);
}
catch { }
DB.ExecuteSQL("update productvariant set DisplayOrder=" + DispOrd.ToString() + " where VariantID=" + VariantID.ToString());
}
if (Request.Form.Keys[i].IndexOf("Published_") != -1)
{
String[] keys = Request.Form.Keys[i].Split('_');
int VariantID = Localization.ParseUSInt(keys[1]);
int Published = 1;
try
{
Published = Localization.ParseUSInt(Request.Form[Request.Form.Keys[i]]);
}
catch { }
DB.ExecuteSQL("UPDATE [ProductVariant] SET [Published]=1 WHERE [VariantID]=" + VariantID.ToString());
}
}
The new second part turns on the Published flag where the checkbox has been ticked in the form.