SEARCHABLE PRODUCT SPECIFICATIONS

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
Just in case you wanted to be able to search the product's specifications:

Step 1.

In ProductSpecifications.ascx replace line 12 with this:

<a href="http://www.yourdomain.com/search.aspx?searchterms=<%#Server.HtmlEncode(((SpecificationAttributeOption)Eval("SpecificationAttributeOption")).LocalizedName)%>"><%#Server.HtmlEncode(((SpecificationAttributeOption)Eval("SpecificationAttributeOption")).LocalizedName)%></a>

This will turn the product specifications into links - this is optional, Step 2 is the only thing that is required.

Step 2.

Modify the stored procedure Nop_ProductLoadAllPaged...

after this line:

LEFT OUTER JOIN Nop_ProductLocalized pl with (NOLOCK) ON p.ProductID = pl.ProductID AND pl.LanguageID = @LanguageID

place these lines:

LEFT OUTER JOIN Nop_Product_SpecificationAttribute_Mapping pm with (NOLOCK) on p.ProductId = pm.ProductID
LEFT OUTER JOIN Nop_SpecificationAttributeOption sao with (NOLOCK) on pm.SpecificationAttributeOptionID = sao.SpecificationAttributeOptionID

after this line:

or patindex(@Keywords, isnull(pv.sku , '')) > 0

place this line:

or patindex(@Keywords, isnull(sao.name, '')) > 0

Now visitors to your site can search on your product's specifications. Let's say you have a specification of "Author" and a bunch of books you have for sale have that specification with the value "Stephen King". Now users can put in "Stephen King" in the search box and get all of the books that have that specification.

Hope this helps someone...
13 years ago
Awesome. I was just looking into this.
13 years ago
It works perfectly, thanks!

Another update could be in the same store proc :

SET @Keywords = isnull(@Keywords, '')
SET @Keywords = '%' + rtrim(ltrim(replace(@Keywords, ' ', '%'))) + '%'

So user can search on multiple non consecutive keywords

I also added a post concerning accent managment:
https://www.nopcommerce.com/boards/t/6299/ignore-accent-on-search-module.aspx
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.