Products with Low Inventory back in stock page.
Posted: Fri Oct 14, 2016 10:53 am
How can I add the sku to this page? When I put parts back in stock its based off sku not product descriptions..
http://forums.ablecommerce.com/
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;
}