If using the banners module to display banners matched only by tags, no banners will display. Turning on debug shows Unknown column 'cat.metakey' in 'where clause'
when running the query to get the banners. This is because the query is trying to use the category table but it was never joined in.
Reference the issue listed in this forum post: http://forum.joomla.org/viewtopic.php?f=621&t=731120&view=previous#p2841883
It looks like it was never added to any trackers (I couldn't find it and it hasn't been addressed in the code from what I could tell). Rather than fix the way it is outlined in that forum post, it might be better to do something like the following at line 86 in /components/com_banners/models/banners.php:
if ($cid OR $categoryId)
{
$query->join('LEFT', '#__categories as cat ON a.catid = cat.id');
}
if ($cid)
{
$query->where('a.cid = ' . (int) $cid)
->where('cl.state = 1');
}
Fixing it this way will still only include the categories table if needed. The forum fix always includes the categories table. Not being too familiar with the code, this might not be the best way to address the issue either. It doesn't look like the category table is actually used based on $cid alone. Perhaps just including the join at line 158 would make more sense?
if ($categoryId)
{
$query->join('LEFT', '#__categories as cat ON a.catid = cat.id');
$condition2 .= " OR cat.metakey REGEXP '[[:<:]]" . $db->escape($keyword) . "[[:>:]]'";
}
We had this issue on our site and the first fix above took care of it. Unfortunately, we did it by changing the core file and never reported it so the 3.3.6 upgrade broke it again.
Labels |
Added:
?
|
Status | New | ⇒ | Closed |
Set to "closed" on behalf of @Hackwar by The JTracker Application at issues.joomla.org/joomla-cms/5000
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-11-17 21:54:06 |
Thanks for investigating. If would be great if you could provide a PR on github to get this fixed once and for all.
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5000.