# etechflow/module-product-warning

> Per-product and per-category warning banners on the Magento 2 PDP. Admin can write coloured notices, assign them to specific products or whole categories, and the storefront auto-renders them. Theme-agnostic — works on Hyvä, Luma, and any custom theme without template overrides.

`composer require etechflow/module-product-warning`

Canonical URL: https://packagento.com/etechflow/module-product-warning

## At a glance

- **Vendor**: etechflow (https://packagento.com/etechflow.md)
- **Latest version**: 1.1.5 — released 2026-06-22
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/etechflow/module-product-warning and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require etechflow/module-product-warning:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

Per-product and per-category warning banners on the Magento 2 PDP. Admin can write coloured notices, assign them to specific products or whole categories, and the storefront auto-renders them. Theme-agnostic — works on Hyvä, Luma, and any custom theme without template overrides.

## README

Per-product and per-category warning banners on the storefront PDP. Admin can create coloured notices ("This item ships from a remote warehouse", "Cutting service unavailable for this key", "Backorder — 7 day lead time", etc.), assign them to specific products or whole categories, and the storefront auto-renders them above the price.

- **Version:** 1.0.0
- **Package:** `etechflow/module-product-warning`
- **Magento:** 2.4.4 – 2.4.8 (newer versions should work; report incompatibilities)
- **PHP:** 8.1, 8.2, 8.3
- **License:** proprietary (`LICENSE.txt`) — Commercial licenses available at <https://etechflow.com>
- **Vendor:** ETechFlow — https://etechflow.com

---

### What you get

- **Admin grid + edit form** under `Catalog → Inventory Warning`
  - Warning name (admin-only label)
  - Warning message (customer-facing text)
  - Color (hex picker, used for the banner tint + left border)
  - Active toggle, sort order
  - Assigned categories (multi-tree picker — assigns to every product in those categories)
  - Assigned products (search + multi-select picker)
- **Storefront PDP rendering** (auto-injected via this module's own layout XML — no theme override required)
  - Stacks multiple warnings if a product matches several
  - Tints background + border using the warning's color
  - Scoped CSS namespace (`.epw-*`) — won't collide with theme classes
- **Resolver model** (`ETechFlow\ProductWarning\Model\WarningResolver::getForProduct($product)`) for stores that want to render warnings in a custom location (e.g., listing pages, cart, emails)
- **Theme-agnostic by design** — works on Hyvä, Luma, Mage-OS adminhtml, and any custom theme

---

### Theme compatibility

| Theme | Status |
|---|---|
| **Magento 2 default (Luma / Blank)** | ✅ Works — vanilla CSS, no Knockout dependency |
| **Hyvä Theme** | ✅ Works — no Alpine / Tailwind required |
| **Custom themes** | ✅ Works — uses standard `product.info.main` container which exists in every theme |
| **Mage-OS forks** | ✅ Works |
| **Adobe Commerce** | ✅ Works |
| **Headless / PWA Studio** | ⚠️ Storefront template bypassed; use the `WarningResolver` PHP API or expose a REST endpoint to surface the warnings in your headless front end |

See `COMPATIBILITY.md` for the design choices that make this portable.

---

### Quick start

```bash
## 1. Extract into your Magento root
unzip etechflow-module-product-warning-1.0.0.zip -d <magento-root>/

## 2. Enable + migrate
bin/magento module:enable Etechflow_ProductWarning
bin/magento setup:upgrade
bin/magento setup:di:compile      # production-mode only
bin/magento cache:flush

## 3. Visit the admin
open https://your-store.example.com/admin/etechflow_warning/warning/index
## (or: Admin sidebar → Catalog → Inventory Warning)
```

A fresh install starts with an empty warnings grid. Click **Add New Warning**, set name + message + colour, assign it to a product or category, and reload the PDP — the banner renders above the price.

---

### Documentation index

| File | Purpose |
|---|---|
| `README.md` | Overview, features, compatibility (this file) |
| `INSTALL.md` | Manual + Composer install + verification + troubleshooting |
| `USAGE.md` | Admin walk-through — creating warnings, assigning to products / categories |
| `CONFIGURATION.md` | Module-level customization options + how to move the banner block elsewhere |
| `COMPATIBILITY.md` | Theme + Magento + PHP matrix and the choices that keep it portable |
| `CHANGELOG.md` | Version history |
| `UNINSTALL.md` | Clean removal (disable / drop tables / remove media) |
| `LICENSE.txt` | proprietary license text |

---

### Support

- Email: support@etechflow.com
- Include: Magento version, PHP version, active theme, steps to reproduce, screenshot of the PDP with browser inspector open.

---

### License

proprietary — free for commercial and non-commercial use. See `LICENSE.txt`.

## Changelog

All notable changes to this module. Adheres to [Semantic Versioning](https://semver.org/).

---

### [1.1.0] — 2026-06-05 — Stripe portal licensing + admin gate + storefront gating

#### Added

- **Stripe portal subscription licensing.** Adds the SP-XXXX subscription-key
  flow — same pattern shipped on `ETechFlow_BackorderEtaDisplay` v1.3.0,
  `ETechFlow_NextDayEligibility` v1.8.0, `ETechFlow_ShippingTableRates` v1.2.0,
  and `ETechFlow_Faq` v1.1.0. Three plan tiers (Starter $9/mo, Professional
  $19/mo, Enterprise $49/mo) with in-admin Stripe Checkout, automatic key
  activation, portal-validated server-IP enforcement, IP-block auto-restore,
  and 48-hour offline grace when the portal is unreachable. HMAC per-module +
  bundle keys (LICENSING_PROTOCOL.md) continue to work for offline / bundle
  activation.

- **`Model/LicenseValidator.php`** — upgraded constructor from 2-arg to
  5-arg (`ScopeConfigInterface`, `StoreManagerInterface`, `CacheInterface`,
  `Curl`, `WriterInterface`). Adds tri-state `validateViaPortal(): ?bool`
  per the enforcement contract. Preserves `MODULE_ID = 'product-warning'`
  and the existing `SECRET_FRAGMENTS` byte-for-byte so v1.0.x HMAC keys
  remain valid.

- **License gate page** under **Catalog → Inventory Warning → License & Plans**
  with dark plan-cards UI and a Stripe Checkout button. Visiting any
  warning-admin URL without a valid licence redirects here.

- **Module Status banner** (5-state) at the top of Stores → Configuration →
  ETECHFLOW → Product Warning. Tells the merchant exactly why the module is
  locked (or that it's active).

- **Admin gating plugin** (`Plugin/Adminhtml/LicenseGatePlugin.php`) — every
  admin Warning CRUD controller + every assignment-picker controller (9 in
  total) redirects to the license gate when not licensed.

- **Storefront gating** — `Block/Frontend/Notice.php` now checks
  `LicenseValidator::isValid()` before calling the resolver. When unlicensed,
  `getWarnings()` returns an empty array and the PDP renders no banner. The
  block stays in the layout but produces zero output — the storefront
  degrades silently rather than crashing or showing a "module locked" message
  to customers.

- **`<payment>` config group** for Stripe `sk_test` / `sk_live` / publishable
  key / currency (Encrypted backend model on the secret key).

- **`<license>` config group** expanded — adds `issued_key` (Encrypted audit
  field), `issued_at` (timestamp), `ip_blocked` (auto-managed flag),
  `portal_url`, and `bundle_license_key` (Encrypted, mapped to the shared
  `etechflow_bundle/license/license_key` path).

#### Changed

- **Menu restructured.** `Catalog → Inventory Warning` is now a parent node
  with two children: **Manage Warnings** (the existing grid) and **License &
  Plans** (the new gate). Existing bookmarks to `/etechflow_warning/warning/index`
  continue to work unchanged.

- **Module Status backend block** added (`Block/Adminhtml/System/Config/ModuleStatus.php`)
  to render the always-expanded 5-state banner on the Stores → Config page.

#### Migration

```
composer update etechflow/module-product-warning
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush
```

After upgrade, on a production host the module is **locked by default**.
Go to **Catalog → Inventory Warning → License & Plans** and either paste an
existing SP-XXXX / HMAC / bundle key, or click "Select Plan & Pay" to buy
a subscription via Stripe.

Dev hosts (localhost, `*.test`, `*.local`, `staging.*`, `*.ngrok-free.dev`,
etc.) auto-bypass licensing. Production hosts that aren't auto-detected can
opt out with **Production Environment = No**.

#### Notes

_(Changelog truncated for .md surface. Full history on https://packagento.com/etechflow/module-product-warning.)_

## Recent Versions

| Version | Released |
|---|---|
| 1.1.5 | 2026-06-22 |
| 1.1.3 | 2026-06-15 |
| 1.1.2 | 2026-06-15 |
| 1.1.1 | 2026-06-13 |
| 1.1.0 | 2026-06-05 |
| 1.0.2 | 2026-06-05 |
| 1.0.1 | 2026-06-03 |
| 1.0.0 | 2026-06-03 |

## Dependencies

### Require

| Package | Constraint |
|---|---|
| magento/framework | >=103.0 |
| magento/module-backend | >=102.0 |
| magento/module-catalog | >=104.0 |
| magento/module-ui | >=101.0 |
| php | ~8.1.0\|\|~8.2.0\|\|~8.3.0\|\|~8.4.0 |

## Quality

Latest release (1.1.5) fails the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Pass | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | Pass | not tested |


### Code Quality

Advisory checks against the module's source. Never affect the Compatibility verdict — a phpcs finding can't make a module incompatible.

#### Static Analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Fail | 172 | 3 errors, 169 warnings (ruleset: Magento2) — 69 auto-fixable with phpcbf |
| PHPMD | Warning | 20 | 20 rule violations (UnusedFormalParameter:4, EmptyCatchBlock:4, MissingImport:3, CyclomaticComplexity:3, NPathComplexity:3) |
| Cpd | Pass | 0 |  |
| Composer validate | Info | 5 | valid; 5 advisory notes (composer validate --strict) |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | 24 | 24 | – | – |
| 2.4.8 | – | 23 | 23 | – |
| 2.4.9 | – | – | 23 | N/A |


### Tests

Unit and integration suites run per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### Unit Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |

#### Integration Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |


### Security

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | Pass | 0 |  |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["etechflow/module-product-warning"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

etechflow is a Magento 2 vendor on Packagento. See https://packagento.com/etechflow.md for their full catalogue.

