Search Product Attribute Combination SKU

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
Hi,

I am using version 3.5

I found that searching Sku does not search the Product Attribute Combinations.  

Does anybody have have updated code that you can share?
7 years ago
I'm trying to update the Store Proc Searc SKU part but it's not working.

Existing


IF @SearchSku = 1
    BEGIN
      SET @sql = @sql + '
      UNION
      SELECT p.Id
      FROM Product p with (NOLOCK)
      WHERE '
      IF @UseFullTextSearch = 1
        SET @sql = @sql + 'CONTAINS(p.[Sku], @Keywords) '
      ELSE
        SET @sql = @sql + 'PATINDEX(@Keywords, p.[Sku]) > 0 '
    END


Changing to


IF @SearchSku = 1
    BEGIN
      SET @sql = @sql + '
      UNION
      SELECT p.Id
      FROM Product p with (NOLOCK)
      WHERE '
      IF @UseFullTextSearch = 1
        SET @sql = @sql + 'CONTAINS(p.[Sku], @Keywords) OR CONTAINS(@Keywords, p.[Sku]) '
      ELSE
        SET @sql = @sql + 'PATINDEX(@Keywords, p.[Sku]) > 0 OR PATINDEX(p.[Sku], @Keywords) > 0'
    END
7 years ago
Update code as follows fixed my problem.



IF @SearchSku = 1
    BEGIN
      SET @sql = @sql + '
      UNION
      SELECT p.Id
      FROM Product p with (NOLOCK)
      WHERE '
      IF @UseFullTextSearch = 1
        SET @sql = @sql + 'CONTAINS(p.[Sku], @Keywords) OR CONTAINS(@Keywords, '%' + p.[Sku] + '%') '
      ELSE
        SET @sql = @sql + 'PATINDEX(@Keywords, p.[Sku]) > 0 OR PATINDEX('%' + p.[Sku] + '%', @Keywords) > 0'
    END
7 years ago
Hi Orion,

I'm having the same problem, but in Nop 3.90 the part has changed:

    IF @SearchSku = 1
    BEGIN
      SET @sql = @sql + '
      UNION
      SELECT p.Id
      FROM Product p with (NOLOCK)
      WHERE p.[Sku] = @OriginalKeywords '
    END


The replacing with your solution results in an error:

...the data types varchar and varchar are incompatible in modulo-Operator ...
5 years ago
Hi!
Can anybody help to fix it on 3.9 version?
Thanks to all!
3 years ago
Hi

Has this bug reappeared in 4.20?  I am having the same issue?

Thanks in advance

Tony
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.