silvershop-suite / timed-availability
Timed availability for SilverShop (SilverStripe CMS 6): an on-sale window (from/until) plus a manual always/never override on any product or category, so seasonal lines (Sinterklaas, Pasen, Moederdag, Vaderdag, Kerst) switch themselves on and off by date and can be forced instantly.
Package info
github.com/silvershop-suite/silvershop-timed-availability
Type:silverstripe-vendormodule
pkg:composer/silvershop-suite/timed-availability
Requires
- php: ^8.3
- silvershop/core: ^6
- silverstripe/cms: ^6.0
- silverstripe/framework: ^6.0
Requires (Dev)
- cambis/silverstan: ^2.1
- phpunit/phpunit: ^11.3
- silverstripe/sqlite3: ^4
- squizlabs/php_codesniffer: ^3.7
Suggests
- silvershop-suite/card-cache: The product-card cache folds the live availability into its fingerprint, so a cached card refreshes when the window opens or closes.
- silvershop-suite/storefront: Hides an out-of-season category from the storefront navigation and surfaces the on-sale state on the product card / PDP.
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-21 13:51:19 UTC
README
Put a product or a whole category on sale for a period only, and switch it on or off at will.
Built for seasonal ranges: Christmas, Easter, Mother's Day, Father's Day, Valentine's Day, Black Friday. Set the dates once per season (you edit them each year by taste and planning), or flip a single toggle to force it on or off right now.
- On-sale window —
AvailableFrom/AvailableUntil(either bound optional) on aProductand aProductCategory. - Instant override —
Always on sale/Never on saleignores the dates, for opening early, extending a strong season, or pulling something immediately. - Inheritance — a product with no dates of its own inherits its parent category's window, so you set the dates once on the "Christmas" category and leave the products blank.
- Out of season the item is not purchasable and is dropped from category listings. The CMS stays fully editable year-round — the gate is front-of-shop only.
No ModelAdmin, no scheduled job: availability is evaluated at request time, so nothing has to run to flip it.
Requirements
- SilverStripe CMS ^6
silvershop/core^6
Installation
composer require silvershop-suite/timed-availability
Then run a dev/build?flush=all.
Usage
Open a product or category in the CMS → the Availability tab:
| Field | Meaning |
|---|---|
| On sale | Automatic (use the dates) · Always on sale (ignore dates) · Never on sale (ignore dates) |
| On sale from | Optional start. Empty = no start limit. |
| On sale until | Optional end. Empty = no end limit. A date with no time means 00:00 — the start of that day. |
Examples for a seasonal range:
- Christmas category — on the category set from
15 Novuntil25 Dec 00:00; leave the products inside it blank. The whole range appears mid-November and closes on Christmas Day. - A single Easter item in a year-round category — set the window on just that product.
- Open a day early — flip the category to
Always on salefor the day, then back toAutomatic.
Behaviour
canPurchase()returns false out of season, so the add-to-cart is refused even on a direct link.ProductCategory::ProductsShowable()excludes out-of-season products from listings.$IsAvailableNow(bool) and$IsHiddenBySchedule(its inverse) are available in templates. Guard a menu loop with<% if not $IsHiddenBySchedule %>to hide an out-of-season category — a page without this module is never hidden by it.- With
silvershop-suite/card-cache, the live availability is folded into the product-card cache fingerprint.
Translations
Ships with English, Dutch, German, Spanish, French and Italian (lang/*.yml).
License
BSD-3-Clause. Copyright (c) 2026 Remy Vaartjes.
Credits
Developed by Remy Vaartjes and the SilverShop-Suite Contributors.