v4.40 Help needed trying to modify searchProducts

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
1 ano atrás
noffy wrote:
im using 4.4.40, it may be different or it doesn't metter?

i have checked with 4.40.4 and language: en-US, same results works perfectly for auto complete search & hit search also. you can try with default project at local i think.
1 ano atrás
so u confirm me that all i have to do is add this
public IQueryable<int> ExclusiveKeyWordSearch(string keywords)
        {
            var products = _productRepository.Table;
            var searchstrings = keywords.Split(null).Select(x => x.ToLower()).ToArray();

            foreach (string q in searchstrings)
            {
                products = products.Where(p => p.Name.ToLower().Contains(q));
            }

            return products.Select(p => p.Id);
        }


in ProductService.cs under Nop.services 8added around line 780 to be precise)

and then add
productsByKeywords = productsByKeywords.Union(ExclusiveKeyWordSearch(keywords));


after
productsByKeywords =
                        from p in _productRepository.Table
                        where p.Name.Contains(keywords) ||
                            (searchDescriptions &&
                                (p.ShortDescription.Contains(keywords) || p.FullDescription.Contains(keywords))) ||
                            (searchManufacturerPartNumber && p.ManufacturerPartNumber == keywords) ||
                            (searchSku && p.Sku == keywords)
                        select p.Id;

witch for me its around line 870

rebuild and pubblish and all search should work, right?
cant figure out whi it returns
search.noresultstext

i'll try again..
1 ano atrás
first of all, thx for your help.
one more thing
i found that i have installed  
NOP AJAX FILTERS from nop-plugin.com

as far as you know this may be the cause?
i should try do uninstall it? or it doesnt matter?
1 ano atrás
noffy wrote:

i found that i have installed  
NOP AJAX FILTERS from nop-plugin.com
as far as you know this may be the cause?
i should try do uninstall it? or it doesnt matter?

ajax filter has some advance filtering that is not available out of the box. ajax filter is responsible for modifying search result. choice is yours!
1 ano atrás
ofc u were right, i disabled the plugin and it works
thx very mutch
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.