I have a template that contains the following customer fields: width and height, etc. I don't want the customer to actually enter in these values because they are calculated from a user control. I want to take the values from my user control and enter them into these template fields. The reason for this is so that these fields show up in the order. Is there a way to reference these controls by name? The only way I can conceive of doing this is by looping throw the _Product.ProductTemplate.InputFields. Here's my code I adapted from ProductHelper.cs:
public void FillCustomerTemplateFields()
{
ProductTemplate template = _Product.ProductTemplate;
// COLLECT ANY ADDITIONAL INPUTS
if (template != null)
{
foreach (InputField input in template.InputFields)
{
if (!input.IsMerchantField)
{
switch (input.Name)
{
case "Length":
TextBox test = (TextBox)phOptions.FindControl(input.UniqueId);
test.Text = "value";
break;
}
}
}
}
}
Set a value for Customer Template Field
-
- Lieutenant (LT)
- Posts: 78
- Joined: Wed Mar 05, 2008 11:27 am
Re: Set a value for Customer Template Field
No i think this is the best way to do this in this case.
-
- Lieutenant (LT)
- Posts: 78
- Joined: Wed Mar 05, 2008 11:27 am
Re: Set a value for Customer Template Field
Thanks Mazhar.
Currently, the page displays all of the customer fields, I want them to disappear. I tried to make phOptions invisible, but it also makes the Options and Variants invisible. Is there a way to make them not show up, but still be able to store and retrieve values from them?
Currently, the page displays all of the customer fields, I want them to disappear. I tried to make phOptions invisible, but it also makes the Options and Variants invisible. Is there a way to make them not show up, but still be able to store and retrieve values from them?
Re: Set a value for Customer Template Field
You can set the customer input control visiability to hidden in the BuildProductChoices function of PageHelper class. Locate the following line of code in the method
and make it look like
Code: Select all
phChoices.Controls.Add(o);
Code: Select all
o.Visible = false;
phChoices.Controls.Add(o);
Re: Set a value for Customer Template Field
All good stuff here for customer template fields. Put'em to good use.
Question:
For a customer that needs to enter multiple orderitems with the same customer field (orderiteminput) values, what is the best way to copy all the customer input values from the previous basket item into the new product helper control?
This is being done under /Admin/Orders/PlaceOrder1.aspx as the orderiteminput values are copied to the controls as long as the product template is the same. I don't see the copy function but the ShowProductForm(Product product) populates the input fields, which is exactly what I would need from the store's basket.
I can add a button such as <Create Duplicate Lineitem> but assistance or hints on the copy code would be greatly appreciated! (I understand that there is a code for reorder, but the key here is to have the customer be able to edit as well - such as changing just the number on a serialized "dazzle01, dazzle02, etc...")
Example:
Basket:
SKU = Gadget1
CustomWidth = 20
CustomLength = 10
Serialization = Dazzle01
When <Create Duplicate LineItem> is clicked, Show Product page is displayed with BuyProductDialog populated with values from previous orderitem.
BuyProductDialog:
SKU = Gadget1
CustomWidth = 20
CustomLength = 10
Serialization = Dazzle01
and then Dazzle01 can be changed to Dazzle02
Thanks,
Bruce.
Question:
For a customer that needs to enter multiple orderitems with the same customer field (orderiteminput) values, what is the best way to copy all the customer input values from the previous basket item into the new product helper control?
This is being done under /Admin/Orders/PlaceOrder1.aspx as the orderiteminput values are copied to the controls as long as the product template is the same. I don't see the copy function but the ShowProductForm(Product product) populates the input fields, which is exactly what I would need from the store's basket.
I can add a button such as <Create Duplicate Lineitem> but assistance or hints on the copy code would be greatly appreciated! (I understand that there is a code for reorder, but the key here is to have the customer be able to edit as well - such as changing just the number on a serialized "dazzle01, dazzle02, etc...")
Example:
Basket:
SKU = Gadget1
CustomWidth = 20
CustomLength = 10
Serialization = Dazzle01
When <Create Duplicate LineItem> is clicked, Show Product page is displayed with BuyProductDialog populated with values from previous orderitem.
BuyProductDialog:
SKU = Gadget1
CustomWidth = 20
CustomLength = 10
Serialization = Dazzle01
and then Dazzle01 can be changed to Dazzle02
Thanks,
Bruce.