On the self service portal, when you open the Catalogue, you can select a Category which populates from the Item Sales Categories screen on the main site.
We don’t want to display ALL categories. I added a custom field to the screen to indicate that we want to show the selected category on the portal.

I think I found where the Categories selector is populated on the SSP.
public class PXSelectCategoriesTree : PXSelectBase<INCategory>
{
public PXSelectCategoriesTree(PXGraph graph)
{
this.View = CreateView(graph, new PXSelectDelegate<int?>(categories));
}
public PXSelectCategoriesTree(PXGraph graph, Delegate handler)
{
this.View = CreateView(graph, handler);
}
private PXView CreateView(PXGraph graph, Delegate handler)
{
return new PXView(graph, false,
new Select<INCategory,
Where<INCategory.parentID, Equal<Argument<int?>>>,
OrderBy<Asc<INCategory.sortOrder>>>(),
handler);
}
internal IEnumerable categories([PXInt] int? CategoryID)
{
if (CategoryID == null)
CategoryID = 0;
foreach (var ret in PXSelect<INCategory,
Where<INCategory.parentID, Equal<Required<INCategory.parentID>>>,
OrderBy<Asc<INCategory.sortOrder>>>
.Select(new PXGraph(), CategoryID))
{
//CHECK HERE IF I SHOULD YIELD THE RECORD
yield return ret;
}
}
}I want to be able to add a restriction in the internal IEnumerable categories([PXInt] int? CategoryID) to allow me to check if the category is designated to Display on Portal from my custom field.
There aren’t many lines of code here, so maybe I can just overwrite the entire class???
I tried to the code below, but the code doesn’t even fire in debug mode. I was hoping there was just a simple way to “reject” the category as it is being selected, but I don’t think this is going to work, ever.
I’m showing this code just to prove I tried something… :-)
protected virtual void InventoryLineFilter_RowSelecting(PXCache cache, PXRowSelectingEventArgs e, PXRowSelecting InvokeBaseHandler)
{
if (InvokeBaseHandler != null)
InvokeBaseHandler(cache, e);
var row = (InventoryLineFilter)e.Row;
if (row == null) return;
InventoryLineFilter filter = Base.Filter.Current;
if (filter == null) return;
INCategory category = SelectFrom<INCategory>.Where<INCategory.categoryID.IsEqual<@P.AsInt>>
.View.Select(Base, row.CategoryID);
CummingsSSPINCategoryExt ext = category.GetExtension<CummingsSSPINCategoryExt>();
if (ext == null) return;
if (ext.UsrDisplayOnPortal != true)
{
e.Cancel = true;
}
}Not only do I need to restrict the Category selector, I will also need to restrict the default records showing in the grid when the screen is first opened. By default, it lists everything. Baby steps.