Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix for: Banners matched only by tags results in SQL error #5107
This was referenced
Nov 14, 2014
I can not bring together what started in this forum thread - http://forum.joomla.org/viewtopic.php?f=621&t=731120&view=previous#p2841883 (mentioned in #5000) - with what you did in your patch. In other words: I cannot replicate the original problem.
So the display of "module banner" depends basically on three criteria (I ignore the menu assignment, as it was set to "on all pages" in all of my tests):
When applying your patch the "categories" table is not joined when the default setting - "all categories" - is set. Without your patch the "categories" table is always joined. I my opinion the wording "all categories" implies that the table "categories" is joined. Otherwise is should be named "not used" or something like that.
The forum thread described a problem with the "Search by Meta Keyword". So I tested this with the following procedure using the current stage branch:
Result: the banner is not displayed but it should.
What I found out was, that a client must be selected in the banner, than the banner get´s displayed. This is an error as the client is not a mandatory field in the banner. It should function without assigning a client.
Apart from that the "Search by Meta Keyword" works for me.
The filter for categories does not have anything to do with the categories table. Basically, you are only saying that you either want to have banners from all categories or just specific categories. In the first case, we don't have to do anything, in the second case we only have to compare the category ID of the banner with some ID that we saved before. So we don't need any data from the categories table.
However, if we filter by category AND a tag/metakey/whatever, we are trying to filter also by category metadata and that fails before this patch. Please test again.
So here is my next try. The ingredients:
You have to enter a "tag" in the banner or/and the banner category.
Before the patch you should see notices like:
Warning: Invalid argument supplied for foreach() in joomla34\components\com_banners\models\banners.php on line 201
After the patch the banner is display correctly.
Note that you have to assign a client to the banner otherwise the banner will not show up in the frontend. As the client is not a mandatory field in the banner it should also work without assigning a client.
Anyway: the problem is solved
#cjtop can you please check this patch also?