I want to have a page that lists products in a category, each product with its own row.
Each row should have the ability to let the customer select options for that product and add it to their cart.
I modified the CategoryListPage and added the BuyProductDialog to it and got it to display correctly, however, I have two major problems.
1) When any Add To Cart button is clicked it fires off a validation request and shows the validation errors in all ByProductDialog controls on the whole page, not just the one the button was clicked in.
2) When the Add To Cart button is clicked the event never gets back to the server. I've stepped through the javascript (thank you Visual Studio 2008) and don't see anything obviously wrong but I'm no javascript expert. The code on the server for that button is just never fired off.
As far as I can tell BuyProductDialog was really intended to only be used on a product page where there would only be one of them. I think I'm abusing it since I want to show multiple instances on one page and they're getting confused. Currently I've directly embedded a call to the BuyProductDialog right in my custom version of CategoryListPage. The item template now looks like this:
Code: Select all
<ItemTemplate>
<div style="float:left;width:66%" id="ProductDetailsDiv" runat="server">
<asp:PlaceHolder ID="phItemTemplate1" runat="server"></asp:PlaceHolder>
</div>
<div style="margin-top:10px;margin-bottom:20px;float:right;width:34%" id="BuyProductDiv" runat="server" visible='<%#((CatalogNodeType)Eval("CatalogNodeType")) == CatalogNodeType.Product %>'>
<uc:ProductPrice ID="Price" runat="server" Product='<%#Container.DataItem%>' />
<asp:PlaceHolder ID="phItemTemplate2" runat="server"></asp:PlaceHolder>
<uc:BuyProduct ID="BuyProduct" runat="server" ShowWishlist="false" CompactMode="true" ShowMSRP="false" ShowPrice="false" ShowSku="false" ShowSubscription="false" Product='<%#Eval("ChildObject")%>' visible='<%#((CatalogNodeType)Eval("CatalogNodeType")) == CatalogNodeType.Product %>' />
</div>
</ItemTemplate>