How are Custom Fields added to OrderItems in ViewOrder.aspx?
How are Custom Fields added to OrderItems in ViewOrder.aspx?
I want to add a CheckBox to the Order Contents in ViewOrder.aspx (see pic):
How do I update the status of the CheckBox when it has previously been checked?
How do I update the status of the CheckBox when it has previously been checked?
Last edited by Mike718NY on Sun Nov 08, 2009 1:33 pm, edited 1 time in total.
Re: How are Custom Fields added to OrderItems in ViewOrder.aspx?
I don't know how to implement the custom fields to tie it to a checkbox.
I added a checkbox to the Grid: <asp:GridView ID="OrderItemGrid" . . .
<asp:CheckBox ID="chkFlagItem" AutoPostBack="true" OnCheckedChanged="chkFlagItem_CheckedChanged" . . .
I update the database, but don't know how to get the CheckBox status set, using the custom field.
Where would I put this and how would it work with the checkbox:
OrderItem myItem;
myItem.CustomFields["YOURCUSTOMFIELDNAME"] = "your custom field data";
myItem.Save();
string myValue = myItem.CustomFields["YOURCUSTOMFIELDNAME"];
I added a checkbox to the Grid: <asp:GridView ID="OrderItemGrid" . . .
<asp:CheckBox ID="chkFlagItem" AutoPostBack="true" OnCheckedChanged="chkFlagItem_CheckedChanged" . . .
I update the database, but don't know how to get the CheckBox status set, using the custom field.
Code: Select all
protected void chkFlagItem_CheckedChanged(object sender, EventArgs e)
{
CheckBox checkbox = (CheckBox)sender;
GridViewRow row = (GridViewRow)checkbox.NamingContainer;
string productId = ((Label)row.FindControl("lblProdId")).Text;
if (checkbox.Checked) // not working: always returning true and checked
{
string query = "UPDATE ac_OrderItems SET InStock = 1 WHERE ProductId = " + productId + " AND OrderId = " + Request.QueryString["OrderId"];
Microsoft.Practices.EnterpriseLibrary.Data.Database database = Token.Instance.Database;
System.Data.Common.DbCommand updateCommand = database.GetSqlStringCommand(query);
int result = (int)database.ExecuteNonQuery(updateCommand);
checkbox.Checked = true; // not working
}
else
{
string query = "UPDATE ac_OrderItems SET InStock = 0 WHERE ProductId = . . .
..........
checkbox.Checked = false; // not working
}
}
OrderItem myItem;
myItem.CustomFields["YOURCUSTOMFIELDNAME"] = "your custom field data";
myItem.Save();
string myValue = myItem.CustomFields["YOURCUSTOMFIELDNAME"];
Re: How are Custom Fields added to OrderItems in ViewOrder.aspx?
I dont' see a "ac_OrderItemsCustomFields" for order custom fields like there is
for products "ac_ProductCustomFields" in the database? Where are they stored?
for products "ac_ProductCustomFields" in the database? Where are they stored?
Re: How are Custom Fields added to OrderItems in ViewOrder.aspx?
custom fields are being stored in ac_OrderItems, see the CustomFields column. These are stored in key value type fashion.
Re: How are Custom Fields added to OrderItems in ViewOrder.aspx?
I was able add a Product Custom Field using Joe's tutorial, but I have no
idea how to add an Order item custom field. Does anybody know?
idea how to add an Order item custom field. Does anybody know?
Re: How are Custom Fields added to OrderItems in ViewOrder.aspx?
You need to do something like
Code: Select all
orderItem.CustomFields.Add("custom_field_name", "custom_field_value");
Re: How are Custom Fields added to OrderItems in ViewOrder.aspx?
I added that and got:
"The name 'orderItem' does not exist in the current context"
"The name 'orderItem' does not exist in the current context"
Re: How are Custom Fields added to OrderItems in ViewOrder.aspx?
Word "orderItem" provided in above example was representing the OrderItem class object and provided it to just tell you how you can add custom field. Obviously first you need to load order then iterate over its order items and finally add custom field to desired order item.
Re: How are Custom Fields added to OrderItems in ViewOrder.aspx?
>> Obviously first you need to load order then iterate over its order items and finally . .
I hope it's more obvious that I don't know how to do this.
I hope it's more obvious that I don't know how to do this.
Re: How are Custom Fields added to OrderItems in ViewOrder.aspx?
Mazhar -
Look for some sample code on allowing a custom field to appear on the ViewOrder.aspx page.
These links above aren't helping me enough, I'm afraid.
I have a field named "BundleQTY" and I need to display the value in that field that corresponds with each item in the order after checkout.
I'm unsure how to correctly call this value in the codebehind page to adequately display the field value in the .aspx page.
Any help would be greatly appreciated!
Look for some sample code on allowing a custom field to appear on the ViewOrder.aspx page.
These links above aren't helping me enough, I'm afraid.
I have a field named "BundleQTY" and I need to display the value in that field that corresponds with each item in the order after checkout.
I'm unsure how to correctly call this value in the codebehind page to adequately display the field value in the .aspx page.
Any help would be greatly appreciated!