Skip to content

Instantly share code, notes, and snippets.

@RobertCalise
RobertCalise / README.md
Created June 16, 2020 15:25
Infusionsoft Custom Domain Affiliate Redirect Script

How to use this script

If you would like your Infusionsoft affiliate links to look like this:

https://yourdomain.com/refer/?w=ABC&p=123&a=XYZ

Create a directory on your website (for the example above, refer). In that directory, copy the code provided in this gist into a file called index.php.

#add_payment_method .woocommerce-PaymentMethod label { margin-left: 10px; }
#add_payment_method li { clear: right; }
#add_payment_method #wc-stripe_sepa-form { padding: 10px; }
form#order_review #payment_method_stripe { margin: 25px 0 25px 25px; }
form#order_review #payment_method_stripe_sepa { margin: 25px 0 25px 25px; }
form#order_review .payment_methods label { margin-left: 10px; }
form#order_review li { clear: right; }
form#order_review #wc-stripe_sepa-form { padding: 10px; }
.wc_payment_method .payment_box label { display: inline; }
@RobertCalise
RobertCalise / README.md
Created June 13, 2017 17:26
Grab a URL parameter (hop) and insert it into an Infusionsoft web form hidden field

The Javascript in this gist can be used to grab a parameter (in this example, called "hop") from the URL's query string and place that value into a hidden form field (in this example, with an id of #inf_field_FieldName.)

There are two assumptions in this example, so you should alter them for your own use case.

Assumption 1: the URL parameter you're getting is called "hop".

For example, if you are accessing this page at http://example.com/?hop=something, then this example would retrieve a value of "something". If your URL parameter is called something other than "hop", change it on Line 8 of the example script from

document.getElementById('inf_field_FieldName').value = getUrlParameter('hop');

@RobertCalise
RobertCalise / infusionsoft-agree-terms-checkbox.html
Created May 16, 2017 14:38
Inject a required "I agree to the Terms" checkbox into an Infusionsoft web form
<script type="text/javascript">
var terms_name = 'Terms &amp; Conditions',
terms_link = 'https://yourwebsite.com/link/to/terms';
jQuery(document).ready(function() {
jQuery('.infusion-submit').before('<div style="margin-bottom: 5px;"><input id="inf_option_IagreetotheTermsConditions" name="inf_option_IagreetotheTermsConditions" style="margin-right:3px;" type="checkbox" value="232" /><label for="inf_option_IagreetotheTermsConditions">I agree to the <a href="'+terms_link+'" target="_blank">'+terms_name+'</a></label></div>');
jQuery('.infusion-form').on('submit', function(e) {
if(!jQuery('#inf_option_IagreetotheTermsConditions').is(':checked')) {
e.preventDefault();
alert('You must agree to the ' + terms_name + ' before submitting this form!');
@RobertCalise
RobertCalise / infusionsoft-customize-review-order-button-label.html
Last active June 24, 2017 16:43
Customize "review order" button label in Infusionsoft Shopping Cart theme.
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('a#reviewOrderButton').html('Proceed to Checkout');
});
</script>
@RobertCalise
RobertCalise / example.html
Created March 30, 2017 00:16
Example: Change Infusionsoft web form field type from "text" to "password" in order to mask input
<!-- assumes a field with an id of inf_field_Company exists on the page -->
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#inf_field_Company').attr('type', 'password');
});
</script>
@RobertCalise
RobertCalise / infusionsoft-timezone-field.html
Created March 21, 2017 16:11
Fill Infusionsoft Timezone Field
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.6/jstz.js"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
var tz = jstz.determine().name(),
selected = jQuery('#Contact0TimeZone option[value="' + tz + '"]').prop('selected', true).val();
if(selected === undefined) {
/* If no match found, default to America/New_York as a fallback */
jQuery('#Contact0TimeZone option[value="America/New_York"]').prop('selected', true);
}
});

Keybase proof

I hereby claim:

  • I am robertcalise on github.
  • I am robertcalise (https://keybase.io/robertcalise) on keybase.
  • I have a public key whose fingerprint is 9834 6E7E BB03 D290 A179 5570 E109 3929 3C43 590A

To claim this, I am signing this object:

@RobertCalise
RobertCalise / gist:19f3fbaad1d6f8cae2d9
Last active August 29, 2015 14:11
Quick (hacky) way to ensure a PHP date is in the future.
<?php
// Assuming the date you're looking for is January 2:
$when = 'January 2';
// Verbose method:
if(($date = strtotime($when)) < time()) {
$date = strtotime('+1 year', $date);
}
@RobertCalise
RobertCalise / translate.html
Last active August 29, 2015 14:04
Simple text replacement with jQuery.
<!DOCTYPE html>
<html>
<head>
<title>jQuery Translation Example</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var translate = {
"Hello, world!": "Bonjour tout le monde!",
"This is an example.": "Ceci est un exemple."