Hi,
the code of method is a part of full source code so here is the original method:
/// <summary>
/// Returns html code that represents payment option. Used for generating of invoice.
/// </summary>
/// <param name="dt">Table with the order data</param>
/// <param name="currency">Currency info</param>
/// <param name="renderDiscount">Render discount values</param>
public static string GetProductList(DataTable dt, CurrencyInfo currency, bool renderDiscount)
{
if ((dt != null) && (dt.Rows.Count > 0))
{
StringBuilder sb = new StringBuilder();
// Header
sb.Append(" <table width=\"100%\" style=\"text-align: right\" cellspacing=\"0\" cellpadding=\"2\" class=\"productsList\">");
sb.Append(" <thead><tr><th colspan=\"" + (5 + (renderDiscount ? 1 : 0)) + "\" class=\"headerBorder\"> </th></tr><tr>");
sb.Append(" <th style=\"text-align: left;padding-left:2px\">");
sb.Append(ResHelper.GetString("InvoiceTemplate.SKUName"));
sb.Append(" </th>");
sb.Append(" <th>");
sb.Append(ResHelper.GetString("InvoiceTemplate.SKUUnits"));
sb.Append(" </th>");
sb.Append(" <th>");
sb.Append(ResHelper.GetString("InvoiceTemplate.SKUPrice"));
sb.Append(" </th>");
if (renderDiscount)
{
sb.Append(" <th>");
sb.Append(ResHelper.GetString("InvoiceTemplate.UnitDiscount"));
sb.Append(" </th>");
}
sb.Append(" <th>");
sb.Append(ResHelper.GetString("InvoiceTemplate.Tax"));
sb.Append(" </th>");
sb.Append(" <th>");
sb.Append(ResHelper.GetString("InvoiceTemplate.Subtotal"));
sb.Append(" </th>");
sb.Append("</tr></thead><tbody>");
double value = 0.0;
// Add the items
foreach (DataRow dr in dt.Rows)
{
string name = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(Convert.ToString(DataHelper.GetDataRowValue(dr, "SKUName"))));
// If it is a product option
if (ValidationHelper.GetGuid(DataHelper.GetDataRowValue(dr, "CartItemParentGuid"), Guid.Empty) != Guid.Empty)
{
name = " - " + name;
}
sb.Append("<tr>");
sb.Append(" <td style=\"text-align: left\">");
sb.Append(name);
sb.Append(" </td>");
sb.Append(" <td>");
sb.Append(Convert.ToString(DataHelper.GetDataRowValue(dr, "SKUUnits")));
sb.Append(" </td>");
sb.Append(" <td>");
value = ValidationHelper.GetDouble(DataHelper.GetDataRowValue(dr, "SKUPrice"), 0);
sb.Append(Ecommerce.CurrencyInfoProvider.GetFormatedValue(value, currency));
sb.Append(" </td>");
if (renderDiscount)
{
sb.Append(" <td>");
value = ValidationHelper.GetDouble(DataHelper.GetDataRowValue(dr, "UnitDiscount"), 0);
sb.Append(Ecommerce.CurrencyInfoProvider.GetFormatedValue(value, currency));
sb.Append(" </td>");
}
sb.Append(" <td>");
value = ValidationHelper.GetDouble(DataHelper.GetDataRowValue(dr, "Tax"), 0);
sb.Append(Ecommerce.CurrencyInfoProvider.GetFormatedValue(value, currency));
sb.Append(" </td>");
sb.Append(" <td>");
value = ValidationHelper.GetDouble(DataHelper.GetDataRowValue(dr, "Subtotal"), 0);
sb.Append(Ecommerce.CurrencyInfoProvider.GetFormatedValue(value, currency));
sb.Append(" </td>");
sb.Append("</tr>");
}
sb.Append(" <tr>");
sb.Append(" <td colspan=\"" + (5 + (renderDiscount ? 1 : 0)) + "\" class=\"bottomBorder\"> ");
sb.Append(" </td>");
sb.Append(" </tr>");
sb.Append(" </tbody>");
sb.Append("</table> \n");
return sb.ToString();
}
else
{
return null;
}
}
You can change the method to return requested html code. How to use custom providers is described here:
custom providersThen you can overwrite the method in your
custom order info provider.
Alternatively you could create a custom macro - that will return requested html code (example is in the middle of document):
http://devnet.kentico.com/docs/ecommerceguide/customizing_invoice_and_email_templates.htmBest regards,
Ivana Tomanickova