Week ending September 20th, 2019

Our eldest son entered kindergarten this month, which is probably affecting the rest of us more than him. It means everyone but me needs to be ready to leave the house earlier every morning, and our younger son now doesn’t have his play buddy during weekdays. For Jack I think he’s enjoying learning new stuff, making new friends, and playing on the playground every day. It’s wonderful to hear about his school adventures and see him growing in new ways. Now that he has finished gradual entry and is doing full days at school, it does mean that my work days are interrupted a little less and my younger son gets more attention when we spend lunch time together.

Youth Unlimited

A local charitable organization had a fundraising form that was not properly finishing the payment process. The payment would occur, but the donor would end up on an error message instead of the thank you page. I figured out that by changing the Stripe mode the process would complete. The system was able to display fundraising totals for individuals, teams, and the whole event, but the total calculations were incorrect and required some parts to be done manually. I used some of my grade 6 math skills to create cleaner and more reliable formulas for generating the totals on every payment process. This should save the Youth Unlimited team some time and give donors a better user experience because they will see their donations reflected in the totals immediately.

ISSofBC

It feels so good to release something you have been working on for a while, and this week was no exception. After a few months of slowly reworking the checkout for ISSofBC, I was able to finish up the WooCommerce checkout modifications. We have numerous new fields, grouped into two pages, with a bunch of custom headings, and reordered to meet the client’s specifications. New students will get to experience the enhanced checkout flow that is cleaner, more interactive, and gathers all the details the ISSofBC staff require. While I am not a huge fan of getting too crazy with changes to a system as vital as the checkout it can be extensively modified using built in WooCommerce filters.

Capital Insurance

As part of an integration that Capital Insurance has with another system, we get periodically updated tables of vehicle types and VIN numbers. A few weeks ago, I created processes for storing vehicle data for tens of thousands of vehicle makes/models/years into custom WordPress database tables. The next step was creating two new Gravity Form field types to use this data. The first field is for retrieving a vehicle’s make/model/year from the VIN number. The second field allows them to choose from all the vehicle makes; we then get a list of all models for that make, they select the make, then we show all years for that make. After they select a year we have a specific VICC code that can be passed along to the Fortus service via their API. By switching to these new fields the vehicle make, model, and year are going to be precise and much more reliable than the previous text field that the user just typed into.

I’ve never created a new “complex” Gravity Form field before that had sub-fields like this. These fields are actually a combination of 5 or 6 sub-fields with some fields being visible and others being hidden. As the user interacts with the field, we update data in the hidden fields. These sub-fields will be available for processing to any feed add-ons, notifications, and confirmations. I used the default Gravity Forms “Address” and “Name” fields as examples of complex fields to style my new fields after.
One important thing to take note of is labelling the sub-fields using JavaScript.

I recommend adding a method like this to your custom field class:

	public function get_form_editor_inline_script_on_page_render() {
		$script = sprintf( "function SetDefaultValues_%s(field) {
		field.label = '%s';
		field.inputs = [new Input(field.id + '.1', '%s'), new Input(field.id + '.2', '%s'), new Input(field.id + '.3', '%s'), new Input(field.id + '.4', '%s')];
		}", $this->type, $this->get_form_editor_field_title(), 'VIN', 'Make', 'Model', 'Year' ) . PHP_EOL;

		return $script;
	}

Here’s a fuller example of a new field type that uses a lot of the same techniques. It’s really cool to see these new fields working fast and reliably, and I am excited to get them added to our clients’ insurance forms.





The complete Work Journal series:
1. Week ending January 25th, 2019
2. Week ending February 1st, 2019
3. Week ending February 8th, 2019
4. Week ending February 15th, 2019
5. Week ending February 22nd, 2019
6. Week ending March 1st, 2019
7. Week ending March 8th, 2019
8. Week ending March 15th, 2019
9. Week ending March 22nd, 2019
10. Week ending March 29nd, 2019
11. Week ending April 5th, 2019
12. Week ending April 12th, 2019
13. Week ending April 19th, 2019
14. Week ending August 9th, 2019
15. Week ending September 20th, 2019
16. Week ending September 27th, 2019
17. Week ending December 6th, 2019
18. Week ending October 2nd, 2020
19. Week ending April 2nd, 2021
20. Coding API integrations in Twilio Studio - Work Journal May 8, 2021
21. Trudging through a complex theme implementation - Work Journal October 29, 2021
22. Creating custom Duda widgets - Work Journal December 10, 2021
23. My first Laravel Nova project - Work Journal December 1, 2023
24. Let's talk about Statamic - Work Journal January 12, 2024