Obtaining the name of the order item which is parent..
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Obtaining the name of the order item which is parent..
I need to be able to take an orderitem input field and display the name of the parent orderitem for that. I know there has to be a way I can do this, like you can show the parent category for a product. I'm just not seeing it.
Can anyone help?
Thanks
Can anyone help?
Thanks
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Re: Obtaining the name of the order item which is parent..
Code: Select all
OrderItemInputCollection inputs = OrderItemInputDataSource.LoadForOrderItem(orderId);
foreach (OrderItemInput input in inputs)
{
Response.Write(input.OrderItem.Name, input.Name, input.InputValue);
}
Nick Cole
http://www.ethofy.com
http://www.ethofy.com
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Obtaining the name of the order item which is parent..
Thank you, Nick. I thought I was going to have to go with a custom query and you saved me from doing that.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Obtaining the name of the order item which is parent..
I'm still stumped, I should have given more details earlier. I worked with the above and I'm still having problems.
I'm trying to populate a DropDownList with the DataTextField for each selection being the input name concatenated with the parent order item name and the DataKey field being OrderItemInputId.
I was able to get the dropdown populated when I used the following on an order that had only one item, but I want the dropdown to include all the items in the order that have inputs grouped into one ddl.
Here is my current code. The object is for the customer to select a print location of something like the front of a business card, then upload an image file is to be used at that location. The file is then saved with the order item name and the input name as part of the file name. Like BusinessCard-Front-thisfile.jpg.
The following works for one item. I know I would need to get rid of the foreach OrderItem.
Thanks
I'm trying to populate a DropDownList with the DataTextField for each selection being the input name concatenated with the parent order item name and the DataKey field being OrderItemInputId.
I was able to get the dropdown populated when I used the following on an order that had only one item, but I want the dropdown to include all the items in the order that have inputs grouped into one ddl.
Here is my current code. The object is for the customer to select a print location of something like the front of a business card, then upload an image file is to be used at that location. The file is then saved with the order item name and the input name as part of the file name. Like BusinessCard-Front-thisfile.jpg.
The following works for one item. I know I would need to get rid of the foreach OrderItem.
Code: Select all
protected void Page_Prerender()
{
//SHOW INPUTS IN DROPDOWN LIST
foreach (OrderItem item in _Order.Items)
{
if (item.Inputs.Count > 0)
{
DropDownListTemplateFields.DataSource = item.Inputs;
DropDownListTemplateFields.DataBind();
DropDownListTemplateFields.DataTextField = "Name";
DropDownListTemplateFields.Items.Insert(0, " - Select Print Location From List - ");
DropDownListTemplateFields.Items.Add("One File for all Print locations");
DropDownListTemplateFields.Items.Add("Sound File(s)");
}
}
}
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Re: Obtaining the name of the order item which is parent..
Judy use the following code
Code: Select all
OrderItemInputCollection orderItemInputs = new OrderItemInputCollection();
foreach (OrderItem item in _Order.Items)
{
if (item.Inputs.Count > 0)
orderItemInputs.AddRange(item.Inputs);
}
DropDownListTemplateFields.DataTextField = "Name";
DropDownListTemplateFields.DataValueField = "InputValue";
DropDownListTemplateFields.DataSource = orderItemInputs;
DropDownListTemplateFields.DataBind();
DropDownListTemplateFields.Items.Insert(0, " - Select Print Location From List - ");
DropDownListTemplateFields.Items.Add("One File for all Print locations");
DropDownListTemplateFields.Items.Add("Sound File(s)");
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Obtaining the name of the order item which is parent..
Thank you mazhar, that puts me a step closer. Now I need to concatenate the orderitem name and the input name.
Do you have a quick fix for that? (I haven't tried yet)
Do you have a quick fix for that? (I haven't tried yet)
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Re: Obtaining the name of the order item which is parent..
For concatenation it could be something like
Code: Select all
OrderItemInputCollection orderItemInputs = new OrderItemInputCollection();
foreach (OrderItem item in _Order.Items)
{
foreach (OrderItemInput orderItemInput in item.Inputs)
{
OrderItemInput aOrderItemInput = new OrderItemInput();
aOrderItemInput.Name = string.Format("{0}({1})", item.Name, orderItemInput.Name);
aOrderItemInput.InputValue = orderItemInput.InputValue;
orderItemInputs.Add(aOrderItemInput);
}
}
DropDownListTemplateFields.DataTextField = "Name";
DropDownListTemplateFields.DataValueField = "InputValue";
DropDownListTemplateFields.DataSource = orderItemInputs;
DropDownListTemplateFields.DataBind();
DropDownListTemplateFields.Items.Insert(0, " - Select Print Location From List - ");
DropDownListTemplateFields.Items.Add("One File for all Print locations");
DropDownListTemplateFields.Items.Add("Sound File(s)");
- jmestep
- AbleCommerce Angel
- Posts: 8164
- Joined: Sun Feb 29, 2004 8:04 pm
- Location: Dayton, OH
- Contact:
Re: Obtaining the name of the order item which is parent..
Thank you again. It will be good to get over this hump and on to other things.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx