bhaveshkrtya wrote:That is what I know but want to know how SpecificationAttribute is implemented in nopcommerce.
It gets alreadyFilteredSpecOptionIds from url parameter. For example in my case if I select Brand = Dell, it appends spec=3 in url. What I want to know if how it links this 3 to Brand = apple? What if I have Brand = "customText"?
Thanks
Bhavesh
See this line
IList<int> alreadyFilteredSpecOptionIds = model.PagingFilteringContext.SpecificationFilter.GetAlreadyFilteredSpecOptionIds(_webHelper);
Then go the defination of the following
GetAlreadyFilteredSpecOptionIds(_webHelper)You will find the following code
public virtual List<int> GetAlreadyFilteredSpecOptionIds(IWebHelper webHelper)
{
var result = new List<int>();
var alreadyFilteredSpecsStr = webHelper.QueryString<string>(QUERYSTRINGPARAM);
if (String.IsNullOrWhiteSpace(alreadyFilteredSpecsStr))
return result;
foreach (var spec in alreadyFilteredSpecsStr.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
{
int specId;
int.TryParse(spec.Trim(), out specId);
if (!result.Contains(specId))
result.Add(specId);
}
return result;
}
In the
public partial class SpecificationFilterModel : BaseNopModel model
Path: Nop.Web\Models\Catalog\CatalogPagingFilteringModel.cs