Comments (3)
Or - maybe another option is to only verify the availableTo against the availableFrom and de-couple them from the event endDate. This way users/admins have flexibility to set ticket dates that work for their use case.
from events.
Yii rules are a little difficult to "unset", but it certainly is possible! You'll want to loop through any of the rules configured for the element and remove it, adding your own.
use craft\events\DefineRulesEvent;
use verbb\events\elements\Ticket;
use yii\base\Event;
Event::on(Ticket::class, Ticket::EVENT_DEFINE_RULES, function(DefineRulesEvent $event) {
foreach ($event->rules as $key => $rule) {
[$attribute, $validator] = $rule;
if ($attribute === ['availableFrom', 'availableTo']) {
unset($event->rules[$key]);
}
if ($attribute === ['availableFrom']) {
unset($event->rules[$key]);
}
}
});
But you'll need to get on the latest craft-4
branch for that as well.
And yeah, I'll consider that. I was just thinking that there's no point in offering tickets for sale once the end date of the event is over, but this is purely a validation step.
from events.
Hi, thanks for that. We've started the upgrade to craft-v4, so I'll get that finished and hook into unsetting these rules. Thanks.
from events.
Related Issues (20)
- Ticket only available to purchase if enabled on primary site HOT 1
- duplicate event but not tickets HOT 1
- Download Tickets in Control Panel HOT 2
- Function availableQuantity of Ticket class returns bool HOT 2
- Separate user permission for event ticket settings
- Propagation Methods for events on multisite setups HOT 1
- Multisite edit issues HOT 2
- No purchased tickets are generated when the order is updated. HOT 3
- Events Causing Extra Shipping Charges in the Cart. HOT 11
- Cannot manually add ticket to order in CP HOT 4
- Ticket line items in cart not merged with cart when user logs in HOT 3
- Disable deleting a ticket if it's it's already been purchsed HOT 2
- Total capacity always defaults to 0 making it always required or the event becomes unavailable HOT 4
- Tickets in feedMe? HOT 4
- Add events for checkin and un-checkin HOT 1
- Add field setting to allow only future events to be picked
- Wrong URLs behind 'New event' Button on non-primary sites. HOT 3
- Feature Request: Support Start Date / End Date in Craft 5's card view mode HOT 1
- Error when adding new event type HOT 1
- Purchased Tickets Filter Not Working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from events.