HI
I want to know is it possible to display OrderItem Sub itemes in invoice?
Scenario :
Say we sell online ticket that user can buy.tickets have types and each type have it's own set of codes that is defined via a customtable(ex: customtable_ticketcode).
for each type of ticket customer add to his shoppingcart we must pick a number of codes from customtable_ticketcode table based on number of units ordered by customer and display code(s) right below orderitem(ticket) in invoice.
A : one way is overriding GetShoppingCartResolverInternal method such as below :
protected override MacroResolver GetShoppingCartResolverInternal(ShoppingCartInfo cart, bool specialMacros)
{
MacroResolver resolver = base.GetShoppingCartResolverInternal(cart, specialMacros);
DataTable dt = null;
if (!OrderHasBarcode(cart))
{
// is cart created from an existing order
if (cart.Order != null && cart.Order.OrderIsPaid)
{
InfoDataSet<OrderItemInfo> ds = OrderItemInfoProvider.GetOrderItems(cart.Order.OrderID);
if (!DataHelper.DataSourceIsEmpty(ds))
{
foreach (OrderItemInfo oii in ds)
{
DataSet barCodes = GetNewTicketBarcodes(oii, cart);
if (!DataHelper.DataSourceIsEmpty(barCodes))
{
if (dt == null)
{
DataColumn[] columns = new DataColumn[barCodes.Tables[0].Columns.Count];
barCodes.Tables[0].Columns.CopyTo(columns, 0);
dt = GetDataTable(columns);
}
foreach (DataRow dr in barCodes.Tables[0].Rows)
{
int itemId = ValidationHelper.GetInteger(dr["ItemID"], 0);
CustomTableItem barcode = TicketBarcodeProvider.GetItem(itemId, TicketBarcodeTableClass.ClassName);
barcode.SetValue("APTicketTypeOrderID", cart.Order.OrderID);
barcode.SetValue("APTicketTypeOrderItemID", oii.OrderItemID);
barcode.SetValue("APTicketTypeStatus", "USED");
barcode.Update();
dt.Rows.Add(dr.ItemArray);
}
}
}
if (dt != null)
{
resolver.SetNamedSourceData("BarcodeTable", dt.Rows);
}
}
}
}
else
{
DataSet ds = GetTicketBarcodes(cart);
resolver.SetNamedSourceData("BarcodeTable", ds.Tables[0].Rows);
}
return resolver;
}
in this way we can not display Codes that belong to OrderItem right below it by using ApplyTransformation.it display all codes below each order item.
NOTE : inside ContentTable item transformation we call BarcodeTable.ApplyTransformation("ecommerce.transformations.barcode_Table").inside barcode_Table transformation we don't have access to OrderItemID to specifiy that only display bacodes for this orderitem.
B : Display all codes right after all cart itemes displayed.(not the case)
Is there any other toimplement this?