Skip to content

35 — TestimonialProductLink Model & Multi-Product Merchandising (Blueprint §5.9)

Cursor-ready plan for implementing optional secondary product links per submission, with admin UX, integrity rules, and storefront query behavior.

35 — TestimonialProductLink Model & Multi-Product Merchandising (Blueprint §5.9)

Section titled “35 — TestimonialProductLink Model & Multi-Product Merchandising (Blueprint §5.9)”

Source: 02-Implementation-Blueprint.md§5.9 New model: TestimonialProductLink.

This document is a build spec only. No code changes are implied until a task references this file.

Related: 10 (submission detail merchandising controls), 11 (published content), 05 (storefront read API), 20 (schema), 33 (moderation log).


Support optional multi-product merchandising by allowing one testimonial submission to link to additional products while preserving a single canonical primary product binding.


Blueprint states:

  • TestimonialProductLink is an optional extension.
  • Primary product linkage should come from TestimonialSubmission.shopifyProductId.

That means:

  • multi-link is additive,
  • never replace the need for primary binding.

Required fields:

  • id
  • shopId
  • submissionId
  • shopifyProductId
  • createdAt

Unique constraint:

  • @@unique([submissionId, shopifyProductId])

Recommended indexes:

  • @@index([shopId, shopifyProductId])
  • @@index([submissionId])

  • Persist secondary product links.
  • Expose/edit links from submission detail screen.
  • Use links where relevant in publication and recommendation contexts.
  • Auto-generating links via AI similarity.
  • Mass-linking from bulk actions.
  • Link weighting/scoring.

  • Stored in TestimonialSubmission.shopifyProductId.
  • Derived from original request token by default.
  • Stored in TestimonialProductLink.
  • Must not duplicate primary product.
  1. Every submission has exactly one primary product.
  2. Secondary links are unique per submission.
  3. Secondary links can be empty.

5) Admin UX behavior (Screen 6 integration)

Section titled “5) Admin UX behavior (Screen 6 integration)”

In submission detail (10):

  • Product picker supports multi-select.
  • UI separates:
    • Primary product (single-select/radio)
    • Additional linked products (multi-select chips)

Save flow:

  1. update primary product on submission if changed
  2. replace secondary links set in TestimonialProductLink

Use transaction to keep both consistent.


Suggested server action intent:

  • intent=save_merchandising_products

Payload:

  • submissionId
  • primaryShopifyProductId
  • secondaryShopifyProductIds[]

Validation:

  • all products belong to same shop catalog
  • secondary list excludes primary
  • dedupe secondary IDs before write

Transaction:

  • update submission primary id
  • delete old link rows for submission
  • insert new secondary link rows
  • append moderation log action (feature or edit_products, if you add custom action taxonomy)

For strict PDP widget query:

  • match primary product only by default (recommended for clarity).

Optional expansion mode (future):

  • include testimonials where current product appears in TestimonialProductLink.

If enabled, document clearly in settings to avoid merchant confusion.

Secondary links are useful for:

  • attribution in cards (“Also tagged in …”)
  • product recommendation overlays

Not required for base home carousel behavior.


If secondary links are enabled:

  • product coverage metrics may overcount if you naively count both primary and secondary.

Recommendation:

  • default analytics use primary product coverage.
  • optional advanced metric can include secondary-linked coverage separately.

  • On submission delete/redact:
    • cascade delete linked TestimonialProductLink rows.
  • No PII in this table; safe for broad internal use.

Keep tenant scoping via shopId to simplify queries and deletions.


  • Submission can save primary + multiple secondary products in one action.
  • Duplicate secondary products are blocked by validation and DB unique constraint.
  • Primary product cannot appear in secondary links.
  • Secondary links persist and reload correctly in detail screen.
  • Cascades clean link rows when submission is removed.

11) Suggested implementation order (for Cursor)

Section titled “11) Suggested implementation order (for Cursor)”
  1. Add Prisma model and migration (20 alignment).
  2. Add product-link read/write helpers in server layer.
  3. Update submission detail UI to manage primary + secondary links.
  4. Add transactional action handler and validation.
  5. Decide/storefront query policy for secondary links and document in 05/11.

  • 02-Implementation-Blueprint.md — §5.9
  • 10-submission-detail-screen-6.md
  • 11-published-content-screen-7.md
  • 05-storefront-widgets-and-read-api.md
  • 20-database-design-and-migrations-blueprint-section-5.md

This folder already includes 05 through 34 plans. This file is 35-....