Skip to content

Instantly share code, notes, and snippets.

@tangar76
Last active October 5, 2018 08:13
Show Gist options
  • Save tangar76/8c4351c551828a66ffd9dfacabf84f36 to your computer and use it in GitHub Desktop.
Save tangar76/8c4351c551828a66ffd9dfacabf84f36 to your computer and use it in GitHub Desktop.
Firecheckout M1 - customization examples
// create CMS block with content below and output it on FireCheckout:
/*
<div id="california_warning" style="display: none; border: 1px solid #bdbdbd; padding: 5px;">
<div style="float: left; margin: 0 5px 0 0; max-width: 60px;"><img alt="Warning" src="{{media url="wysiwyg/prop-65-triangle.jpg"}}" /></div>
<div><strong>WARNING:</strong> This product can expose you to lead, a chemical which is to the State of California to cause cancer and/or birth defects or other reproductive harm. For more information, visit www.P65Warnings.ca.gov.</div>
<div class="clearer">&nbsp;</div>
</div>
*/
document.observe('dom:loaded', function() {
FC.DependentFields.addRule(
'california_warning_1', // unique rule identifier
{
fields: {
'billing:use_for_shipping_yes': true, // Use billing as shipping
'billilng:country_id': ['US'], // When country is US
'billing:region_id': '12' // State is California
},
match: {
method: function() {
var warning = $('california_warning');
if (warning) {
warning.show()
}
}
},
unmatch: {
method: function() {
var warning = $('california_warning');
if (warning && $('billing:use_for_shipping_yes').checked) {
warning.hide();
}
}
}
}
);
FC.DependentFields.addRule(
'california_warning_2', // unique rule identifier
{
fields: {
'billing:use_for_shipping_no': true, // Shipping is separate address
'shipping:country_id': ['US'], // When country is US
'shipping:region_id': '12' // State is California
},
match: {
method: function() {
var warning = $('california_warning');
if (warning) {
warning.show()
}
}
},
unmatch: {
method: function() {
var warning = $('california_warning');
if (warning && $('billing:use_for_shipping_no').checked) {
warning.hide();
}
}
}
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment