Page 1 of 1

HELP! Checkout Button Empties Basket

Posted: Mon Jun 15, 2009 2:46 pm
by ZLA
On my dev machine, I can no longer checkout. After adding an item to the cart, if I View Cart and click on Checkout, it redirects to the same page with a message that "Your Cart is Empty". I've stepped through the code and ac_BasketItems gets cleared when BasketHelper.SaveBasket(BasketGrid) is called, specifically when that method calls item.Save. It was working yesterday but not today.

I'm still looking into what changes I made in code or in the underlying data but I thought someone might be able to tell me the obvious things to check.

Thanks.

Re: HELP! Checkout Button Empties Basket

Posted: Mon Jun 15, 2009 3:00 pm
by afm
Database full and out of disk space can cause that behavior.

Re: HELP! Checkout Button Empties Basket

Posted: Mon Jun 15, 2009 3:08 pm
by ZLA
I found my error. We don't want customers to select quantity. All our items are personalized and the quantity will always be 1. But making the updowncontrol always non visible screws up its value in Basket.ascx.

Here's the customized code:

Code: Select all

                            <asp:PlaceHolder ID="ProductQuantityPanel" runat="server" Visible='False'>
                                <cb:updowncontrol MinValue="0"  id="Quantity" runat="server" MaxValue="32767" DownImageUrl="~/images/down.gif" UpImageUrl="~/images/up.gif" Columns="2" MaxLength="5" Text='<%# Eval("Quantity") %>' onFocus="this.select()"></cb:updowncontrol>
                            </asp:PlaceHolder>
                            <asp:PlaceHolder ID="OtherQuantityPanel" runat="server" Visible='True' EnableViewState="false">
                                <%#Eval("Quantity")%>
                            </asp:PlaceHolder>
I suspect this is a deficiency of the underlying GridView. Guess I'll have to make it visible but css display:none.

Thank you anyway for the suggestion.

Re: HELP! Checkout Button Empties Basket

Posted: Tue Jun 16, 2009 8:34 am
by AbleMods
It doesn't screw it up, it just doesn't get set. The default value of '1' is established in the updown control.

Establishing the quantity value in the code should resolve the issue.

Re: HELP! Checkout Button Empties Basket

Posted: Tue Jun 16, 2009 8:43 am
by mazhar

Re: HELP! Checkout Button Empties Basket

Posted: Tue Jun 16, 2009 8:52 am
by ZLA
I went with CSS. Very simple to implement and the least impact. Here's what I changed the markup to:

Code: Select all

<ItemTemplate>
    <asp:PlaceHolder ID="ProductQuantityPanel" runat="server" 
            Visible='<%#((OrderItemType)Eval("OrderItemType") == OrderItemType.Product)%>'>
        <cb:updowncontrol CssClass="HiddenPanel" MinValue="0"  id="Quantity" runat="server" MaxValue="32767"
            DownImageUrl="~/images/down.gif" UpImageUrl="~/images/up.gif" Columns="2" MaxLength="5" 
           Text='<%# Eval("Quantity") %>' onFocus="this.select()"></cb:updowncontrol>
    </asp:PlaceHolder>
    <asp:PlaceHolder ID="OtherQuantityPanel" runat="server" Visible='True' EnableViewState="false">
        <%#Eval("Quantity")%>
    </asp:PlaceHolder>							
</ItemTemplate>
I just added CssClass="HiddenPanel" to the updowncontrol and made OtherQuantityPanel always visible.