Page 1 of 1

Customizing OnePageCheckout

Posted: Mon Mar 09, 2009 1:18 pm
by heinscott
Hello. I have recently customized my onepagecheckout control to group order items with their respective shipments. I accomplished this by adding a GridView to the ShipmentList repeater, using the BasketShipment.Items as the datasource.
Here is the modified Repeater:

Code: Select all

<h2 class="sectionHeader">Shipping Method</h2>
									<asp:PlaceHolder ID="MultipleShipmentsMessage" runat="server" EnableViewState="false" Visible="false">
										<br />Your order contains items that must be sent in more than one shipment.  View the order details at the bottom of this page for the contents of each shipment.<br /><br />
									</asp:PlaceHolder>
									<asp:Repeater ID="ShipmentList" runat="server" OnItemDataBound="ShipmentList_ItemDataBound" EnableViewState="false">
										<ItemTemplate>
											<asp:PlaceHolder ID="ShipmentCounter" runat="server" Visible='<%# (ShipmentCount > 1) %>' EnableViewState="false"><b>Shipment <%# (Container.ItemIndex + 1) %>:&nbsp; </b></asp:PlaceHolder>
											<asp:Label ID="ShipMethodListLabel" runat="server" Visible='<%# (ShipmentCount == 1) %>' EnableViewState="false" Text="Select Method:" SkinID="FieldHeader"></asp:Label>&nbsp;
											<asp:DropDownList ID="ShipMethodList" runat="server" DataTextField="Name" DataValueField="ShipMethodId" EnableViewState="false" AutoPostBack="true"></asp:DropDownList><br />
											<asp:PlaceHolder ID="ShipMessagePanel" runat="server" Visible='<%# EnableShipMessage %>'>
												<asp:Label ID="ShipMessageLabel" runat="server" Text="Delivery Instructions?" SkinID="FieldHeader"></asp:Label>&nbsp;
												<asp:TextBox ID="ShipMessage" runat="server" Text="" MaxLength="200" Width="200px"></asp:TextBox>
											</asp:PlaceHolder>
											<br />
											<asp:GridView ID="BasketGrid2" runat="server" AutoGenerateColumns="False" BorderWidth="1px" BorderColor="#999999"
									            ShowFooter="False" Width="100%" SkinID="PagedList" DataSource='<%# ((BasketShipment)Container.DataItem).Items %>'>
									            <Columns>
										            <asp:TemplateField HeaderText="Shipment">
											            <ItemStyle HorizontalAlign="Center" />
											            <HeaderStyle HorizontalAlign="Center" />
											            <ItemTemplate>
												            <%# GetShipmentNumber(Container.DataItem) %>
											            </ItemTemplate>
										            </asp:TemplateField>
										            <asp:TemplateField HeaderText="SKU">
											            <ItemStyle HorizontalAlign="Center" />
											            <HeaderStyle HorizontalAlign="Center" />
											            <ItemTemplate>
												            <%# ProductHelper.GetSKU(Container.DataItem) %>
											            </ItemTemplate>
										            </asp:TemplateField>
										            <asp:TemplateField HeaderText="Item">
											            <ItemStyle HorizontalAlign="Left" />
											            <ItemTemplate>
												            <asp:PlaceHolder ID="ProductPanel" runat="server" Visible='<%#((OrderItemType)Eval("OrderItemType") == OrderItemType.Product)%>'>
													            <uc:BasketItemDetail id="BasketItemDetail1" runat="server" BasketItem='<%#(BasketItem)Container.DataItem%>' ShowAssets="true" ShowSubscription="true" LinkProducts="false" /><br />
												            </asp:PlaceHolder>
												            <asp:PlaceHolder ID="OtherPanel" runat="server" Visible='<%#((OrderItemType)Eval("OrderItemType") != OrderItemType.Product)%>' EnableViewState="false">
													            <%# Eval("Name") %>
												            </asp:PlaceHolder>
											            </ItemTemplate>
										            </asp:TemplateField>
										            <asp:TemplateField HeaderText="Price">
											            <ItemStyle HorizontalAlign="Right" />
											            <ItemTemplate>
												            <%# Eval("Price", "{0:ulc}") %><br />
											            </ItemTemplate>
										            </asp:TemplateField>
										            <asp:TemplateField HeaderText="Qty">
											            <ItemStyle HorizontalAlign="Center" />
											            <ItemTemplate>
												            <%# Eval("Quantity") %>
											            </ItemTemplate>
										            </asp:TemplateField>
										            <asp:TemplateField HeaderText="Total">
											            <ItemStyle HorizontalAlign="Right" />
											            <ItemTemplate>
												            <%# Eval("ExtendedPrice", "{0:ulc}") %>
											            </ItemTemplate>
										            </asp:TemplateField>
									            </Columns>
								            </asp:GridView>
											<br /><br />
										</ItemTemplate>
									</asp:Repeater>
Now, everything works as expected, until the shipping method is changed. If you change the shipping method from the drop down, the order items in the original order items grid will change correctly. The new grid I added, however, will only update with the previously selected shipping method.
Any ideas on how I could fix this?
Thanks for the help,

Scott