Showing Basket Item Count

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Showing Basket Item Count

Post by mazhar » Tue Jul 29, 2008 6:06 am

Create a BasketItems.ascx file in ConLib/Custom and put the following code in it. Use it where you want to show basket item count

Code: Select all

<%@ Control Language="C#" ClassName="BasketItems" %>
<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        MessageLabel.Text = String.Format(MessageLabel.Text, Token.Instance.User.Basket.Items.Count, (Token.Instance.User.Basket.Items.Count > 1) ? "s" : string.Empty);
    }
</script>
<asp:Label ID="MessageLabel" runat="server" Text="You have {0} item{1} in your " /><asp:HyperLink NavigateUrl="~/Basket.aspx" Text="CART" runat="server"></asp:HyperLink>

Post Reply