How to to add a custom field to the CartIt checkout.
In CartIt 4.0, 5.0, and 8.0 you have access to ImpactObjects. A usefull ImpactObject is %io_web_*. This ImpactObject allows you to capture web data. It's primarily used in cartit_invoice.html in association with disclaimer.html.
Let's assume that you would like to ask the customer where they heard about your company.
In disclaimer.html you can add any form fields you like. Do not put the beginning or closing <form> tags. The CartIt shopping cart adds them automatically. Extra form tags will prevent the cart from functioning properly.
You could add the following example to your disclaimer.html file:
Where did you hear about our company?<br />
<SELECT NAME="mycustom_hear">
<OPTION VALUE="Search Engine">Search Engine</OPTION>
<OPTION VALUE="Television">Television</OPTION>
<OPTION VALUE="Radio">Radio</OPTION>
<OPTION VALUE="Word of Mouth">Word of Mouth</OPTION>
</SELECT>
Which should look like this in the page:
Where did you hear about our company?
Note that the name of this form element is "mycustom_hear". The important part of this name is "mycustom_". You should start all field names with "mycustom_". The "mycustom_" naming convention should prevent your custom field names from interfering with the internal operation of CartIt. Your field names must also have no spaces in them. If you wish to have a space, use an underscore ( _ ) instead.
So to review:
- Start field names with "mycustom_"
- Never use a space: allowed characters are a-z and the underscore _ only
- Never use the FORM tag, only form elements (CartIt creates the actual form)
Now that you have this form field in the disclaimer.html file, you should be able to capture it using the associated ImpactObject: %io_web_mycustom_hear% as in %io_web_mycustom_anything% In this case, the name of the form field we are attempting to capture is "mycustom_hear".
You should place this ImpactObject tag in order-related ImpactObject Templates:
- cartit_invoice.html The invoice displayed to the shopper online
- cartit_cb_invoice.html The invoice imported into CommerceBuddy
- cartit_invoice_notice.txt The order notice sent to the store operator
- cartit_invoice.txt The invoice emailed to your shopper
For more details, you should read the ImapctObject reference guide.