[TYPO3-commerce] Add address field for state/region
Jordan Schaan
jordan at sensolutions.com
Fri Oct 12 18:07:30 CEST 2007
Some minor corrections to the code given;
- you should use 'region' INSTEAD OF 'zone' since 'region' is the field
name in tt_address table (if you do NOT use 'region' you will find that
inserting addresses fail! [bang head against wall here])
- pi3 uses 'general_KEY' while pi4 uses 'label_KEY' for address field
LANGs
The template setup code then becomes;
----------
plugin.tx_commerce_pi3.billing.sourceFields.region {
type = static_info_tables
field = SUBDIVISIONS
select = 1
mandatory = 1
readonly = 0
}
#add region to addresses entered for logged in users
plugin.tx_commerce_pi4.formFields.region {
type = static_info_tables
field = SUBDIVISIONS
select = 1
mandatory = 1
readonly = 0
}
----------
and as Franz mentioned, you can (and should) add LANG defs in the typo
setup;
----------
plugin.tx_commerce_pi3._LOCAL_LANG {
default.general_region = State
de.general_region = Region
}
plugin.tx_commerce_pi4._LOCAL_LANG {
default.label_region = State
de.label_region = Region
}
----------
Then use something like this in your template(s) to add region/zone/state
(whatever you want to call it!);
---------
<dt>###LABEL_ZIP###</dt> <dd>###FIELD_ZIP###</dd>
<dt>###LABEL_REGION###</dt> <dd>###REGION###</dd>
<dt>###LABEL_COUNTRY###</dt> <dd>###FIELD_COUNTRY###</dd>
---------
Also note, that this template code will give you a drop down list with ALL
of the regions (for every country). In my opinion this is not very user
friendly. I've made a small extension that adds javascript to mitigate
this. If any one is interested please contact me.
Cheers,
Jordan
On Tue, 02 Oct 2007 01:15:06 -0600, David Toshack <david at vaultin.com>
wrote:
>
> Add to your template setup:
>
> plugin.tx_commerce_pi3.billing.sourceFields.zone {
> type = static_info_tables
> field = SUBDIVISIONS
> select = 1
> mandatory = 1
> readonly = 0
> }
>
> plugin.tx_commerce_pi3.billing.sourceFields.zone {
> type = static_info_tables
> field = SUBDIVISIONS
> select = 1
> mandatory = 1
> readonly = 0
> }
>
>
> add to pi3/locallang.xml:
>
> <label index="general_zone">Zone</label>
>
>
> add to pi4/locallang.xml:
>
> <label index="label_zone">Zone</label>
>
>
> That should be it. Should these be added by default?
>
>
> Cheers,
> David
>
>
> Tobias Ronsdorf wrote:
>>
>> Hi,
>>
>> is there a marker for adding the state/region field to the
>> billing/delivery address form?
>>
>> How can I change the default country?
>>
>> Thanks in advance
>>
>> Tobias
>> _______________________________________________
>> TYPO3-project-commerce mailing list
>> TYPO3-project-commerce at lists.netfielders.de
>> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-commerce
>>
>>
>
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
More information about the TYPO3-project-commerce
mailing list