November Happy Hour will be moved to Thursday December 5th.

Send input data to OrderFormEx Input Fields - HELP!!

Vote:
 

I am working with a messy installation of CMS6 R2.  Normally, according to the documentation, it would be really easy to access the new metafields added to the Order Form.  Not so for me.  I have now  been working all night at this.  I have 12 new input fields on a page.  They have equivalent metafields in the OrderFormEx metaclass.  But I cannot figure out what the syntax would be to simply assign the values of the input boxes to the metafields.

I have dug through the site, and I am sure this is more than obvious, but not to me.  

For example:

on the .aspx page:



* <%: translations.customerinformationiddateofbirth %>:






I need to map that to the "IDDOB" metafield on "OrderFormEx".

HELP! 

Thank you!

#112851
Nov 06, 2014 11:54
Vote:
 

Solved it. For anyone else who hasn't found the documentation for it, here is the answer:

For this example, the main page is called NewCustomer.aspx.  Input fields have been added to an asp UpdatePanel named ClientInfo (ClientInfo.ascx) that is part of the NewCustomer.aspx page. There are three types of input fields that have been added to this page -- a straight text input box, ID "BirthCity", a dropdown selection box with the ID "BirthCountry" and input box named 'DOB" which is using jQuery Datepicker calendar to select the date.

The following metafields were created in CommerceManager and added to the OrderForm (OrderFormEx): CityOfBirth - Short String, CountryOfBirth - Short String, IDDOB - Short String.

This code is added to the code behind (ClientInfo.ascx.cs).

===========================================

public OrderForm CaptureMetaFields

{
    get
    {
        var orderForm = new OrderForm();

        if (BirthCity.Value != null)
            orderForm["CityOfBirth"] = BirthCity.Value;
        if (BirthCountry.SelectedItem != null)
            orderForm["CountryOfBirth"] = BirthCountry.SelectedItem.Text;
        if (DOB.Text != null)
            orderForm["IDDOB"] = DOB.Text;

        return orderForm;
    }
}

=====================================

NOTE: There is a "get".  There is no "set".

This code was added to code behind for NewCustomer (NewCustomer.aspx.cs) 

=====================================

// Insert OrderForm MetaFields
var orderFormId = ClientInfo.CaptureMetaInfo;
purchaseOrder.OrderForms[0]["CityOfBirth"] = orderFormId["CityOfBirth"];
purchaseOrder.OrderForms[0]["CountryOfBirth"] = orderFormId["CountryOfBirth"];
purchaseOrder.OrderForms[0]["IDDOB"] = orderFormId["IDDOB"];

purchaseOrder.AcceptChanges();

========================================

These two steps populated the fields in the database table OrderFormEx.

#113232
Nov 16, 2014 19:04
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.