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 10 of 10

Thread: Product Description on Search Results

  1. #1
    chamberinternet is offline Member
    Join Date
    Jul 2009
    Posts
    30

    Default Product Description on Search Results

    Hello ...

    Is their a way a can display the description for each product found within the "Product Matches" section within the search results page?

    Many Thanks

    Shafiq
    Using AspDotNetStorefront ML 8.0.1.2

  2. #2
    Richnyc30 is offline Senior Member
    Join Date
    Mar 2009
    Posts
    340

    Default summary data available

    Summary data can be used. It has been called in the code behind and is readily available. Search on Summary.

  3. #3
    George the Great is offline Senior Member
    Join Date
    Nov 2006
    Location
    Cleveland, OH
    Posts
    1,792

    Default

    Sure. The search xmlpackage already pulls the description of the products via the aspdnsf_GetProducts stored procedure. You simply have to modify the search xmlpackage. Just add a parameter to the Product template in page.search.xml.config to support localization
    Code:
    <xsl:param name="pDescription">
      <xsl:choose>
        <xsl:when test="count(Description/ml/locale[@name=$LocaleSetting])!=0">
          <xsl:value-of select="Description/ml/locale[@name=$LocaleSetting]"/>
        </xsl:when>
        <xsl:when test="count(Description/ml/locale[@name=$WebConfigLocaleSetting])!=0">
          <xsl:value-of select="Description/ml/locale[@name=$WebConfigLocaleSetting]"/>
        </xsl:when>
        <xsl:when test="count(Description/ml)=0">
          <xsl:value-of select="Description"/>
        </xsl:when>
      </xsl:choose>
    </xsl:param>
    and then within that template use
    Code:
    <xsl:value-of select="$pDescription"/>
    wherever you want to display it.
    <a href="http://www.aspdotnetstorefront.com">Shopping Cart Software</a>

  4. #4
    chamberinternet is offline Member
    Join Date
    Jul 2009
    Posts
    30

    Default

    That's excellent George... Worked great

    Many Thanks for your help.

    Shafiq
    Using AspDotNetStorefront ML 8.0.1.2

  5. #5
    chamberinternet is offline Member
    Join Date
    Jul 2009
    Posts
    30

    Default

    Hello Again ...

    I also want the description to be displayed on the shopping cart page under the SKU for each item (shoppingcart.aspx)

    Can you help on how I can achieve this too? I'm guessing this will involve some changes to the source code?

    Many thanks again.

    Shafiq
    Using AspDotNetStorefront ML 8.0.1.2

  6. #6
    George the Great is offline Senior Member
    Join Date
    Nov 2006
    Location
    Cleveland, OH
    Posts
    1,792

    Default

    You are correct. This will involve source code mods. You can do one of two things here. You can either add a Description property to the CartItem struct so that you access the description directly from a CartItem variable (you'll also need to populate the Description property when a CartItem is populated) and then modify the GetLineItemDescription method in the shoppingcart class to append the description which you can now access (if you've modified the CartItem struct as mentioned above) using c.m_description (where c is the name of the CartItem parameter passed to GetLineItemDescription and m_description is the name of the property you've created in the CartItem struct...it matches the naming conventions of the other properties), or you can simply modify the GetLineItemDescription to pull the description from the product record in the database based off of the ProductID which the CartItem variable already has (eg. c.m_ProductID).
    <a href="http://www.aspdotnetstorefront.com">Shopping Cart Software</a>

  7. #7
    Rob is offline Senior Member
    Join Date
    Aug 2004
    Posts
    3,037

    Default

    We don't do this by default, as it would make the cart page somewhat unreadable, unless you know yo have very short descriptions. As G1 said, the cart is controlled in DLL source (for quite a few reasons), so you'd have to mod source for this one.
    AspDotNetStorefront
    Shopping Cart

  8. #8
    chamberinternet is offline Member
    Join Date
    Jul 2009
    Posts
    30

    Default

    The descriptions are very short (4 or 5 words the most)

    I've found the function GetLineItemDescription within ShoppingCart.vb but i'm quite new to aspndsf so i'm a bit unsure on how to proceed with this.

    Any help would be great.

    Thanks a lot
    Using AspDotNetStorefront ML 8.0.1.2

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

    Default

    Yes, under the AspDotNetStorefrontCore.ShoppingCart.GetLineItemDe scription, all you need to do is add these lines of code:

    Code:
    Dim ProductDescription As String = String.Empty
    Using con As New SqlConnection(DB.GetDBConn())
    con.Open()
    Dim query As String = "select Description from Product where ProductID = " & c.m_ProductID
    Using rsx As IDataReader = DB.GetRS(query, con)
    If rsx.Read() Then
           ProductDescription = DB.RSField(rsx, "Description")
    End If
    End Using
    End Using
    tmpS.Append("<br/> Description:")
    tmpS.Append(ProductDescription)
    Note: These lines are only converted via code converter tool. I made the modification on C#...
    Original lines of code in C#:
    Code:
                string ProductDescription = string.Empty;
                using (SqlConnection con = new SqlConnection(DB.GetDBConn()))
                    {
                        con.Open();
                        string query = "select Description from Product where ProductID = " + c.m_ProductID;
                        using (IDataReader rsx = DB.GetRS(query, con))
                        {
                            if (rsx.Read())
                            {
                                ProductDescription = DB.RSField(rsx, "Description");
                            }
                        }
                    }
                tmpS.Append("<br/> Description:");
                tmpS.Append(ProductDescription);

    and that's it...

  10. #10
    chamberinternet is offline Member
    Join Date
    Jul 2009
    Posts
    30

    Default

    Brilliant. That worked a treat.

    Many Thanks Jao!

    Regards

    Shafiq :sK
    Using AspDotNetStorefront ML 8.0.1.2