Hi All,

I am no good at Linq but I need to try and modify the following filter Linq:

Nop.Services.Catalog.SpecificationAttributeService.GetSpecificationAttributeOptionFilter

I need to only return products that have their specificationattributeoptionid contained in a list of Specificationattributeoptionid's.

I.e I gave a List<Int32> of spec id's, such as 1,2,3,4 etc

I need to amend:

var query = from p in _productRepository.Table
                            from pv in p.ProductVariants.DefaultIfEmpty()
                            from pc in p.ProductCategories.Where(pc => categoriesIds.Contains(pc.CategoryId))
                            join psa in _productSpecificationAttributeRepository.Table on p.Id equals psa.ProductId
                            join sao in _specificationAttributeOptionRepository.Table on psa.SpecificationAttributeOptionId equals sao.Id
                            join sa in _specificationAttributeRepository.Table on sao.SpecificationAttributeId equals sa.Id
                            where p.Published && pv.Published && !p.Deleted && psa.AllowFiltering &&
                            (!pv.AvailableStartDateTimeUtc.HasValue || pv.AvailableStartDateTimeUtc.Value < nowUtc) &&
                            (!pv.AvailableEndDateTimeUtc.HasValue || pv.AvailableEndDateTimeUtc.Value > nowUtc)
                            select new { sa, sao };


So it only gets the products (and their specs) where their id is in the list above.

So essentially I want to say "Get all specs for the products that have specificationattributeoptionid's in my list"

This should then remove any specifications that don't apply to the products that have been filtered, i.e if I have 1 product with a colour of black, and 1 with white, when you filter by black, the white won't be show as it doesn't apply to the 1 result etc.

Thanks in advance!

Dave