Comments, Ratings & Comparisons

The ability to comment and rate products (Figure 1.1), and to compare two or more similar products, are features which many end-users have come to expect from an Ecommerce solution.

With Dynamicweb you can implement this with a minimum of effort – here’s how.

Figure 1.1 An example of how comments & ratings may be used

Comments & Ratings on pages & news articles

You can use the Comments & Rating functionality to rate and comment on pages and news articles as well.

Simply copy comment.cshtml from /Templates/eCom/Product to either your News article template folder or your design folder (/Templates/Designs/YourDesign/) - then open the template and comment the relevant sections in and out.

To add comments and ratings to your product catalog, you must include the standard Comment.cshtml file in your product template.

To do so:

  • Go to the paragraph with your Product Catalog app and open the app settings
  • Scroll down to the Templates section and open your product template (Figure 2.1)
Figure 2.1 The Product Catalog app templates section
  • Include the Comment.cshtml template where you want the comments to show up:
<div id="product-comments"> @Include("Comment.cshtml") </div>

Minimizing spam comments

By default the ability to make comments and ratings will be available to all your visitors. However, by using the If Defined() template tag, you can edit your product template to only allow logged-in users to comment and rate a product. This will likely minimize problems with spam or unwanted comments.

To add comparisons to your product catalog, you must select or modify the product list template and use the compare template.

To do so:

  • Go to the paragraph with your Product Catalog app and open the app settings
  • Scroll down to the Templates section and:
    • Select the list-template ProductListCompareAndRating.html
    • Select the compare-template CompareProducts.html (Figure 3.1)
Figure 3.1 The Product List template and the Compare template

On the frontend, you users will now be able to click compare on products to add them to a compare list (Figure 3.2).

Figure 3.2 Adding products to a compare-list

From the compare list, they will be able to click compare to go to a compare screen (Figure 3.3).

Figure 3.3 An example of two products compared

Once comment and rating functionality has been implemented, you will be able to view and moderate product comments from the backend by clicking the comment button in the ribbon bar.

This will take you to the comment window (Figure 4.1).

Figure 4.1 View and moderate comments from the comments window

From here you can view, delete, add or edit comments (by clicking it).

Note: Comments added from the backend will not show up until a comment has been added from the frontend.

Database

These are the database tables associated with Comments in Dynamicweb.

Comment

Contains comments for news, paragraphs, and items.

Field name Data type Length
CommentId int 4
CommentName nvarchar 255
CommentEmail nvarchar 255
CommentWebsite nvarchar 255
CommentRating int 4
CommentText nvarchar Max
CommentItemType nvarchar 25
CommentItemId nvarchar 35
CommentLangId nvarchar 25
CommentCreatedDate datetime 8
CommentEditedDate datetime 8
CommentCreatedBy int 4
CommentEditedBy int 4
CommentIp nvarchar 16
CommentLikes int 4
CommentNolikes int 4
CommentParentId int 4
CommentActive bit 1