[TYPO3-commerce] Key value decoupling in pi3: getSelectInputField
Michiel Roos
michiel at netcreators.com
Fri Oct 12 12:04:58 CEST 2007
Hi all,
When adding custom fields for a new payment method using:
getAdditonalFieldsConfig
(that's right . . . A d d i t o n a l . . .
http://bugs.typo3.org/view.php?id=6514 ;-)
You can specify a select list as is shown in the credit card
implementation: payment/class.tx_commerce_payment_creditcard.php
The getAdditonalFieldsConfig can give back an array containing key value
pairs. When rendering the form however, only the values are used. The
relation between the key and the value is lost.
The function where this happens is: getSelectInputField in
class.tx_commerce_pi3.php.
Can this be made optional, or can the key and value both be used by default?
An extra step is now needed to get to the key of a payment provider
While I would like for that information to come from the form directly.
foreach ($fieldConfig['values'] as $option) {
$result .= '<option name="' .$option .'" value="' .$option .'"';
if ($fieldValue === $option)
$result .= ' selected="selected"';
$result .= '>' .$option .'</option>' ."\n";
}
Should become:
foreach ($fieldConfig['values'] as $key => $value) {
$result .= '<option name="' .$value .'" value="' .$key .'"';
if ($fieldValue === $key)
$result .= ' selected="selected"';
$result .= '>' .$option .'</option>' ."\n";
}
Any strong arguments against this change?
Kind regards,
Michiel Roos
--
Netcreators BV :: creation and innovation
www.netcreators.com
Interesse in werken bij Netcreators?
http://www.netcreators.com/bedrijf/vacatures/
More information about the TYPO3-project-commerce
mailing list