WPSuperDealer

Gravity Forms & ADFxml

WPSuperDealer, Gravity Forms & ADFxml

First off, let’s get to the important stuff.

What is ADFxml? or is it ADFxml, adfXML, adfxml or ADFXML? or does that even matter?

Regardless, if you want some details on ADFxml and what it is then you should check out the WikiPedia page.

In a nutshell, it’s an XML format that a bunch of folks agreed on for sending data around in the automotive industry. Pretty fancy stuff if you ask us, it has all kinds of tags for all kinds of information and gives us a standard way of passing around some vital information.

Here’s a really basic example:

				
					<?xml version="1.0" encoding="UTF-8"?>
<?adf version="1.0"?>
<adf>
    <prospect>
        <requestdate>2000-04-20T15:34:24-06:10</requestdate>
        <vehicle>
            <year>2018</year>
            <make>Ford</make>
            <model>Focusl</model>
        </vehicle>
        <customer>
            <contact>
                <name part="first">Susan</name>
                <name part="last">Smith</name>
                <phone>816-555-9312</phone>
                <email>susan@emailaddress.com</email>
            </contact>
        </customer>
        <vendor>
            <contact>
                <name part="full">Big City Mike's Preowned Emporium</name>
            </contact>
        </vendor>
    </prospect>
</adf>
				
			

See what we mean? Fancy.

Let’s say you have a CRM and want to send data (ie. leads) from your website and have it stream right into that CRM. If you’re in the automotive industry then there’s a decent chance you’ll be using ADFxml to do that.

Before we get around to setting up the ADFxml, we need to figure out how to add our vehicle data to our forms.

Adding Vehicle Data to Gravity Forms

First install WPSuperDealer and get it all setup, then get Gravity Forms installed and setup.

Create a form and name it “VDP Contact Form”, we’re going to drop this into the VDP, so we’ll give it a name that we can easily identify it from.

Add a “name” field (the one with first and last name) then, in this order, add fields for; email, phone & comments. You can add others if you want, but for now let’s keep it simple.

Now add a hidden field and name it “Vin”. Under “Advanced” in the field settings you’ll want to check the box that says “Allow Field to be populated dynamically”. In the parameter name field put “vin”.

Next is the fun part, adding the form to your VDP. You can add it with a widget, a filter or if you have the WPSuperDealer Template Manager then you can bake it right into your VDP Template.

Now in a new window go to Dashboard->Appearance->Widgets (yes, old school sidebars – there’s other ways to add it to your VDP, depending on your theme, but regardless of method you’ll be using “vehicle tags” to populate the vehicle data – see below).

Drop a “Custom HTML” widget into the “Single Vehicle Middle” Sidebar area and then drop the following shortcode into it (change the form id to match the id of the form you just created).

				
					[gravityform id="1" field_values="vin={vin}"]
				
			

When you load a vehicle on the front end WPSuperDealer will intercept this shortcode and replace {vin} with the vin of the current vehicle because it’s a “vehicle tag”.

This only works on a single vehicle page or within a vehicle template if you’re using the WPSuperDealer Template Manager.

You’re not limited to just the Vin number, you can do this with any vehicle data field, including any custom fields. In most cases the “vehicle tag” will be the field name with all lower case letters and spaces replaced with underscores, then wrapped in curly brackets.

For example; the “Body Style” field has a tag that looks like this {body_style}, “Mileage” is {mileage}, “Stock Number” is {stock_number}, etc.

If you have the WPSuperDealer Template Manager it has some tools that display all of the available tags, including the vehicle contact information.

Quick Tweak

If you’ve tried to load a VDP with a form in it, then you might have run into a javascript issue, especially if you set ajax to true. No worries, there’s a quick fix for this. Just add the following code to your PHP and just like the section above we suggest using a free PlugIn like “Code Snippets” to add the custom code.

				
					function my_wpsd_init() {
	define( 'WPSD_RAW_VDP', true );
}
add_action( 'wp', 'my_wpsd_init', 1 );
				
			

This snippet tells WPSuperDealer to output the VDP without stripping javascript and special characters. You need to add this because Gravity forms now outputs a few things inline that can get stripped out or encoded if you don’t. But once you add the above code everything should output without any issues.

What about the ADFxml?

Let’s get to the real meat and taters here. We now know how to add hidden fields to our forms and we know how to populate them with the shortcode. There’s ways to populate them when using the different Gravity Form’s widgets, whether they’re blocks for Gutenberg or widgets for Elementor or another page builder. But we can’t get into all that crazy, they all support shortcodes so let’s make life easy and go that route for now.

The point here was generating some ADFxml and sending it out to a CRM.

Before we do that, you need to make sure you have hidden fields for the following: year, make, model, vin, stock number, trim, price & condition. Now go to your shortcode and do the same thing you did to vin to all of those.

The point here was generating some ADFxml and sending it out to a CRM.

Before we do that, you need to make sure you have hidden fields for the following: year, make, model, vin, stock number, trim, price & condition. Now go to your shortcode and do the same thing you did to vin to all of those.

That would give you a shortcode that looks something like this:

				
					[gravityform id="1" ajax="true" description="false" tabindex="1" field_values="year={year}&make={make}&{model}=model&vin={vin}&stock_number={stock_number}&trim_level={trim_level}&price={price}&condition={condition}"]
				
			

To recap, your form needs the following fields:

Visible Fields:

first name, last name, email, phone, comments

Hidden Fields:

year, make, model, vin, stock number, trim, price, condition

Time to Create an ADFxml Notification!

We’re getting into the thick of it now! I can almost see that finish line up ahead. Kind makes me wish we had super speed, zip and it’s knocked out.

Go to the “Notifications” for the form you created and create a new one. Name it “Admin – ADFxml” – fill out so it goes where it’s supposed to go then scroll down to the message part. Here’s where it gets tricky, you have to flip the editor from “Visual” to “Text”, otherwise you’ll lose all your tags and puppies will cry, it’s really sad so don’t forget. You have to do this EVERY time you save your notification.

In that text area you’re going to drop the following boiler plate ADFxml – it can get a lot fancier than this, but let’s use this for our example. Don’t forget to edit it as needed, unless you’re Big City Mike, then you should update the vendor info and the provider info. Think of the vendor as the dealer and the provider as the company responsible for the site the lead came from.

You also need to update the tags to make sure they have the right ids for the fields from the form. If you add the year field first it and not seventh then it would be {Year:1} – unlike in the shortcode the tags inside those curly brackets aren’t vehicle data fields, they’re the Gravity Form tags that come from the hidden fields themselves. If you’ve every edited a notification before then you should know how that works and if you haven’t….well, it’s not too confusing right?

				
					<?xml version="1.0"?>
<?adf version="1.0"?>
<adf>
<prospect>
<requestdate>{date_mdy}</requestdate>
<vehicle interest="buy" status="{Condition:14}">
  <year>{Year:7}</year>
  <make>{Make:8}</make>
  <model>{Model:9}</model>
  <vin>{VIN:10}</vin>     
  <stock>{StockNumber:11}</stock>     
  <trim>{Trim:12}</trim>     
  <price>{Price:13}</price> 
</vehicle>
<customer>
  <contact>
    <name part="full">{Name (First):1.3} {Name (Last):1.6}</name>
    <phone>{Phone:2}</phone>
    <email>{Email:3}</email>
  </contact>
</customer>
<comments>{Comments:4}</comments>
<vendor>      
  <vendorname>Big City Mike</vendorname>
  <url>{embed_url}</url>     
  <contact>        
    <name part="full">Big City Mike</name>
    <email>Sales@BigCityMike.com</email>
    <phone>816-555-1212</phone>
  </contact>   
</vendor>   
<provider>      
  <name part="full">Big City Mike Website</name>
  <url>https://BigCityMike.com/</url>
  <email>webmaster@BigCityMike.com</email>   
</provider>  
</prospect>
</adf>
				
			

Not done yet

If only it was as simple as just hitting save. Which reminds me, save that notification. In fact, set the email to go to yourself and send yourself a test and check out the XML and make sure all the data populated correctly.

When you get done testing, you might have another tweak to make depending on the CRM you’re sending to.

By default Gravity Forms sends emails as ‘Content-Type: text/HTML; ‘ Some CRMs can not handle the ‘HTML’ version of the lead. In order to change it to ‘Content-Type: text/plain; ‘ you’ll need to get sneaky and add some PHP code to your site. We suggest using a free PlugIn like “Code Snippets” to add this custom code.

				
					//change GF notification from text-html to text-plain for a Specific Notification
add_filter( 'gform_notification', 'my_change_notification_format', 10, 3 );
function my_change_notification_format( $notification, $form, $entry ) {
 
 if ( $notification['name'] == 'ADFxml' ) {

 // change notification format to text from the default html
 $notification['message_format'] = 'text';

 return $notification;
 } else {
 
 $notification['message_format'] = 'html';
 return $notification;
  }
}
				
			

ADFxml for the Win

If you did everything above and you got it all mapped right, then you should be rocking and rolling with leads just flowing into your CRM.

Similar techniques can be used with other PlugIns used to make forms, like ContactForm7 or NinjaForms. If you need help integrating your forms with WPSuperDealer then hop over to our “Custom Development” page and get a no obligation estimate.

You can also fill out the contact form below and let us know a bit about your project, then we can chit chat some and we’ll lay out an estimate tailored to your needs.

One last minute piece of advice, if you’re building this yourself then do yourself a favor and grab a copy of the WPSuperDealer Template Manager add-on. It makes customizing your VDP (Vehicle Display Pages… ie – Single Vehicle Pages) much easier and gives you the ability to completely customize the layout and add anything you want, including forms.

Best Wishes & God Speed!

Questions?

Send us a message

Built by the Heroes at

WPSuperTeam.com

Unleash your Hidden Hero!