Total Posts:
112
Karma:
590
Joined:
1/1/2010
Location:
Pakistan
Hi, I like to use 2 images for the cart i.e. empty and full By default the empty shopping cart image is shown but when any item is added then the cart icon should changed to the one that shows the cart filled. Any idea how to do that?
Total Posts:
187
Karma:
2299
Joined:
11/25/2009
Location:
United Kingdom
do a count on the number of items in the basket. based on this logic, you can choose which image to display.
Total Posts:
112
Karma:
590
Joined:
1/1/2010
Location:
Pakistan
can u explain with a little more guidance please, I am new to codes and dont have much knowledge
Total Posts:
585
Karma:
3231
Joined:
6/14/2009
Location:
New Zealand
You need to alter this in Header.ascx <li><a href="<%=Page.ResolveUrl("~/ShoppingCart.aspx")%>" class="ico-cart"> <%=GetLocaleResourceString("Account.ShoppingCart")%> </a><a href="<%=Page.ResolveUrl("~/ShoppingCart.aspx")%>">(<%=ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart).Count%>)</a> </li> The image has to do with ico-cart so you just need to check whether the count is greater than 0 and change the class accordingly. Hope this helps. Thanks, Matthew
Total Posts:
112
Karma:
590
Joined:
1/1/2010
Location:
Pakistan
Thanks Matthew Can you tell me how to check the count and change class accordingly? Sorry I am dumb with codes :(
Total Posts:
585
Karma:
3231
Joined:
6/14/2009
Location:
New Zealand
For a really really dirsty hack in header.ascx you could replaceUNTESTED <li><a href="<%=Page.ResolveUrl("~/ShoppingCart.aspx")%>" class="ico-cart"> <%=GetLocaleResourceString("Account.ShoppingCart")%> </a><a href="<%=Page.ResolveUrl("~/ShoppingCart.aspx")%>">(<%=ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart).Count%>)</a> </li> with <%if (ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart).Count > 0) { %> <li><a href="<%=Page.ResolveUrl("~/ShoppingCart.aspx")%>" class="ico-cart-fill"> <%=GetLocaleResourceString("Account.ShoppingCart")%> </a><a href="<%=Page.ResolveUrl("~/ShoppingCart.aspx")%>">(<%=ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart).Count%>)</a> </li> <%} else { %> <li><a href="<%=Page.ResolveUrl("~/ShoppingCart.aspx")%>" class="ico-cart"> <%=GetLocaleResourceString("Account.ShoppingCart")%> </a><a href="<%=Page.ResolveUrl("~/ShoppingCart.aspx")%>">(<%=ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart).Count%>)</a> </li> <%} %> then create a new class in master.css like .header .ico-cart-fill { background: url('images/ico-cart-fill.gif') no-repeat; padding-left: 20px; padding-bottom: 5px; }
Total Posts:
112
Karma:
590
Joined:
1/1/2010
Location:
Pakistan
Thanks Matthew, you are a great ... it worked