Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
v:0.7.2:checkout [2011/11/08 02:56] – [Customising which Credit Card types are allowed on your Checkout] adam | v:0.7.2:checkout [2017/04/26 07:02] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 117: | Line 117: | ||
==== Required Fields ==== | ==== Required Fields ==== | ||
- | You can required | + | You can require |
<code html>< | <code html>< | ||
For example, if you wanted to force a Terms of Service acceptance, it'd look like this: | For example, if you wanted to force a Terms of Service acceptance, it'd look like this: | ||
Line 159: | Line 159: | ||
Pre-populating is done by passing in [[.: | Pre-populating is done by passing in [[.: | ||
+ | |||
+ | ===== Adding custom validation to your Checkout ===== | ||
+ | Often when adding custom fields or doing some advanced customisations, | ||
+ | |||
+ | To prevent the checkout from validating (and therefore preventing the checkout from submitting), | ||
+ | |||
+ | <code javascript>< | ||
+ | FC.checkout.config.isValid = false; | ||
+ | </ | ||
+ | |||
+ | Setting that variable to false will prevent the checkout from submitting, and obviously, setting it to true will allow an order to complete. Note that if you're using this type of functionality, | ||
+ | simply won't be able to check out. | ||
+ | |||
+ | As an example, this code will check a custom checkout text input which requires customers type in their age, and checks that they are over the age of 18. | ||
+ | |||
+ | <code javascript>< | ||
+ | function ageCheck() { | ||
+ | var custAge = jQuery("# | ||
+ | if (!isNaN(parseFloat(custAge)) && isFinite(custAge) && parseFloat(custAge) >= 18) { | ||
+ | FC.checkout.config.isValid = true; | ||
+ | } else { | ||
+ | FC.checkout.config.isValid = false; | ||
+ | alert(" | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Run our custom validation before the checkout validates | ||
+ | FC.checkout.overload(" | ||
+ | </ | ||
+ | |||
+ | This type of setup can be expanded to show and hide error messages similar to how FoxyCart does with the default fields also. | ||
+ | |||
+ | <wrap hi>Make sure that you're setting '' | ||
===== Customising which Credit Card types are allowed on your Checkout ===== | ===== Customising which Credit Card types are allowed on your Checkout ===== | ||
Line 172: | Line 205: | ||
FC.checkout.config.validPaymentCards = [" | FC.checkout.config.validPaymentCards = [" | ||
</ | </ | ||
+ | |||
+ | You'll also need to update the "pay with credit card" checkout language string in your FoxyCart admin under the language settings. | ||
===== Other Checkout Actions ===== | ===== Other Checkout Actions ===== | ||
The checkout is primarily used to pay for new purchases, but there are certain other situations that arise that are still handled through the checkout. It's important to understand when your checkout can be used for other purposes so you can design and style accordingly. | The checkout is primarily used to pay for new purchases, but there are certain other situations that arise that are still handled through the checkout. It's important to understand when your checkout can be used for other purposes so you can design and style accordingly. |