Messaggi totali:
112
Karma:
590
Sottoscritto:
01/01/2010
Località:
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?
Messaggi totali:
187
Karma:
2299
Sottoscritto:
25/11/2009
Località:
United Kingdom
do a count on the number of items in the basket. based on this logic, you can choose which image to display.
Messaggi totali:
112
Karma:
590
Sottoscritto:
01/01/2010
Località:
Pakistan
can u explain with a little more guidance please, I am new to codes and dont have much knowledge
Messaggi totali:
585
Karma:
3231
Sottoscritto:
14/06/2009
Località:
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
Messaggi totali:
112
Karma:
590
Sottoscritto:
01/01/2010
Località:
Pakistan
Thanks Matthew Can you tell me how to check the count and change class accordingly? Sorry I am dumb with codes :(
Messaggi totali:
585
Karma:
3231
Sottoscritto:
14/06/2009
Località:
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; }
Messaggi totali:
112
Karma:
590
Sottoscritto:
01/01/2010
Località:
Pakistan
Thanks Matthew, you are a great ... it worked