-
AuthorPosts
-
pragmateam Friend
pragmateam
- Join date:
- November 2012
- Posts:
- 1
- Downloads:
- 0
- Uploads:
- 0
- Thanked:
- 2 times in 1 posts
March 28, 2013 at 11:07 am #186270Hello,
Here are the steps to reproduce bug:
In the backend:
– create an extra field
– create a category with sub-categories that use the extra field you previously created
– create one item into one of the sub-categories and set its value for the extra-field
– enable search by category on the parent category and all the sub-categories
– enable search by the extra field tooIn the frontend:
– Perform a search:
– do not choose any category
– fill in a value for the extra field that will exclude the item you just created from the search resultsYou will see that all the items of the categories are displayed whether or not they satisfy the condition on the extra-field.
If you enable Joomla debug, you will see the query actually performed is like this
SELECT i.*,
CASE WHEN i.modified = 0 THEN i.created ELSE i.modified END as lastChanged, c.name as categoryname,c.id as categoryid, c.alias as categoryalias, c.params as categoryparams
FROM hwxb7_k2_items as i
LEFT JOIN hwxb7_k2_categories AS c
ON c.id = i.catid
WHERE i.published = 1
AND i.access IN(1,1)
AND i.trash = 0
AND c.published = 1
AND c.access IN(1,1)
AND c.trash = 0
AND c.language IN ('fr-FR','*')
AND i.language IN ('fr-FR','*')
AND ( i.publish_up = '0000-00-00 00:00:00' OR i.publish_up <= '2013-03-28 10:29:02' )
AND ( i.publish_down = '0000-00-00 00:00:00' OR i.publish_down >= '2013-03-28 10:29:02' )
AND i.catid = '5' OR i.catid = '29' OR i.catid = '31' OR i.catid = '32' OR i.catid = '33'
AND (1)
AND (i.extra_fields REGEXP '{"id":"8","value":[^{]*("500"|"-[0-9.,]*"|"[0-4][0-9]{0,2}([.,][0-9]+)*")')
ORDER BY i.id DESC
LIMIT 0, 10
Because of precedence rules on operators, this query is wrong and should be like. Notice the ( ) separating the ORs from the ANDs.
SELECT i.*,
CASE WHEN i.modified = 0 THEN i.created ELSE i.modified END as lastChanged, c.name as categoryname,c.id as categoryid, c.alias as categoryalias, c.params as categoryparams
FROM hwxb7_k2_items as i
LEFT JOIN hwxb7_k2_categories AS c
ON c.id = i.catid
WHERE i.published = 1
AND i.access IN(1,1)
AND i.trash = 0
AND c.published = 1
AND c.access IN(1,1)
AND c.trash = 0
AND c.language IN ('fr-FR','*')
AND i.language IN ('fr-FR','*')
AND ( i.publish_up = '0000-00-00 00:00:00' OR i.publish_up <= '2013-03-28 10:29:02' )
AND ( i.publish_down = '0000-00-00 00:00:00' OR i.publish_down >= '2013-03-28 10:29:02' )
AND (i.catid = '5' OR i.catid = '29' OR i.catid = '31' OR i.catid = '32' OR i.catid = '33' )
AND (1)
AND (i.extra_fields REGEXP '{"id":"8","value":[^{]*("500"|"-[0-9.,]*"|"[0-4][0-9]{0,2}([.,][0-9]+)*")')
ORDER BY i.id DESC
LIMIT 0, 10
The culprit is components/com_jak2filters/models/itemlist.php:851.
You must edit from
$sql .= " AND ".implode('OR ',$wherecate);
to
$sql .= " AND (".implode('OR ',$wherecate).")";
I lost credit in front of my client because of this. And I also lost time looking for a solution. I hope it will be fixed very quickly.>:(
2 users say Thank You to pragmateam for this useful post
MoonSailor FriendMoonSailor
- Join date:
- November 2011
- Posts:
- 1106
- Downloads:
- 0
- Uploads:
- 245
- Thanks:
- 89
- Thanked:
- 248 times in 223 posts
HeR0 FriendHeR0
- Join date:
- August 2011
- Posts:
- 3626
- Downloads:
- 0
- Uploads:
- 61
- Thanks:
- 33
- Thanked:
- 588 times in 549 posts
May 27, 2013 at 10:41 am #494077Hi There,
This issue is fixed in new version and you could upgrade it now. 🙂
http://www.joomlart.com/forums/topic/upgraded-to-1-0-4-but-now-cant-choose-by-extra-fields/#post-493974Regards
-
AuthorPosts
This topic contains 3 replies, has 3 voices, and was last updated by HeR0 11 years, 6 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum