Bug #7905
Use own Categories as placement does not work
| Status: | New | Start date: | 2010-05-25 | |
|---|---|---|---|---|
| Priority: | Must have | Due date: | ||
| Assignee: | Simon Schaufelberger | % Done: | 0% |
|
| Category: | - | |||
| Target version: | - | |||
| Votes: | 0 |
Description
It's not possible to use own category names as "placement" because in the database the relation is saved with "tx_macinabanners_categories:CAT_ID" in the placement field of the banner. And this is the field the select statement does check.
What you can actually do is a "placement" value like
plugin.tx_macinabanners_pi1.placement = tx_macinabanners_categories:1
But this will match all categories starting with 1. So you will also get banners from category 10, 11, 12 ....
History
Updated by Simon Schaufelberger about 1 year ago
hello Sascha,
would it help you to change line 164 in file class.tx_macinabanners_pi1.php from:
$placementClause .= 'placement LIKE \'%'.$placement.'%\'';
to:
$placementClause .= 'placement LIKE \''.$placement.'\'';
?
Updated by Tomasz Krawczyk 11 months ago
I have 12 categories in my sysfolder caled A1, B1, B2, ... C5, D1
As Simon wrote we need point that placement B2 is category tx_macinabanners_categories:1. So, I suggest applying such patch:
if (count($allowedPlacements) > 0) {
$placementClause = '';
/*
foreach ($allowedPlacements AS $placement) {
if ($placementClause != '') {
$placementClause .= ' OR ';
}
$placementClause .= 'placement LIKE \'%'.$placement.'%\'';
}
*/
/*
FIX: Patch for custom categories
inspiration: http://www.typo3.net/forum/beitraege/thema/82762/
*/
foreach ($allowedPlacements AS $key => $placement) {
if(t3lib_div::inList("top,bottom,right,left",$placement)) {
$allowedPlacements[$key] = $placement;
} else {
$catWhere = ' AND description LIKE \'%'.$placement.'%\'';
$catRS = $this->pi_exec_query('tx_macinabanners_categories', 0, $catWhere, '', '', '');
$catRow = $TYPO3_DB->sql_fetch_assoc($catRS);
$allowedPlacements[$key] = 'tx_macinabanners_categories:'.$catRow['uid'];
}
if( $placementClause != '' )
$placementClause .= ", '" . $allowedPlacements[$key] . "'";
else
$placementClause .= "'" . $allowedPlacements[$key] . "'";
}
$where .= ' AND placement IN ('.$placementClause.') ';
}
It works on my two instalations.
Updated by Simon Schaufelberger 6 months ago
- Assignee changed from Wolfgang Becker to Simon Schaufelberger