Custom Fields for Item Display Pages

When dealing with Item Display pages it's often necessary to display special information and options for a specific item type. The Web Store provides a basic generic mechanism for displaying special fields for these special needs and capturing their input dynamically in the XML properties of the lineitem.

Here's how this works. Let's assume you want to handle a Size for special items like TSHIRTS.

  • You specify the item in inventory to be of a specific type - SHIRT
    Each inventory item can belong to a specific type of your choice. This type causes the Web Store to look for form fields on the Item form that start with the type as prefix. So set the TYPE field to SHIRT.

    If the type field is set, the Web Store performs special processing on the input that is returned from the Item page Post operation, by looking at any HTML POST variable that starts with the type name as a prefix.

  • Create your Item Description and embed a custom field with the type prefix
    Once you have an item configured with a TYPE, you can now place custom input fields into your Long Item Description. You do this by creating any HTML input fields and prefixing the name with the lower case value of the type. For example, we have a type of SHIRT and we want to capture the size for the T-Shirt so we might use shirtSize. For the shirt color we'll use shirtColor.

    You can use any kind of HTML input field, but here you would probably want to create a list with sizes like Large, Medium, Small etc. so a pair of ComboBoxes works best. The following is a short portion of the Long Description for this item:

    This quality TShirt is made in the US of A.
    <select name="shirtSize">
    <select name="shirtColor">

    The Web Store will handle pulling out those values and sticking them into the ExtraText field as a string description so you can display these values. They will look like this:

    West Wind Web Connection T-Shirt

  • Read the value
    Once these values have been saved as part of the order process, you can read the values back using the GetProperty() method of the business object. These values get stored to the LineItem object, so:

    string Size = LineItem.GetProperty("shirtSize")
    string Color = LineItem.GetProperty("shirtColor")

    return these values back to you. GetProperty() returns null if the value doesn't exist. You can use this in your Validate() code for the business object. Note that the key values are case sensitive and based on the field name you used in your HTML form.

    Internally this data is stored in the XML field like this:


    Note that the Web Store's Item page logic parses any extra fields and automatically adds each value to the ExtraText field by stripping of the prefix (shirt) and using the field name as the 'key' and the value as the value to display.

© West Wind Technologies, 1996-2018 • Updated: 11/03/04
Comment or report problem with topic