Kann hier vielleicht mal einer von euch Freaks drüber schauen 😃 - es funktioniert - aber ich glaub das Ganze kann man auch etwas besser schreiben:
Es gibt Artikel und Kategorien
Artikel 1 hat Kategorie 1 und 2
Artikel 2 hat nur Kategorie 1
über $foldercategory = $this->cObj->data['pi_flexform']['data']['Member']['lDEF']['foldercategory']['vDEF'];
lege ich fest welche Kategorie angezeigt werden.
Funktioniert auch - nur wird im CMS jetzt keine Kategorie ausgewählt $foldercategory ist also leer - möchte ich gerne alle Artikel ausgeben. Jetzt mein Problem der Artikel 1 wird zweimal ausgegeben - logisch da er ja in Kategorie 1 und 2 ist.
da er mir $groupBy='uid' so nicht genommen hat
$res=$GLOBALS['TYPO3_DB']->exec_SELECTquery(
'*',
'tx_maxartikel_item',
'hidden=0 and deleted=0 and pid='.$this->id,
$groupBy='uid',
$orderBy='sorting',
$limit='');
hab ich noch ne zweite Abfrage gemacht
$res1 = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'uid,title,text_70c04e316a,image',
'tx_maxartikel_item',
'hidden=0 and deleted=0 and pid='.$this->id,
$groupBy='uid',
$orderBy='sorting',
$limit='');
hier nimmt er mir auch das $groupBy='uid' sobald ich aber 'uid,title,text_70c04e316a,image,zuordnung', schreib geht es nicht mehr.
so sieht dann der Code aus :o
$res=$GLOBALS['TYPO3_DB']->exec_SELECTquery(
'*',
'tx_maxartikel_item',
'hidden=0 and deleted=0 and pid='.$this->id,
$groupBy='',
$orderBy='sorting',
$limit='');
$res1 = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
'uid,title,text_70c04e316a,image,zuordnung',
'tx_maxartikel_item',
'hidden=0 and deleted=0 and pid='.$this->id,
$groupBy='uid',
$orderBy='sorting',
$limit='');
//Marker befüllen
while($row=$GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$responsibility = explode(',', $row['zuordnung']);
foreach ($responsibility as $key => $value) {
$responsibilityDB .= $value;
if ($foldercategory) {
if ($responsibilityDB == $foldercategory) {
$markerArray['###TITLE###']= $row['title'];
$markerArray['###BESCHREIBUNG###']=$row['text_70c04e316a'];
$markerArray['###IMAGELIST###']=$this->getImage($row['image']);
$liste .= $this->cObj->substituteMarkerArrayCached($singlerow,$markerArray);
}
} else {
while($row=$GLOBALS['TYPO3_DB']->sql_fetch_assoc($res1)) {
$markerArray['###TITLE###']= $row['title'];
$markerArray['###BESCHREIBUNG###']=$row['text_70c04e316a'];
$markerArray['###IMAGELIST###']=$this->getImage($row['image']);
$liste .= $this->cObj->substituteMarkerArrayCached($singlerow,$markerArray);
}
}
//$liste .= $this->cObj->substituteMarkerArrayCached($singlerow,$markerArray);
$responsibilityDB = '';
}
}
danke