Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 9 of 9

Thread: Question about searching for SKU

  1. #1
    MudDiver is offline Member
    Join Date
    May 2009
    Posts
    44

    Default Question about searching for SKU

    I am a little confused with the search features of the site. If I have full text search enabled the search pages will not return items if the sku is entered unless I mention it in the description. If I turn off site search then it will find it by the sku but they have to be entered in a differant format than how we have it in our catalog for example our part number is 28-CDR the site SKU is 28CDR, if I search for 28-CDR nothing comes up if I search for 28CDR it does. If I turn on Full Text Search it doesn't matter which I type it will not come up unless I add it to a description.

    Thanks,
    Jason Giles
    IT Manager / Web Services
    WTS Media
    www.wtsmedia.com

  2. #2
    MudDiver is offline Member
    Join Date
    May 2009
    Posts
    44

    Default

    Any ideas?
    Jason Giles
    IT Manager / Web Services
    WTS Media
    www.wtsmedia.com

  3. #3
    Dusty is offline Member
    Join Date
    Jun 2009
    Posts
    176

    Default

    Based on the description of your setup such is the behavior that we would expect. There are a couple of way that you could address this, the easiest way would be to modify the site SKU to match your product SKU. Though the Full Text Search does improve search capabilities, the search matches are measure in degrees of similarity and in a 5-6 character search term, a single character difference is fairly significant.

    Dusty
    ASPDotNetStorefront Staff

  4. #4
    MudDiver is offline Member
    Join Date
    May 2009
    Posts
    44

    Default

    Not too sure what you mean by "Site SKU" I only see two places to enter a SKU 1 the product definition page (SKU Prefix) and then on the variant page (SKU Suffix). The searches seem to be finding the SKU Prefix on the product page but not searching the SKU-Suffix on the variant page.

    Thanks for your help.
    Jason Giles
    IT Manager / Web Services
    WTS Media
    www.wtsmedia.com

  5. #5
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    Yes, you're right. Only the SKUSuffix but that doesn't mean it's impossible to integrate result based on the SKU Prefix also. This would only take a little tweaking on the aspdnsf_GetProducts, page.search.xml.config or page.searchadv.xml.config; however, on this example, we'll be using the former. First, you'll need to modify the stored procedure: aspdnsf_GetProducts
    Change the occurrences (2 occurrences to be exact) of this line:
    Code:
    or patindex(@searchstr, isnull(p.sku , '')+isnull(pv.skusuffix , '')) > 0
    To:
    Code:
    or patindex(@searchstr,isnull(p.sku,'')) > 0
    or patindex(@searchstr,isnull(pv.skusuffix,'')) > 0
    Execute the stored procedure, then next, we'll modify the XML package: page.search.xml.config

    Under the template /
    Add the highlighted parts:
    Code:
                                                        <td align="center">
                                                            <b>
                                                                <xsl:value-of select="aspdnsf:StringResource('search.aspx.7', $LocaleSetting)" disable-output-escaping="yes" />
                                                            </b>
                                                        </td>
                                                      <td align="center">
                                                        <b>
                                                          <xsl:value-of select="'SKU Suffix'" disable-output-escaping="yes" />
                                                        </b>
                                                      </td>
    Note: Adding a string resource, instead of a hardcoded: SKU Suffix would be good for flexibility.

    Code:
                        <td valign="middle" align="left" >
                            <a href="{aspdnsf:ProductLink(ProductID, SEName, 0, '')}">
                                <xsl:value-of select="$pName"  disable-output-escaping="yes" />
                                <xsl:if test="vName!=''">
                                    -<xsl:value-of select="$vName" />
                                </xsl:if>
                            </a>
                        </td>
                      <td align="center">
                        <xsl:value-of select="SKU" />
                      </td>
    
                      <td align="center">
                            <xsl:value-of select="SKUSuffix" />
                            <xsl:if test="SKUSuffix!=''">
                                <xsl:value-of select="SKUSuffix" />
                            </xsl:if>
                        </td>
    Then comment out the highlighted parts:
    Code:
                      <td align="center">
                            <xsl:value-of select="SKUSuffix" />
                            <xsl:if test="SKUSuffix!=''">
                                <xsl:value-of select="SKUSuffix" />
                            </xsl:if>
                        </td>

  6. #6
    MudDiver is offline Member
    Join Date
    May 2009
    Posts
    44

    Default

    This looks exactly like what I am looking for my problem now is when I go to implement it the stored procedure you mention is locked in SQL Server Manager and shows that it is encrypted. How do I get access to the Stored Procedure so that I can modify it?

    Thanks!
    Jason Giles
    IT Manager / Web Services
    WTS Media
    www.wtsmedia.com

  7. #7
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    You could use an SQL Decryption tool or use this steps: create a new query, then open the original Create AspDotNetStorefront Database.sql from your db folder. Copy the section that creates the aspdnsf_GetProducts and then comment out this line:
    Code:
    WITH ENCRYPTION
    Execute the stored procedure and that's it. Unlocked and free...

  8. #8
    MudDiver is offline Member
    Join Date
    May 2009
    Posts
    44

    Default

    Great answers. I have edited the stored procedure and I have modified the template pages. However I noticed that I still cannot search an item by the combined sku and skuSuffix. I started looking in the stored procedure and noticed that the line I commented out.

    Code:
    or patindex(@searchstr, isnull(p.sku , '')+isnull(pv.skusuffix , '')) > 0
    This line seems to combine the search string into one, so when I uncomment it I start getting the results I want. My question is why comment this line out will it interfere with any of the other modifications?

    Thanks a lot! You guys have definitely got me on the right track with this.
    Jason Giles
    IT Manager / Web Services
    WTS Media
    www.wtsmedia.com

  9. #9
    Jao is offline Senior Member
    Join Date
    Oct 2008
    Posts
    1,132

    Default

    Well, I thought you wanted to search using either the SKUPrefix or SKUSuffix. Anyway, yes, uncomment that line if you want to search by the SKUPrefix+SkuSuffix...