test
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • pragmateam Friend
    #186270

    Hello,

    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 too

    In 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 results

    You 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.>:(

    MoonSailor Friend
    #488219

    Hi pragmateam,

    Thanks for reporting the issue. I will update it in next version 🙂

    Regards.

    HeR0 Friend
    #494077

    Hi 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-493974

    Regards

Viewing 3 posts - 1 through 3 (of 3 total)

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