Is it possible to check Extra Fields at checkout? I did not find any option into conditional actions in ubercart.
If not, is there a way to add it? any exemple.

Comments

maurizio.ganovelli’s picture

Hi ledom, this feature is very interesting. I think the easiest way for user would be to have a trigger for extra field validation, but i must work on it to see if it's possible. For the moment, you can try to use "Rules Form support" in Rules package, adding event/conditions on checkout form validation.

ledom’s picture

Thanks Blackice78! I just give it a try and it seems it can do the job. I forgot this usefull form module... To much modules...

My goal for this request is testing Delivery Day extra field and check cart for wrong products and remove them. Now I just need to see if checking cart and remove products is possible.

megachriz’s picture

If you want to validate a field only, you can also do this in a custom module with a form alter hook.
See this example: #888128: Validation for the extra fields

megachriz’s picture

Title: Condtional action at checkout on Extra Fields » Conditional action at checkout on Extra Fields

Corrected issue title.

maurizio.ganovelli’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Assigned: Unassigned » maurizio.ganovelli
StatusFileSize
new876 bytes
new1.15 KB

Hi all,
in attachment you can find a patch (and a new file to add rename it to uc_extra_fields_pane.ca.inc) for 6.x-2.x dev version. The patch provide a simple integration with Conditional Action, adding two new triggers "Extra Fields: Checkout Form Validation" & "Extra Fields: Order Edit Form Validation". These functions get called during validation of the checkout and order edit forms. User can then add conditions/actions with the possibility to execute custom php code: submitted form values are passed as argument "$form" (the second --$form_state-- argument of original validation function).
I hope it can be useful.

megachriz’s picture

I've tested the patch, but I don't see a reason why we should add this to Extra Fields Pane. With this patch, if you want to validate the form, you still need to know PHP in order to validate it. You even need to know PHP to set the conditions (except if you want to set the condition "Check the current date"). In that case I think you might as well add the validation rules in a custom module.

I haven't tested "Rules Form support", but it sounds like that would be a good alternative.

Opinions?