Pages:

Adding fields to 3x

idaryl

Avatar: idaryl

2008-05-16 22:51

OK so who wants to add a field to the order form?

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

No avatar

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")?

beholder

Avatar: beholder

2008-05-22 21:17

delete

type="text" 

on this line:

<input type="text" name="sState" value="$aData[sState]" size="50" maxlength="40" class="input" alt="simple" />

QC 3.0

beholder

Avatar: beholder

2008-05-22 21:22

or just delete

type="text"

anywhere where you have the field in the templates

QC 3.0

sidesweep

No avatar

2008-05-23 11:00

Dear Beholder. I tried it and sadly it did not work.

I tried it in both templates > orders_form.tpl and templates > admin > orders.tpl

I also noticed that "company" entry (which is not in bold) does use the type="text" field

btw I apologize for hijacking this tread

idaryl

Avatar: idaryl

2008-05-23 11:20

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...

idaryl

Avatar: idaryl

2008-05-23 11:31

OK look at the default.css line 182 (or thereabouts
order #personalData label {
display:block;
font-weight:bold;
}

bear in mind that once you turn this to normal it will affect (everything) that uses this - all the titles etc, etc

OK

beholder

Avatar: beholder

2008-05-23 11:53

allright I messed up, my bad.

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

No avatar

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?

Thank you both

beholder

Avatar: beholder

2008-05-25 01:12

templates/default.css:


#order #personalData #company label, #order #personalData #comment label{font-weight:normal;}



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

QC 3.0

idaryl

Avatar: idaryl

2008-05-25 22:43

Thanks beholder - I guess I didn't explain correctly when I said to "turn this to normal"

atlanticzone

Avatar: atlanticzone

2010-12-19 12:20

hy
I want to add 4 additional field in order form but not being drop down menu for v3.3
Can you help me?
Thanks
Best regards

beholder

Avatar: beholder

2010-12-20 20:40

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..

atlanticzone

Avatar: atlanticzone

2010-12-20 23:26

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.

Regards

atlanticzone

Avatar: atlanticzone

2010-12-20 23:36

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

beholder

Avatar: beholder

2010-12-21 13:58

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.

q900761

Avatar: q900761

2011-01-14 01:08

Is it possible that state drop down menu field is visible only if customer chooses some certain delivery method - example UPS?

q900761

Avatar: q900761

2011-01-14 01:32

And is it possible to create a drop down menu that will have items listed under unselectable headings, such as:

Michigan
Detroit
Grand Rapids
Lansing
Illinois
Chicago

q900761

Avatar: q900761

2011-01-14 01:35

Michigan
__ Detroit
__ Grand Rapids
__ Lansing
Illinois
__ Chicago

"__" should be spaces or headings should be in bold

beholder

Avatar: beholder

2011-01-14 01:38

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.

Pages:
Back to top
about us | contact