Exampled here will add a State (drop menu) to Version 3
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lang > en.php add to array - $lang['State'] = "State"; ------------------------- templates > orders_form.tpl add to form array - <div id="state"> <label for="oState">$lang[State]</label> </div> <div id="state"> <label for="oState">$lang[State]</label> <select name="sState" id="oState" onChange="saveUserData( this );"> <option value=""> $lang[choose] </option> <option value="AL">Alabama</option> <option value="AK">Alaska</option> <option value="AZ">Arizona</option> <option value="AR">Arkansas</option> <option value="CA">California</option> <option value="CO">Colorado</option> <option value="CT">Connecticut</option> <option value="DE">Delaware</option> <option value="DC">District of Columbia</option> <option value="FL">Florida</option> <option value="GA">Georgia</option> <option value="HI">Hawaii</option> <option value="ID">Idaho</option> <option value="IL">Illinois</option> <option value="IN">Indiana</option> <option value="IA">Iowa</option> <option value="KS">Kansas</option> <option value="KY">Kentucky</option> <option value="LA">Louisiana</option> <option value="ME">Maine</option> <option value="MD">Maryland</option> <option value="MA">Massachusetts</option> <option value="MI">Michigan</option> <option value="MN">Minnesota</option> <option value="MS">Mississippi</option> <option value="MO">Missouri</option> <option value="MT">Montana</option> <option value="NE">Nebraska</option> <option value="NV">Nevada</option> <option value="NH">New Hampshire</option> <option value="NJ">New Jersey</option> <option value="NM">New Mexico</option> <option value="NY">New York</option> <option value="NC">North Carolina</option> <option value="ND">North Dakota</option> <option value="OH">Ohio</option> <option value="OK">Oklahoma</option> <option value="OR">Oregon</option> <option value="PA">Pennsylvania</option> <option value="RI">Rhode Island</option> <option value="SC">South Carolina</option> <option value="SD">South Dakota</option> <option value="TN">Tennessee</option> <option value="TX">Texas</option> <option value="UT">Utah</option> <option value="VT">Vermont</option> <option value="VA">Virginia</option> <option value="WA">Washington</option> <option value="WV">West Virginia</option> <option value="WI">Wisconsin</option> <option value="WY">Wyoming</option> </select> </div> </div> ------------------------- templates > orders_print.tpl line 19 add to array - <dt class="state">$lang[State]:</dt><dd class="state">$aOrder[sState]</dd> line 74 Block BEGIN ORDER_EMAIL_BODY add to array - $aData[sState] line 91 Block BEGIN CUSTOMER_ORDER_EMAIL_BODY add to array - $aData[sState] ------------------------- templates > admin > orders.tpl line 153 add to array - <!-- state start --> <tr class="l0"> <th> $lang[State] </th> <td> <input type="text" name="sState" value="$aData[sState]" size="50" maxlength="40" class="input" alt="simple" /> </td> </tr> <!-- state end --> ---------------------------- core > common.js line 174 add to array - 'sState' ----------------------------- core > orders.php line 256 add to array - && throwStrLen( $aForm['sState'] ) > 0 ---------------------------- db > orders.def.php line 2 add to end of array - , 'sState' => 19 line 4 add to end of array - , 'sState' line 7 add to end of array - , 'sState' => $aExp[19] ) -----------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
» Quick.Cart v3.x
http://www.cartedit.com
sidesweep
2008-05-22 13:39
Thank you for the suggestion. I used it post to add an additional filed and managed to set as as optional.
However this additional field shows in bold - could you advice me on how te change the formatting of this additional filed to normal (e.g. like "company filed")?
Sorry beholder he was asking why is the sState field in bold not like the company and the comment - its because the field is "required" - parts of the form have js attached to verify they were filled in - so the css styling sets the text titles to bold - if you want the state fielsd to be not bold you'll gave to remove the js code that controls the verification etc, etc. corecommon.js
however the reason its that way is to make sure that the user fills it in - it is used (eventually) by paypal authorise,net or some payment gateways and they require this field - you understand...
It should be like this: If you want to control display (font weight) of the order form fields, use css, it's easy.
If you want to control how the fields are verified, use
alt="simple"
for any normal input fields or
title="simple"
for any select field. You can add/delete these in the templates, add them to the html tags <input> and <select>.
QC 3.0
sidesweep
2008-05-23 12:09
idary - I actually removed the alt="simple" (i understand this defines the field as mandatory to fill out) for the new field at the very begging and used Company field as reference for all tags and my new filed is still in bold while company field is normal.
beholder - does company filed use a different ccs entry then other fields displayed in bold? Where could I find the difference between them?
The fields of the form are marked by the <div id=...> tags in the templates/order_form.css
Sidesweep, next time you should do some css research yourself, this was a trivial question. Then when you get lost, ask here :-) This way you can grow. Guys from opensolution.org even provided you with a nice starting point here: http://opensolution.org/Quick.Cart/docs/?id=design
It's not really a question of how to add fields but what do you want to do with the data after the form is submitted. Adding fields is easy, once you check out for yourself how forms work and how orders_form.tpl works. So saying you want 4 more fields is like saying you want honey but we need to know what do you want to do with honey after you get it..
hy I need the data generated by the 4 extra fields to appear in the same pages like the data generated by the default fields especially in the email with the oder email to admin Because I copy the data from the email to admin and paste them into a excel file that automatically generated the postal documents specific for my country. In my country the postal documents requires 12 fields. Actually the QC script send to me data for 8 fields and i manually completed the rest of 4 fields in my excel documents.
p.s. I want to give my customers the possibility to complete 12 fields an send to me 12 different data that perfectely feet with the 12 fields of the postal documents
On the second though perhaps (I don't know if this ever occured to you) Quick Cart can be used to generate/print those documents directly, skipping the "copy to excel" step alltogether. I have some experience with this and I think I could have this done for you in about 1-2 days. If you're not interested, I will just continue telling you unspecifically from memory what needs to be modified to add those 4 field like you originally wanted. Basic knowledge of PHP and HTML will be required to implement it.
javascript on that page should be modified substantially in that case. But it is possible. Basically, instead of countCarrierPrice() when changing the radio selection you would call your own displayStatesSelect() and immediately after that countCarrierPrice(). displayStatesSelect() would be the function that decides whether the select should be shown or hidden by CSS.