
Originally Posted by
AspDotNetStorefront Staff - Jao
If you have the source please apply this modification
Great!!
Thank you very much!
I wanted the manufacturer filter to be displayed always when a category has no subcategories, so i modified EntityPageFilterOptions this way:
(i'm not interested in other filters, so i deleted that part)
Code:
public virtual string EntityPageFilterOptions(string sEntityName, String sEntityID, String sSectionFilterID, String sCategoryFilterID, String sManufacturerFilterID, String sProductTypeFilterID)
{
InputValidator IV = new InputValidator("EntityPageFilterOptions");
String EntityName = IV.ValidateString("EntityName", sEntityName);
int EntityID = IV.ValidateInt("EntityID", sEntityID);
int SectionFilterID = IV.ValidateInt("SectionFilterID", sSectionFilterID);
int CategoryFilterID = IV.ValidateInt("CategoryFilterID", sCategoryFilterID);
int ManufacturerFilterID = IV.ValidateInt("ManufacturerFilterID", sManufacturerFilterID);
int ProductTypeFilterID = IV.ValidateInt("ProductTypeFilterID", sProductTypeFilterID);
StringBuilder results = new StringBuilder("");
bool m_AllowEntityPageFiltering = AppLogic.AppConfigBool("AllowEntityPageFiltering") &&
(EntityName.Equals("CATEGORY", StringComparison.InvariantCultureIgnoreCase) ||
EntityName.Equals("SECTION", StringComparison.InvariantCultureIgnoreCase) ||
EntityName.Equals("MANUFACTURER", StringComparison.InvariantCultureIgnoreCase));
bool m_AllowManufacturerFiltering = AppLogic.AppConfigBool("AllowManufacturerFiltering");
bool m_AllowProductTypeFiltering = AppLogic.AppConfigBool("AllowProductTypeFiltering");
string postbackurl = SE.MakeEntityLink(EntityName, EntityID, "");
if ((m_AllowManufacturerFiltering) &&
(EntityName.Equals("CATEGORY", StringComparison.InvariantCultureIgnoreCase)) &&
(!AppLogic.CategoryEntityHelper.EntityHasSubs(EntityID))
)
{
results.Append("<form id=\"FilterForm\" name=\"FilterForm\" method=\"GET\" action=\"" + postbackurl + "\">\n");
String QS = CommonLogic.ServerVariables("QUERY_STRING");
//results.Append("<a href=\"" + CommonLogic.GetThisPageName(false) + "?" + QS + CommonLogic.IIF(QS.Length == 0, "?", "&") + "resetfilters=true&entityname=" + EntityName + "&entityid=" + EntityID.ToString() + "\">RESET FILTERS</a> ");
results.Append("<br />" + AppLogic.GetString("AppConfig.ManufacturerPromptSingular", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) + ": <select size=\"1\" name=\"ManufacturerFilterID\" onChange=\"document.FilterForm.submit();\">\n");
results.Append("<OPTION VALUE=\"0\" " + CommonLogic.IIF(ManufacturerFilterID == 0, " selected ", "") + ">" + AppLogic.GetString("searchadv.aspx.9", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) + " " + AppLogic.GetString("AppConfig.ManufacturerPromptPlural", ThisCustomer.SkinID, ThisCustomer.LocaleSetting) + "</option>\n");
EntityHelper ManufacturerHelper = AppLogic.LookupHelper("Manufacturer");
String MfgSel = ManufacturerHelper.GetEntitySelectList(0, String.Empty, 0, ThisCustomer.LocaleSetting, false);
// mark current Section:
MfgSel = MfgSel.Replace("<option value=\"" + ManufacturerFilterID.ToString() + "\">", "<option value=\"" + ManufacturerFilterID.ToString() + "\" selected>");
results.Append(MfgSel);
results.Append("</select>\n");
results.Append(" ");
results.Append("</form>");
}
return results.ToString();
}