Page 1 of 1
Products Listed for Purchase in Admin
Posted: Tue Dec 13, 2011 1:42 pm
by sweeperq

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?
Re: Products Listed for Purchase in Admin
Posted: Tue Dec 13, 2011 2:07 pm
by sweeperq
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;
}
}