Add a custom field to Orders tab in Kentico 7

   —   
Add a custom field to Orders tab in Kentico 7
The following article shows how to add a custom field in Kentico 7 to E-commerce -> Orders.
In order to successfully add a new custom field, please follow these instructions:

1) Go to Site manager -> Development -> System tables -> Ecommerce –> Order -> Fields
Add a new text field with:
Column name = MyField
Attribute type = Text
Attribute size = 250
Field caption = My Field
Form control = Text box

2) Open the file ~/CMSModules/Ecommerce/ Pages/Tools/Orders/Order_List.xml and add a new column:
<column name="MyField" source="##ALL##" externalsourcename="MyField" caption="My field caption" wrap="false"> </column>

3) Open the file ~/CMSModules/Ecommerce/Controls/UI/OrderList.ascx.cs and in method gridElem_OnExternalDataBound add a new case switch like:
case "myfield": dr = (DataRowView)parameter; int orderId2 = ValidationHelper.GetInteger(dr["OrderID"], 0); OrderInfo myOrderInfo = CMS.Ecommerce.OrderInfoProvider.GetOrderInfo(orderId2); string MyFieldValue = myOrderInfo.GetStringValue("MyField", ""); return MyFieldValue;

4) Add some value to MyField, go to E-commerce -> Orders and you should see the new field with its value:
-rs-


Applies to: Kentico 7.x
Share this article on   LinkedIn

Martin Danko

Let me guide you on your journey of success. I will show you how to optimize your content production with Kentico Draft. Check out www.kenticocloud.com