Page 1 of 1

Instock / Out of stock flat on category page.

Posted: Wed Jul 22, 2009 1:19 pm
by kastnerd
I am currently using CatagoryGrid4 to display my products. I would like to show the in stock / Out of stock status but no the actual inventory count.

See this page http://67.225.187.60/Arch-Rims--C21.aspx

Re: Instock / Out of stock flat on category page.

Posted: Fri Jul 24, 2009 6:04 am
by mazhar
Locate following code in your code file

Code: Select all

//OUTPUT RATING
                    if (Token.Instance.Store.Settings.ProductReviewEnabled != CommerceBuilder.Users.UserAuthFilter.None)
                    {
                        itemTemplate1.Controls.Add(new LiteralControl(string.Format("<img src=\"{0}\" /><br />", NavigationHelper.GetRatingImage(product.Rating))));
                    }
and then update it as below

Code: Select all

//OUTPUT RATING
                    if (Token.Instance.Store.Settings.ProductReviewEnabled != CommerceBuilder.Users.UserAuthFilter.None)
                    {
                        itemTemplate1.Controls.Add(new LiteralControl(string.Format("<img src=\"{0}\" /><br />", NavigationHelper.GetRatingImage(product.Rating))));
                    }
if (product.InventoryMode == InventoryMode.Product)
                    { 
                        if(product.InStock > 0)
                            itemTemplate1.Controls.Add(new LiteralControl("In Stock"));
                        else
                            itemTemplate1.Controls.Add(new LiteralControl("Out Stock"));
                    }