[TYPO3-commerce] additional address form fields
Heiko Hänsge
mailinglisten at wild-wild-web.de
Tue Dec 11 16:35:58 CET 2007
Hi,
I just changed the case condition for 'int' - see below - to the
following to suit my needs for checking the 'zip' field:
case 'int':
if (!is_integer($value) && preg_match('/^\d+$/', $value) !== 1) {
$this->formError[$name] = $this->pi_getLL('error_field_int');
$returnVal = false;
}
break;
Regards,
Heiko
------------ Original-Nachricht ------------
Heiko Hänsge schrieb am 11.12.2007 15:59 Uhr:
> Hi Ingo,
>
> just tried to 'extend my little HowTo' by evaluating some of the address
> form fields, for example the 'zip' field:
>
> plugin.tx_commerce_pi3 {
> billing.sourceFields {
> // zip field is mandatory
> zip.mandatory = 1
> // zip field value should be a 5 digit integer
> zip.eval = min_5,max_5,int
> }
> delivery.sourceFields {
> // we do not want an email field in the delivery address form
> email <
> }
> _LOCAL_LANG.de {
> // don't forget to declare proper error messages
> error_field_int = <span class="error">Bitte nur Zahlen
> eingeben.</span>
> error_field_alpha = <span class="error">Bitte nur Ziffern 0-9
> eingeben.</span>
> error_field_min = <span class="error">Dieser Wert ist zu
> klein.</span>
> error_field_max = <span class="error">Dieser Wert ist zu
> groß.</span>
> }
> }
>
>
> Somehow the check for an integer failes constantly,
> as if the value of the 'zip' field is never an integer, even if I enter
> digits only.
>
> See the according lines 1441 ff. in
> /typo3conf/ext/commerce/pi3/class.tx_commerce_pi3.php
>
> case 'int':
> if (!is_integer($value)) {
> $this->formError[$name] = $this->pi_getLL('error_field_int');
> $returnVal = false;
> }
> break;
>
> Any ideas how to succeed?
>
> Regards,
> Heiko
>
>
>
>
> ------------ Original-Nachricht ------------
> Ingo Schmitt schrieb am 29.11.2007 18:04 Uhr:
>
>> Hi Heiko,
>>
>> could you add this to the wiki?
>>
>> ingo
>>
>>
>>> Hello,
>>>
>>> I just wandet to share how to manage additional address form fields if
>>> they are needed.
>>> In our case we also need the fields 'telephone', 'fax', 'customer
>>> number' and 'gender'.
>>>
>>> The TS setup has to get extended by those fields to produce the form
>>> fields:
>>>
>>> plugin.tx_commerce_pi3 {
>>> billing.sourceFields {
>>> phone.mandatory = 0
>>> fax.mandatory = 0
>>> custnumber.mandatory = 0
>>> gender.mandatory = 1
>>> }
>>> }
>>>
>>> If possible we use the field names according to already existing DB
>>> fields in tt_address table.
>>> If we need fields not yet existing in the tt_address table we have to
>>> add them to the table, for example with the kickstarter.
>>>
>>> All additional fields are now put at the end of the form which is not
>>> nice for the 'gender' field since we would expect it to stick in front
>>> of the name field. Unfortunately I couldn't find a solution yet to sort
>>> the form fields in the frontend form. Somebody knows a solution?
>>>
>>> Next we need to add the labels for our new fields in the TS setup (in
>>> our case in German):
>>>
>>> plugin.tx_commerce_pi3 {
>>> _LOCAL_LANG.de {
>>> general_phone = Telefon
>>> general_fax = Fax
>>> general_custnumber = Kundennummer
>>> general_gender = Anrede
>>> }
>>>
>>> Now the new form fields shoud occur with labels in the frontend.
>>> One has to be carefull with the tt_address fields 'title' and
>>> 'description' because the form fields are generated correctly BUT the
>>> labels are not getting parsed correctly. They will be overwritten by the
>>> following label values for billing or delivery :
>>>
>>> plugin.tx_commerce_pi3 {
>>> _LOCAL_LANG.de {
>>> billing_title = Rechnungsadresse
>>> billing_description = Angaben zur Rechnungsadresse
>>> }
>>>
>>> This might be a bug though.
>>>
>>> Our new address form field values are getting stored in the DB
>>> automaticly while checking out.
>>> Next step is to create additional markers for the email template and to
>>> substitute them by the form field values.
>>> That's were I'm just working on...
>>>
>>> regards
>>> Heiko
>>>
>>>
>> Mit freundlichen Gruessen
>>
>>
> _______________________________________________
> TYPO3-project-commerce mailing list
> TYPO3-project-commerce at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-commerce
>
>
>
More information about the TYPO3-project-commerce
mailing list