API for Multi Vendor

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
8 years ago
Got it.  Thanks
8 years ago
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
8 years ago
and also note filterableSpecificationAttributeOptionIds it is pass by out keyword . For more about out in c# keyword go through the  http://www.dotnetperls.com/out
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.