Page 1 of 1

Add to Inventory report?

Posted: Wed Mar 18, 2009 3:34 am
by niall08
Under MANAGE > INVENTORY in the admin, has anyone:

1) Added a new field, like SKU, and been able to sort according to that new field; and
2) Rather than paging used an alphabet-based navigation system to navigate through the inventory items?

The current inventory controls seems fine, but proves to be cumbersome and almost useless when a full inventory is uploaded..

Re: Add to Inventory report?

Posted: Wed Mar 18, 2009 6:14 am
by jmestep
You could probably do that and then change the sort expression in the gridview control:
<cb:SortedGridView ID="InventoryGrid" DefaultSortExpression="Name"

Re: Add to Inventory report?

Posted: Wed Mar 18, 2009 7:01 am
by niall08
No.. I've tried that - it throws an SQL error:

"ORDER BY items must appear in the select list if the statement contains a UNION, INTERSECT or EXCEPT operator"

Re: Add to Inventory report?

Posted: Wed Mar 18, 2009 8:14 am
by mazhar
You can get Sku added to report by first adding follwing metod to code file

Code: Select all

protected string GetSku(Object productId) 
    {
        Product product = ProductDataSource.Load(AlwaysConvert.ToInt(productId));
        return (product != null) ? product.Sku : string.Empty;
    }
and then adding a new column to grid

Code: Select all

 <asp:TemplateField HeaderText="Sku">
                            <ItemStyle HorizontalAlign="Center" />
                            <ItemTemplate>
                                <asp:Label ID="Sku" runat="server" Text='<%# GetSku(Eval("ProductId")) %>' Columns="4"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
In order to enable sort by sku you will need to write your own query, current function does not support order by Sku.

Re: Add to Inventory report?

Posted: Wed Mar 18, 2009 8:17 am
by mazhar
Following options will be available for sorting on report

Code: Select all

ProductId, Name,InStock, InStockWarningLevel

Re: Add to Inventory report?

Posted: Wed Mar 18, 2009 10:33 am
by niall08
Thanks Mazhar - I already had the SKU value added, and removed the "SortExpression" attribute so that the column was effectly dead.

I'll have a look at writing my own query..