Products Listed for Purchase in Admin

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
sweeperq
Commodore (COMO)
Commodore (COMO)
Posts: 497
Joined: Tue Jan 03, 2006 2:45 pm

Products Listed for Purchase in Admin

Post by sweeperq » Tue Dec 13, 2011 1:42 pm

:?: Just had an issue where a customer service rep was able to add a product to an order when the product was marked as Private and Disable Purchase. Went into the Admin to see what was going on. Script in question is Admin/Orders/Edit/FindProduct.ascx.

It looks like it uses a GridView that is wired up to ProductDataSource.FindProducts(). I went through the 8 overloads available for this function, and none of them allow you to hide disabled products. Does anyone know of an easy way to hide rows in a GridView, or am I better off re-writing the page?

sweeperq
Commodore (COMO)
Commodore (COMO)
Posts: 497
Joined: Tue Jan 03, 2006 2:45 pm

Re: Products Listed for Purchase in Admin

Post by sweeperq » Tue Dec 13, 2011 2:07 pm

Ok, I figured something out that seems to work:

In Admin/Orders/Edit/FindProduct.ascx, add an onrowdatabound attribute:

Code: Select all

<asp:GridView ID="FindProductSearchResults" runat="server" AutoGenerateColumns="false" DataSourceID="AddProductDs" AllowPaging="true" PageSize="20" AllowSorting="true" Visible="false" SkinID="PagedList" Width="460px" onrowdatabound="FindProductSearchResults_RowDataBound">
In Admin/Orders/Edit/FindProduct.ascx.cs, add a method to handle onrowdatabound:

Code: Select all

protected void FindProductSearchResults_RowDataBound(object sender, GridViewRowEventArgs e)
{
	Product p = e.Row.DataItem as Product;
	if (p != null && (p.DisablePurchase || p.Visibility == CommerceBuilder.Catalog.CatalogVisibility.Private))
	{
		e.Row.Visible = false;
	}
}

Post Reply