Products with Low Inventory back in stock page.
- compunerdy
- Admiral (ADM)
- Posts: 1283
- Joined: Sun Nov 18, 2007 3:55 pm
Products with Low Inventory back in stock page.
How can I add the sku to this page? When I put parts back in stock its based off sku not product descriptions..
Re: Products with Low Inventory back in stock page.
You can add a new column for sku just after Name. To make this update open Admin/Reports/LowInventory.aspx
Locate the following
and replace with
Now open Admin/Reports/LowInventory.aspx.cs and put the following code some where e.g. below GetName() function
Locate the following
Code: Select all
<asp:TemplateField HeaderText="Name" SortExpression="Name">
<ItemTemplate>
<asp:HyperLink ID="ProductLink" runat="server" Text='<%# GetName(Container.DataItem) %>' NavigateUrl='<%#Eval("ProductId", "../Products/EditProduct.aspx?ProductId={0}")%>'></asp:HyperLink>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left" />
</asp:TemplateField>
Code: Select all
<asp:TemplateField HeaderText="Name" SortExpression="Name">
<ItemTemplate>
<asp:HyperLink ID="ProductLink" runat="server" Text='<%# GetName(Container.DataItem) %>' NavigateUrl='<%#Eval("ProductId", "../Products/EditProduct.aspx?ProductId={0}")%>'></asp:HyperLink>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Sku">
<ItemTemplate>
<asp:Label runat="server" Text='<%# GetSku(Container.DataItem) %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left" />
</asp:TemplateField>
Code: Select all
protected string GetSku(object dataItem)
{
ProductInventoryDetail detail = (ProductInventoryDetail)dataItem;
if (detail.Variant != null && !string.IsNullOrEmpty(detail.Variant.Sku)) return detail.Variant.Sku;
Product product = ProductDataSource.Load(detail.ProductId);
if (product != null && !string.IsNullOrEmpty(product.Sku)) return product.Sku;
return string.Empty;
}
- compunerdy
- Admiral (ADM)
- Posts: 1283
- Joined: Sun Nov 18, 2007 3:55 pm
Re: Products with Low Inventory back in stock page.
That worked great thanks!!
- compunerdy
- Admiral (ADM)
- Posts: 1283
- Joined: Sun Nov 18, 2007 3:55 pm
Re: Products with Low Inventory back in stock page.
How would I sort the manufacturer drop down? Right now it goes off the manufacturer ID number or something and I would prefer it to be alphabetical so I can find the one I am looking for faster.