uCommerce allowing users to input values on a product
Just download uCommerce and it looks great. One request I am looking for is how to add user input fields on a product. Need the user to be able to enter values such as, one for special instructions (LongText datatype) and one for team name (ShortText dataype) and pass the data onto the order. Any help would be much appreciated.
First thanks for the quick response and for developing uCommerce. It is going to make a lot of developers and clients very happy. Below is a quick mockup to illustrate what I'm looking for. I looked at the dynamic order properties previously and wasn't sure if they would be able to accomplish this as the inputs are product specific. I'm guessing in the sample product.xslt I could hardcode inputs fields then using the dynamic properties to set the values of the input to the properties. But I'd much rather be able to define a product definition and read the fields from xslt to the product page. Maybe have to create multiple product templates for each?.
Thank you for the kind words. They are much appreciated. Really made my day :)
You can use the product definitions to create a dynamic product UI. After all that's what uCommerce does in the backend. However, you will have to use .NET to accomplish that as you need richer meta data than what is available via XSLT.
You'll want to take a look at the product definition associated with the product and iterate over each of the fields there to generate the UI. I would suggest a naming convention for the fields you want the customer to fill out to distiguish them from the other base fields.
Here's some code to show how you could do it:
var product = Product.All().First(); var productDefinition = product.ProductDefinition; foreach (var definitionField in productDefinitionField.Where(x => x.Name.StartsWith("Customer_")) { // render UI based on the data type of the field }
With this in place you can use dynamic order properties to record the input as you mention.
uCommerce allowing users to input values on a product
Just download uCommerce and it looks great. One request I am looking for is how to add user input fields on a product. Need the user to be able to enter values such as, one for special instructions (LongText datatype) and one for team name (ShortText dataype) and pass the data onto the order. Any help would be much appreciated.
That's pretty simple to accomplish with dynamic order properties: Dynamic Order Properties: Adding Custom Information to Baskets, Orders, and Order Lines.
Hi Soren,
First thanks for the quick response and for developing uCommerce. It is going to make a lot of developers and clients very happy. Below is a quick mockup to illustrate what I'm looking for. I looked at the dynamic order properties previously and wasn't sure if they would be able to accomplish this as the inputs are product specific. I'm guessing in the sample product.xslt I could hardcode inputs fields then using the dynamic properties to set the values of the input to the properties. But I'd much rather be able to define a product definition and read the fields from xslt to the product page. Maybe have to create multiple product templates for each?.
Thanks again,
Jason
Hi Jason,
Thank you for the kind words. They are much appreciated. Really made my day :)
You can use the product definitions to create a dynamic product UI. After all that's what uCommerce does in the backend. However, you will have to use .NET to accomplish that as you need richer meta data than what is available via XSLT.
You'll want to take a look at the product definition associated with the product and iterate over each of the fields there to generate the UI. I would suggest a naming convention for the fields you want the customer to fill out to distiguish them from the other base fields.
Here's some code to show how you could do it:
With this in place you can use dynamic order properties to record the input as you mention.
Hope this helps.
is working on a reply...