tastyigniter / ti-ext-cart

A TastyIgniter extension that allows you to easily add a shopping cart to your site.
MIT License
8 stars 32 forks source link

Allow checkout rules to be extended through events #50

Closed ryanmitchell closed 3 years ago

ryanmitchell commented 3 years ago

Allows devs/extensions to add checkout validation for extra fields.

When used in combination with Orders_model::extend(function($model) { $model->addFillable([ 'x' ]); and custom theme partials in an extension this means fields can be added quite easily.

sampoyigi commented 3 years ago

Love the approach but we also should be able to override existing rules but that would be a bit tricky with the way the rules array is structured... So maybe we should restructure the rules laravel style...

ryanmitchell commented 3 years ago

As in key => value ? How would that work with the custom validator and passing messages. And just change here or change everywhere?

sampoyigi commented 3 years ago

OK tracking back on this one, the approach is a bit tricky because of the rules array structure and merging the rules doesn't feel right.

Another way devs can add extra checkout validation is by adding their custom validator logic when igniter.checkout.beforeSaveOrder event is fired.

What do you think?

ryanmitchell commented 3 years ago

Yep thats fair. I'll close this.