diff --git a/components/com_banners/models/banners.php b/components/com_banners/models/banners.php index 5ee69f69a0237..4704ccf7d5151 100644 --- a/components/com_banners/models/banners.php +++ b/components/com_banners/models/banners.php @@ -83,8 +83,7 @@ protected function getListQuery() if ($cid) { - $query->join('LEFT', '#__categories as cat ON a.catid = cat.id') - ->where('a.cid = ' . (int) $cid) + $query->where('a.cid = ' . (int) $cid) ->where('cl.state = 1'); } @@ -141,6 +140,11 @@ protected function getListQuery() $config = JComponentHelper::getParams('com_banners'); $prefix = $config->get('metakey_prefix'); + if ($categoryId) + { + $query->join('LEFT', '#__categories as cat ON a.catid = cat.id'); + } + foreach ($keywords as $keyword) { $keyword = trim($keyword);