Page 1 of 1

Indicate locked/hidden items in admin create order

Posted: Mon Oct 10, 2011 9:31 am
by mouse_8b
Hello,
In the admin create order screen, is there a way to indicate on the search results if an item is locked or hidden?

Thanks

Re: Indicate locked/hidden items in admin create order

Posted: Mon Oct 10, 2011 3:25 pm
by FredM
Hello,
This is something that would need to be customized. By default you can only tell if an item is locked / hidden by viewing the category it is in.

Re: Indicate locked/hidden items in admin create order

Posted: Wed Oct 12, 2011 11:36 am
by mouse_8b
I'm fine with customizations, I just don't know what to look for or what to change.

Re: Indicate locked/hidden items in admin create order

Posted: Wed Oct 12, 2011 5:17 pm
by david-ebt
Are you interested in see if the product is public, private or hidden? If you're okay with a numerical representation, it's a pretty easy change. Looking at the CreateOrder2.aspx page, look for the FindProductSearchResults gridview control. Inside that control you'll find this code:

Code: Select all

<asp:BoundField DataField="Sku" HeaderText="SKU" SortExpression="Sku" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
Change it to this:

Code: Select all

<asp:BoundField DataField="Sku" HeaderText="SKU" SortExpression="Sku" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="VisibilityId" HeaderText="Visible" SortExpression="VisibilityId" />
And the search results will display the VisibilityID.
0 = Public
1 = Private
2 = Hidden

If you want the actual words you'll need to create a function in the code behind page that returns the correct text when you pass in the VisibilityID.

The function would look like this:

Code: Select all

	protected string GetVisible(object dataItem)
	{
		Product product = (Product)dataItem;
		switch (product.VisibilityId)
		{
		case 0:
			return "Public";
		case 1:
			return "Private";
		case 2:
			return "Hidden";
		default:
			return "Unknown";
		}
	}
and the gridview code would change to this:

Code: Select all

<asp:BoundField DataField="Sku" HeaderText="SKU" SortExpression="Sku" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:TemplateField HeaderText="Visible" SortExpression="VisibilityId">
    <ItemStyle HorizontalAlign="center" />
    <ItemTemplate>
        <asp:Label ID="VisibleLabel" runat="server" Text='<%# GetVisible(Container.DataItem) %>'></asp:Label>
    </ItemTemplate>
</asp:TemplateField>
Is that what you are trying to do? Or hopefully it will at least point you in the right direction.

Re: Indicate locked/hidden items in admin create order

Posted: Fri Oct 14, 2011 4:51 pm
by mouse_8b
Thank you! This is exaclty what I needed.

If you want the backstory: We sell pet food. Each bag comes in 3 sizes. Our POS syncs each product to AC, which results in each size of food having its own product. For most foods, I have made a product that puts those 3 sizes as 3 variants and locked the original products. When I search for a food to add to an order, it will be much easier to tell which product to select now.

Again, thanks!

Re: Indicate locked/hidden items in admin create order

Posted: Fri Oct 14, 2011 7:10 pm
by david-ebt
Happy to be of assistance!