Kentico CMS provides a new customization model that allows you to modify each available provider very easily. For example, if you need to extend the shopping cart's content table and include a custom field that you have defined in the Site manager -> Development -> System tables -> edit COM_SKU table, all you need to do is to override the CreateContentTableInternal and CreateContentRowInternal methods of the ShoppingCartInfoProvider class.

First, you need to call their base versions and then modify the returned DataTable (in the CreateContentTableInternal ) and DataRow (in the CreateContentRowInternal) as is demonstrated here:

protected override DataTable CreateContentTableInternal()
{
DataTable dt = base.CreateContentTableInternal();
dt.Columns.Add(new DataColumn("<column name>", typeof(<type>)));
return dt;
}

protected override DataRow CreateContentRowInternal(ShoppingCartItemInfo item, DataTable table)
{
DataRow row = base.CreateContentRowInternal(item, table);
row["<column name>"] = item.SKUObj.GetValue("<SKU field name>");
return row;
}


Then you can, for example, reference the custom field in the transformation, applied to the content table, by doing this: 

{% ContentTable.ApplyTransform(String transformationName, String contentBeforeTransformationName, String contentAfterTransformationName) #% }


Links to other resources: E-commerce 6: New customization model, Transformations in macro expressions
 
-ml-
 
0 ratings
Sitemap | Content Management System | E-commerce Software | Social Networking Software | Intranet | Online Marketing Solution | Copyright © 2004-2013 Kentico Software | Powered by Kentico CMS