test
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • hammyzone Friend
    #910578

    Hi,

    Currently when I use the dropdown to filter, for example, "the last 7 days", it gives me all items modified in the last 7 days. These are often items dated from (created/published) months ago that I’ve simply edited recently..

    How can I edit the code so that it retrieves based on either the ‘created’ date or the ‘published’ dates stored in the K2 DB tables?

    Thanks.

    Luna Garden Moderator
    #911034

    Hi,

    In order to have Result based on only Date create, go to file:

    components/com_jak2filter/models/itemlist.php

    Look for :

    if ($start_created){
                $sql .= " AND (i.created >= ".$db->quote($start_created)." OR i.modified >= ".$db->quote($start_created).")";
            }
    
            if ($end_created){
                if($start_created == $end_created) {
                    $end_created .= ' 23:59:59';
                }
                $sql .= " AND (IF(i.modified <> ".$db->quote($db->getNullDate()).", i.modified, i.created) <= ".$db->quote($end_created).")";
            }

    change to:

    if ($start_created){
                $sql .= " AND i.created >= ".$db->quote($start_created)."";
            }
    
            if ($end_created){
                if($start_created == $end_created) {
                    $end_created .= ' 23:59:59';
                }
                $sql .= " AND i.created <= ".$db->quote($end_created).")";
            }

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

This topic contains 1 reply, has 2 voices, and was last updated by  Luna Garden 8 years, 7 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum