Call Us : +1-678-551-2452
+91 77381-86899

Category Wise Search in nopCommerce 3.1 – 3.2

In nopCommerce, the default search box searches on ‘Product’ and not on ‘Product Category’.

For example, if you have a Product Category named ‘Saree’ and Products ‘S1′ , ‘S2′ listed under this category ‘Saree’, searching for ‘Saree’ in the search box results in “No product found”.

To enable category-wise search in nopCommerce 3.1 & 3.2, do the following:

In the Stored Procedure named ProductLoadAllPaged,  

replace the following code,

–product name
SET @sql = ‘
INSERT INTO #KeywordProducts ([ProductId])
SELECT p.Id
FROM Product p with (NOLOCK)
WHERE ‘
IF @UseFullTextSearch = 1
SET @sql = @sql + ‘CONTAINS(p.[Name], @Keywords) ‘
ELSE
SET @sql = @sql + ‘PATINDEX(@Keywords, p.[Name]) > 0 ‘

with the following,

–product name
SET @sql = ‘
INSERT INTO #KeywordProducts ([ProductId])
SELECT p.Id
FROM Product p with (NOLOCK)
LEFT JOIN Product_Category_Mapping pcm with (NOLOCK) ON pcm.ProductId = p.Id
LEFT JOIN Category c with (NOLOCK) ON c.Id = pcm.CategoryId
LEFT JOIN Product_Manufacturer_Mapping pmm with (NOLOCK) ON pmm.ProductId = p.Id
LEFT JOIN Manufacturer m with (NOLOCK) ON m.Id = pmm.ManufacturerId
WHERE ‘
IF @UseFullTextSearch = 1
SET @sql = @sql + ‘CONTAINS(p.[Name], @Keywords) ‘
ELSE
SET @sql = @sql + ‘PATINDEX(@Keywords, p.[Name]) > 0′
+ ‘OR PATINDEX(@Keywords, c.[Name]) > 0′
+ ‘OR PATINDEX(@Keywords, m.[Name]) > 0′

Leave a Reply

Pay with PayPal

Icon Web Solutions Service
Other Amount:
Name:

Testimonials

It has been a great pleasure working with Icon Web Solutions on the development of my digitized logo and website. From the initial phases of web design, the Icon Web Solutions team has been a pleasure to work with
Naren, USA

REQUEST A QUOTE

Request A Quote

Please fill the form to request a quote from us

Name (required)

Email (required)

Phone

Services
 Website Design & Development Logo Design SEO SMO Payment Gateway Integration Others

Any Other Detail

Input Text Shown in Image
captcha