Bottom line is that I want to list the Kits and the components on the packing list with the Kit Master left justified (no bullet) and the items that make up the kit (the components) with a bullet.
I know how to show this in an email. My order confirmation email has the code for this:
Code: Select all
#if ( ($orderItem.ParentItemId == $MasterID))
<li>$orderItem.Sku</li>
#elseif($orderItem.Product.KitStatus == "Master")
#set ($MasterID = ($orderItem.OrderItemId))
$orderItem.Sku
#elseif($orderItem.Product.KitStatus == "None")
$orderItem.Sku
#else
$orderItem.Sku
#end
I can see the .aspx code is:
Code: Select all
<tr>
<td colspan="3" class="dataSheet">
<asp:GridView ID="ShipmentItems" runat="server" ShowHeader="true"
AutoGenerateColumns="false" CellPadding=0 CellSpacing=0 GridLines="none"
Width="100%" DataSource='<%#GetProducts(Container.DataItem)%>' CssClass="dataSheet">
<Columns>
<asp:BoundField DataField="Quantity" HeaderText="Quantity" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="Sku" HeaderText="Sku" ItemStyle-HorizontalAlign="Center" />
<asp:TemplateField HeaderText="Item">
<ItemTemplate>
<uc:OrderItemDetail ID="OrderItemDetail1" runat="server" OrderItem='<%#(OrderItem)Container.DataItem%>' ShowAssets="False" LinkProducts="False" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</td>
</tr>
Code: Select all
protected OrderItemCollection GetProducts(object dataItem)
{
OrderShipment shipment = (OrderShipment)dataItem;
Order order = shipment.Order;
OrderItemCollection products = new OrderItemCollection();
foreach (OrderItem item in order.Items)
{
if ((item.OrderItemType == OrderItemType.Product) && (item.OrderShipmentId == shipment.OrderShipmentId))
{
products.Add(item);
}
}
products.Sort(new OrderItemComparer());
return products;
}