Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Jason 22 posts 41 karma points
    Dec 11, 2011 @ 22:42
    Jason
    0

    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.

  • Søren Spelling Lund 1797 posts 2786 karma points
    Dec 12, 2011 @ 09:01
    Søren Spelling Lund
    0

    That's pretty simple to accomplish with dynamic order properties: Dynamic Order Properties: Adding Custom Information to Baskets, Orders, and Order Lines.

  • Jason 22 posts 41 karma points
    Dec 12, 2011 @ 23:21
    Jason
    0

    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 

  • Søren Spelling Lund 1797 posts 2786 karma points
    Dec 13, 2011 @ 12:56
    Søren Spelling Lund
    0

    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:

    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.

    Hope this helps.

Please Sign in or register to post replies

Write your reply to:

Draft