Einträge in einer Selectbox können im Frontend nicht sortiert werden!!!!
Hall zusammen!
Ich verwende die Extension tx_msjeventpro für diverse Eventeinträge. Für die Auswahl der Kategorien wird im Anmeldeformular original eine Selectbox bereitgestellt. Ich habe rund 40 Kategorien.
Mein Problem:
Zwar kann ich die Kategorien in der ext_tables.php mit "default_sortby" => "ORDER BY uid",
$TCA["tx_mjseventpro_cat"] = Array (
"ctrl" => Array (
"title" => "LLL:EXT:mjseventpro/locallang_db.php:tx_mjseventpro_cat",
"label" => "title",
"tstamp" => "tstamp",
"crdate" => "crdate",
"cruser_id" => "cruser_id",
"languageField" => "sys_language_uid",
"transOrigPointerField" => "l18n_parent",
"transOrigDiffSourceField" => "l18n_diffsource",
"default_sortby" => "ORDER BY uid",
"delete" => "deleted",
"enablecolumns" => Array (
"disabled" => "hidden",
"starttime" => "starttime",
"endtime" => "endtime",
"fe_group" => "fe_group",
),
"dynamicConfigFile" => t3lib_extMgm::extPath($_EXTKEY)."tca.php",
"iconfile" => t3lib_extMgm::extRelPath($_EXTKEY)."icon_tx_mjseventpro_cat.gif",
),
"feInterface" => Array (
"fe_admin_fieldList" => "sys_language_uid, l18n_parent, l18n_diffsource, hidden, starttime, endtime, fe_group, title, cat, uid, descr",
)
);
und in der TCA mit "foreign_table_where" => "AND tx_mjseventpro_cat.pid=###PAGE_TSCONFIG_IDLIST### ORDER BY tx_mjseventpro_cat.uid",
oder mit "foreign_table_where" => "ORDER BY tx_mjseventpro_cat.uid",
<?php
if (!defined ("TYPO3_MODE")) die ("Access denied.");
$TCA["tx_mjseventpro"] = Array (
"ctrl" => $TCA["tx_mjseventpro"]["ctrl"],
"interface" => Array (
"showRecordFieldList" => "sys_language_uid,l18n_parent,l18n_diffsource,hidden, starttime,endtime,fe_group,
title,bdate,btime,entrytime,edate,etime,promoter,location,area,cat, type,status,priority,fees,
ticketlink,age,teaser,descr,image,imgcap,files,internalrefs,links"
),
"feInterface" => $TCA["tx_mjseventpro"]["feInterface"],
"columns" => Array (
'sys_language_uid' => Array (
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.php:LGL.language',
'config' => Array (
'type' => 'select',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.uid',
'items' => Array(
Array('LLL:EXT:lang/locallang_general.php:LGL.allLanguages',-1),
Array('LLL:EXT:lang/locallang_general.php:LGL.default_value',0)
)
)
),
'l18n_parent' => Array (
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.php:LGL.l18n_parent',
'config' => Array (
'type' => 'select',
'items' => Array (
Array('', 0),
),
'foreign_table' => 'tx_mjseventpro',
'foreign_table_where' => 'AND tx_mjseventpro.pid=###CURRENT_PID### AND tx_mjseventpro.sys_language_uid IN (-1,0)',
)
),
'l18n_diffsource' => Array (
'config' => Array (
'type' => 'passthrough'
)
),
"hidden" => Array (
"exclude" => 1,
"label" => "LLL:EXT:lang/locallang_general.php:LGL.hidden",
"config" => Array (
"type" => "check",
"default" => "0"
)
),
// UNWICHTIGE FÜR DIESEN EINTRAG RAUSGENOMMEN!!!!
"cat" => Array (
"exclude" => 1,
"label" => "LLL:EXT:mjseventpro/locallang_db.php:tx_mjseventpro.cat",
"config" => Array (
"type" => "select",
"foreign_table" => "tx_mjseventpro_cat",
// To the Page-TSconfig enter one ore more uid of the pages, that contain cat-entries:
// TCEFORM.tx_mjseventpro.cat.PAGE_TSCONFIG_IDLIST=
"foreign_table_where" => "AND tx_mjseventpro_cat.pid=###PAGE_TSCONFIG_IDLIST### ORDER BY tx_mjseventpro_cat.uid",
// "foreign_table_where" => "ORDER BY tx_mjseventpro_cat.uid",
"size" => 1,
"minitems" => 0,
"maxitems" => 1,
"items" => Array (
Array("", 0),
),
)
),
entsprechend sortieren lassen und dies wird im BE auch richtig angezeigt. Im FE allerdings nicht!! Die Sortierung bleibt völlig unberührt, es wird immer nach "title" sortiert.
WARUM???? #angry#
Wenn ich die pi1/class.tx_mjseventpro_pi1.php ansehe, so stelle ich fest, dass für die Ausgabe zwei Einträge verantwortlich sind, weil hier auf die Tabelle mit der Spalte "title" hingewiesen wird. Wenn ich das z.B. auf "uid" ändere, bekomme ich die "uid" ausgegeben. Aber ich muss "title" ausgeben und nach "uid" sortieren.
Der PHP-Code lautet da wohl: SELECT *FROM `tx_mjseventpro_cat` ORDER BY `uid` ASC
Aber wie kann ich den da anfügen???? Es funzt einfach nicht!!!
Hier die Stellen wo die Spalte "title" abgerufen wird. Einaml in Zeile 9 mit .htmlentities($title).
function htmlSelect4input($table='', $fieldName='', $fNmm='') {
$validRowsArray = $this->$fNmm;
$selectedValue = $this->piVars[$fNmm];
$opt = array();
$opt[] = '<option value="">Bitte wählen!</option>';
// Show selectorbox only, if there are any categories.
if($validRowsArray) {
foreach ($validRowsArray as $uid => $title) {
$opt[] = '<option value="'.$uid.'" selectedvalueuidselected:="">'.htmlentities($title).'</option>';
}
return '<select class="selectbox" name="tx_mjseventpro_pi1['.$fNmm.']">'.implode("", $opt).'</select>';
}
return '';
}
und einmal in Zeile 4 mit $this->validRows
function enterFEevent() {
// get Categories:
$this->cat = $this->validRows("tx_mjseventpro_cat", "title", 'cat');
Wie kann ich "title" ausgeben und nach "uid" sortieren lassen??
Meine PHP Kenntnisse sind beschränkt.
Bitte um Hilfe!