[TYPO3-dev] empty selectorbox
Joost Vollebregt | JV Websites
info at jvwebsites.nl
Mon Nov 5 19:40:22 CET 2007
Dear list,
I am building a tt_products - filter to achieve different collections from
one source of products. It works on a 4.0.1 install with autoparser. But
fails on 4.1.0 with templavoila.
I use dynaflex to dynamically create a list of all existing categories, and
make separate selectboxes of them with the products as options.
This is all rendered well, and saved into the database as XML in tt_content,
but when I edit my plugin, the previously selected items show no label, only
a hidden value (they can be selected and deleted, but cannot be recognized
by user).
This is the working code, that is showing the described flaws with 4.1.0 and
templavoila, $DCA:
array (
'method' => 'add',
'path' => 'sheets/sDEF/ROOT/el',
'type' => 'fields',
'source' => 'db',
// where came the data from?
'source_type' => 'entry_count',
// how should it be handled?
'source_config' => array (
// define it a little bit more detailed, get it from
'table' => 'tt_products_cat',
// table
'select' => 'uid,title',
// which fields should be fetched?
'where' => 'deleted=0',
// and under which circumstances?
),
// keep in mind, that you can create more than one field at
once. See the step above
'field_config' => array (
// define what is inserted for each dataset from source
'name' => 'categorie_uid_###uid###',
// replace ###uid### with uid from dataset
'label' => '###title###',
// same with ###title###
'config' => array (
"type" => "select",
'items' => Array (
Array('', 0),
),
"itemsProcFunc" =>
"user_multi_shops->user_multi_name_render",
"foreign_table_where" =>
"category=###uid###",
"size" => 20,
"minitems" => 0,
"maxitems" => 40,
)
)
)
And the userfunction:
function user_multi_name_render(&$params,&$pObj) {
global $DCA, $TCA, $TYPO3_DB;
$config = $params['config'];
$extra_where=$config['foreign_table_where'];
$fields = 'uid,title';
$from = 'tt_products';
$where = 'hidden=0 AND deleted=0 AND '.$extra_where;
$res = $TYPO3_DB->exec_SELECTquery
($fields,$from,$where,'','');
$i=0;
while($row=$TYPO3_DB->sql_fetch_assoc($res))
{
$params['items'][$i]=Array($row['title'],$row['uid']);
$i++;
}
return $params['items'];
}
Any ideas on how to fix this/ or on what the reason is of this behaviour are
very welcome!
Joost Vollebregt
More information about the TYPO3-dev
mailing list