Page 1 of 1

SKUs in Low Inventory

Posted: Mon Oct 27, 2008 9:55 am
by William_firefold
Our stock manager has asked if we can get a column of SKUs on the /Admin/Reports/LowInventory.aspx page.
It should be possible to get it in there, I was having trouble doing it though.
Can anyone help with this? Thanks.

Re: SKUs in Low Inventory

Posted: Mon Oct 27, 2008 10:17 am
by mazhar
In order to do that first add following method to the report

Code: Select all

 public string GetSku(Object dataItem) 
    {
        ProductInventoryDetail detail = (ProductInventoryDetail)dataItem;
        Product product = ProductDataSource.Load(detail.ProductId);
        return product.Sku;
    }
and then add another column for Sku in InventoryGrid just below the Name column

Code: Select all

 <asp:TemplateField HeaderText="Sku" >
                                <ItemTemplate>
                                    <asp:HyperLink ID="ProductLink" runat="server" Text='<%# GetSku(Container.DataItem) %>' NavigateUrl='<%#Eval("ProductId", "../Products/EditProduct.aspx?ProductId={0}")%>'></asp:HyperLink>
                                </ItemTemplate>
                                <HeaderStyle HorizontalAlign="Left" />
                            </asp:TemplateField>
This will make available another column showing the Sku of the product next to name column.

Re: SKUs in Low Inventory

Posted: Mon Oct 27, 2008 11:27 am
by William_firefold
Thanks mazhar!
You are the Able forums gladiator.