Orchardcore reviews

From CrestApps/CrestApps.AgentSkills · View interactive version

Orchardcore reviews is an AI agent skill from the GitHub repository CrestApps/CrestApps.AgentSkills. Skill for the CrestApps Orchard Core Product Reviews commerce module. Covers verified-purchase ProductReview records with a 1 to 5 rating, moderation under Commerce Reviews, ReviewSettings RequireApproval, BuyersOnly and review requests, review photos in the media store, the ProductRating and Produc

How to use this skill

Skill file

Orchard Core Product Reviews - Prompt Templates

Let Buyers Review Products

You are an Orchard Core expert. Generate accurate setup and extension guidance for the CrestApps Product Reviews module, which lets buyers rate and review products they bought, moderated by the store, with stars on product pages and an average rating that listings filter and sort by.

Guidelines

Feature and Services

| Item | Value |

|---|---|

| Feature ID | CrestApps.OrchardCore.Reviews |

| Records | ProductReview in collection Reviews (ProductReviewIndex) |

| Services | ReviewService (GetEligibilityAsync, SubmitAsync, ModerateAsync, DeleteAsync, ListApprovedAsync, PageAsync, CountPendingAsync), ProductRatingReader, ReviewPhotoStore, ReviewRequestService |

| Shapes | ProductRating (Content:before:5) and ProductReviews (Content:60) on a product's Detail display |

| Site settings | ReviewSettings (group reviews, Settings > Commerce > Reviews) |

| Listing seams filled | IProductSearchDocumentContributor, IProductListingEntryProvider |

| Background task | ReviewRequestBackgroundTask (hourly) |

| Permissions | ManageProductReviews ("Moderate product reviews"; Administrator, Store manager, Marketing), SubmitProductReviews ("Review products bought"; Authenticated) |

| Report | Product reviews under Reports > Commerce and the Product Reviews dashboard widget (with CrestApps.OrchardCore.Reports) |

| Report Builder | Reviews data source (Reviews) with ProductReviews (ManageProductReviews; review text and photos never exposed); recipe ReviewsReportBuilderReports adds editable copies to the Store group |

| Structured data | With Advanced SEO, a product with approved reviews gets a schema.org aggregateRating (see orchardcore-advanced-seo) |

| Personal data | ReviewPersonalDataContributor: an erasure replaces the author name and scrubs the title and body; the rating stays. It does not take part in guest retention expiry |

Model and Settings

ProductReview holds ProductId, ProductTitle, UserId, AuthorName, Rating (1 to 5), Title (120 chars), Body (4000 chars), Status (Pending, Approved, Rejected), VerifiedPurchase, OrderId, Photos (up to three media paths) and moderation fields. ProductRating(Count, Average) is the count and one-decimal average of approved reviews.

| ReviewSettings | Default | Meaning |

|---|---|---|

| RequireApproval | true | New and changed reviews wait for moderation |

| BuyersOnly | true | Only buyers of the product on a paid order may review |

| SendReviewRequests | false | Email buyers asking for reviews |

| ReviewRequestDelayDays | 14 | Days after the order before asking |

{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "OrchardCore.Media",
        "OrchardCore.Email",
        "CrestApps.OrchardCore.Customers",
        "CrestApps.OrchardCore.Reviews"
      ]
    },
    {
      "name": "Settings",
      "ReviewSettings": {
        "RequireApproval": true,
        "BuyersOnly": true,
        "SendReviewRequests": true,
        "ReviewRequestDelayDays": 10
      }
    }
  ]
}

Submitting and Photos

Review Requests

ReviewRequestService.SendDueAsync reads paid orders from the last 60 days placed at least ReviewRequestDelayDays ago without Order.ReviewRequestSentUtc, up to 200 a run, and emails each buyer once with links to each product's reviews (the store's review-request email template), only when the customer accepts marketing. Every due order is marked, so a buyer who does not accept marketing is not asked later. Only lines whose content type exists on the site get a link, so Point of Sale department lines (content type PosDepartment, no content item) are skipped.

Moderation

Commerce > Reviews (reviews, ManageProductReviews) lists reviews on the AdminList standard, pending first, filtered by status, with Approve, Reject and Delete. Approving, rejecting, or deleting an approved review calls IProductSearchIndexRefresher.RefreshAsync so the listing rating updates at once.

Ratings in Listings

The same two seams let any module add searchable attributes with automatic facets and sorts. The Reviews implementation is the pattern:

using CrestApps.OrchardCore.Products.Core.Listing;
using Microsoft.Extensions.Localization;

namespace MyCompany.OrchardCore.Sustainability;

public sealed class EcoScoreListingEntryProvider : IProductListingEntryProvider
{
    internal readonly IStringLocalizer S;

    public EcoScoreListingEntryProvider(IStringLocalizer<EcoScoreListingEntryProvider> stringLocalizer)
    {
        S = stringLocalizer;
    }

    public IEnumerable<ProductListingFacet> GetFacets()
        =>
        [
            new ProductListingFacet
            {
                Key = "eco-score",
                AttributeKey = "Product.EcoScore",
                Label = S["Eco score"],
                Kind = ProductFacetKind.Range,
                ShowRanges = true,
                Ranges = [new ProductFacetRange { Min = 80 }, new ProductFacetRange { Min = 50 }],
            },
        ];

    public IEnumerable<ProductListingSort> GetSorts()
        =>
        [
            new ProductListingSort { Key = "eco-score-desc", Label = S["Eco score: highest first"], AttributeKey = "Product.EcoScore", Descending = true },
        ];
}

Pair it with an IProductSearchDocumentContributor that adds a ProductAttributeValue with that key, register both as scoped services in a startup with [RequireFeatures("CrestApps.OrchardCore.Products.Listing")], and call IProductSearchIndexRefresher.RefreshAsync when the source data changes.

Troubleshooting

| Symptom | Check |

|---|---|

| Review form missing | User must be signed in with SubmitProductReviews, and have bought the product on a paid order when BuyersOnly is on |

| Approved review not on the page | The product page must render the Detail display type |

| Rating filter missing in a listing | Enable Product Listing; the listing must use automatic filters, or add Product.Rating itself |

| Listing rating is stale | Moderate through Commerce > Reviews, which refreshes the product's search record |

| No review request emails | Enable SendReviewRequests, OrchardCore.Email and Customers, set the Base URL, and the buyer must accept marketing |

| Photo upload refused | Only JPEG, PNG or WebP up to 5 MB, three at most, with Media enabled |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.