Wine Offer Portal Technical Notes

This page documents the technical structure of the Wine Club offer portal.

The portal uses Grav page content, a theme template, Grav Forms, Grav Email, and a small custom validation/helper plugin.

Purpose

The page lets members or public visitors submit a wine request linked to a Club Wine Club meeting.

The request is sent to:

  • the selected supplier;
  • wineclub@coulsdoncomrades.co.uk;
  • winecluborganiser@coulsdoncomrades.co.uk;
  • the user, as a thank-you receipt.

The Club does not take wine payment or fulfil wine orders.

Main Page

Current live page:

/service-landing-pages/wine-offer-grape-variety

Local page folder:

user/pages/09.service-landing-pages/07.wine-offer-grape-variety/

Main page file:

user/pages/09.service-landing-pages/07.wine-offer-grape-variety/wine-order.md

Offer-specific images live in the same page folder so Grav Admin can manage them as page media.

Theme Files

Main template:

user/themes/members-hub/templates/wine-order.html.twig

Wine offer card partial:

user/themes/members-hub/templates/forms/partials/wine-offers.html.twig

Supplier email template:

user/themes/members-hub/templates/forms/emails/wine-order-request.txt.twig

User receipt template:

user/themes/members-hub/templates/forms/emails/wine-order-receipt.txt.twig

Shared email total partial:

user/themes/members-hub/templates/forms/emails/partials/wine-order-total.txt.twig

Admin blueprint:

user/themes/members-hub/blueprints/wine-order.yaml

Plugin Files

Custom plugin:

user/plugins/request-portal/request-portal.php

Plugin config:

user/plugins/request-portal/request-portal.yaml

The plugin:

  • validates that at least one wine quantity or other request is entered;
  • builds a total bottle and estimated value summary for emails;
  • avoids hard-coding wine field names by reading the page wine_offers data.

Required Grav Plugins

The portal depends on:

  • Grav Form plugin;
  • Grav Email plugin;
  • the local request-portal plugin.

The form process is defined in the page frontmatter under form.process.

Data Model

The page data is intentionally held on the page.

Important sections:

  • portal: public page words and confirmation text;
  • meeting_payment: meeting subscription payment buttons;
  • supplier: supplier details and supplier delivery email;
  • wine_offers.bottles: wine list, images, price text, and form codes;
  • form: Grav Form fields and email process.

The Admin blueprint presents these fields in visual page order so editors do not need to work directly in YAML.

Email Flow

Supplier and Club email:

forms/emails/wine-order-request.txt.twig

User thank-you receipt:

forms/emails/wine-order-receipt.txt.twig

Both include:

forms/emails/partials/wine-order-total.txt.twig

The total summary is calculated by the plugin function wine_order_summary.

Media Ownership

Club-owned official assets:

user/data/clubdocs/websiteresources/

Theme/interface assets:

user/themes/members-hub/images/

Offer-specific assets:

user/pages/09.service-landing-pages/07.wine-offer-grape-variety/

This separation keeps Club records, theme assets, and temporary supplier offer media under different ownership.

Deployment Checklist

Deploy these files or folders when moving this feature:

  • user/pages/09.service-landing-pages/07.wine-offer-grape-variety/
  • user/themes/members-hub/templates/wine-order.html.twig
  • user/themes/members-hub/templates/forms/partials/wine-offers.html.twig
  • user/themes/members-hub/templates/forms/emails/wine-order-request.txt.twig
  • user/themes/members-hub/templates/forms/emails/wine-order-receipt.txt.twig
  • user/themes/members-hub/templates/forms/emails/partials/wine-order-total.txt.twig
  • user/themes/members-hub/blueprints/wine-order.yaml
  • user/plugins/request-portal/request-portal.php
  • user/plugins/request-portal/request-portal.yaml

If the live site does not already have the Club crest configured, also deploy:

  • user/config/site.yaml
  • user/data/clubdocs/websiteresources/logos/ClubCrestV1.png

Clear the Grav cache after deployment.

Live Test Checklist

After deployment:

  1. Open the public page.
  2. Check that the Club crest, hero image, supplier logo, and bottle images load.
  3. Confirm the order total changes when quantities are entered.
  4. Try submitting with no wine and no other request; it should be blocked.
  5. Submit a controlled test order.
  6. Confirm delivery to the Club mailbox.
  7. Confirm delivery to the Wine Club organiser.
  8. Confirm the user thank-you receipt.
  9. Enable supplier delivery only when the supplier has confirmed the live address.

Maintenance Notes

Do not edit Grav core, vendor files, or the base Learn2 theme.

Keep customisations in:

  • the members-hub overlay theme;
  • the request-portal plugin;
  • page content and page media.

If the form field code for a wine changes, check the form output and email summary before publishing.