news category filtering issue in exended class Contao











up vote
0
down vote

favorite












I registered $GLOBALS['TL_HOOKS']['newsListFetchItems'] hook in my news extended extension for sorting with my custom field (say 'rank'). But the pages which contain news filtering is not working . I am using the contao Version 4.5.8 . How can I solve the issue.



    $t = NewsModel::getTable();        
$arrOptions = array();
switch ($objModule->news_sorting)
{
case 'sort_rankid_asc':

$arrOptions['order'] = "$t.rankid = 0, $t.rankid, $t.date DESC";
break;
case 'sort_random':
$arrOptions['order'] = "$t.date DESC";
break;
default:
$arrOptions['order'] = "$t.date DESC";
}

return NewsModel::findPublishedByPids($newsArchives, $blnFeatured, $limit, $offset, $arrOptions);


News filtering with category is not working after I added the above code.How Can I fix the issue










share|improve this question
























  • Your title mentions "news category filtering", but your description does not mention any of that. Did you enable any news category features in your news list module? If yes, then please provide a more detailed description.
    – fritzmg
    Nov 8 at 13:52










  • I have news category filtering option in my news listing page. After adding the above hook the filtering is not working. I updated my question also
    – Aswathy S
    Nov 9 at 3:55

















up vote
0
down vote

favorite












I registered $GLOBALS['TL_HOOKS']['newsListFetchItems'] hook in my news extended extension for sorting with my custom field (say 'rank'). But the pages which contain news filtering is not working . I am using the contao Version 4.5.8 . How can I solve the issue.



    $t = NewsModel::getTable();        
$arrOptions = array();
switch ($objModule->news_sorting)
{
case 'sort_rankid_asc':

$arrOptions['order'] = "$t.rankid = 0, $t.rankid, $t.date DESC";
break;
case 'sort_random':
$arrOptions['order'] = "$t.date DESC";
break;
default:
$arrOptions['order'] = "$t.date DESC";
}

return NewsModel::findPublishedByPids($newsArchives, $blnFeatured, $limit, $offset, $arrOptions);


News filtering with category is not working after I added the above code.How Can I fix the issue










share|improve this question
























  • Your title mentions "news category filtering", but your description does not mention any of that. Did you enable any news category features in your news list module? If yes, then please provide a more detailed description.
    – fritzmg
    Nov 8 at 13:52










  • I have news category filtering option in my news listing page. After adding the above hook the filtering is not working. I updated my question also
    – Aswathy S
    Nov 9 at 3:55















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I registered $GLOBALS['TL_HOOKS']['newsListFetchItems'] hook in my news extended extension for sorting with my custom field (say 'rank'). But the pages which contain news filtering is not working . I am using the contao Version 4.5.8 . How can I solve the issue.



    $t = NewsModel::getTable();        
$arrOptions = array();
switch ($objModule->news_sorting)
{
case 'sort_rankid_asc':

$arrOptions['order'] = "$t.rankid = 0, $t.rankid, $t.date DESC";
break;
case 'sort_random':
$arrOptions['order'] = "$t.date DESC";
break;
default:
$arrOptions['order'] = "$t.date DESC";
}

return NewsModel::findPublishedByPids($newsArchives, $blnFeatured, $limit, $offset, $arrOptions);


News filtering with category is not working after I added the above code.How Can I fix the issue










share|improve this question















I registered $GLOBALS['TL_HOOKS']['newsListFetchItems'] hook in my news extended extension for sorting with my custom field (say 'rank'). But the pages which contain news filtering is not working . I am using the contao Version 4.5.8 . How can I solve the issue.



    $t = NewsModel::getTable();        
$arrOptions = array();
switch ($objModule->news_sorting)
{
case 'sort_rankid_asc':

$arrOptions['order'] = "$t.rankid = 0, $t.rankid, $t.date DESC";
break;
case 'sort_random':
$arrOptions['order'] = "$t.date DESC";
break;
default:
$arrOptions['order'] = "$t.date DESC";
}

return NewsModel::findPublishedByPids($newsArchives, $blnFeatured, $limit, $offset, $arrOptions);


News filtering with category is not working after I added the above code.How Can I fix the issue







content-management-system contao






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 9 at 3:53

























asked Nov 8 at 11:25









Aswathy S

559624




559624












  • Your title mentions "news category filtering", but your description does not mention any of that. Did you enable any news category features in your news list module? If yes, then please provide a more detailed description.
    – fritzmg
    Nov 8 at 13:52










  • I have news category filtering option in my news listing page. After adding the above hook the filtering is not working. I updated my question also
    – Aswathy S
    Nov 9 at 3:55




















  • Your title mentions "news category filtering", but your description does not mention any of that. Did you enable any news category features in your news list module? If yes, then please provide a more detailed description.
    – fritzmg
    Nov 8 at 13:52










  • I have news category filtering option in my news listing page. After adding the above hook the filtering is not working. I updated my question also
    – Aswathy S
    Nov 9 at 3:55


















Your title mentions "news category filtering", but your description does not mention any of that. Did you enable any news category features in your news list module? If yes, then please provide a more detailed description.
– fritzmg
Nov 8 at 13:52




Your title mentions "news category filtering", but your description does not mention any of that. Did you enable any news category features in your news list module? If yes, then please provide a more detailed description.
– fritzmg
Nov 8 at 13:52












I have news category filtering option in my news listing page. After adding the above hook the filtering is not working. I updated my question also
– Aswathy S
Nov 9 at 3:55






I have news category filtering option in my news listing page. After adding the above hook the filtering is not working. I updated my question also
– Aswathy S
Nov 9 at 3:55














1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










The codefog/contao-news_categories extension in version 3.x also uses the newsListFetchItems hook to filter the news list items (see here). The hook will only work for one extension - which ever one returns something other than false first.



If you need both your custom sorting and filtering by a category, then you will need to implement the news category filtering yourself and you have to make sure that your hook is executed first.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53206793%2fnews-category-filtering-issue-in-exended-class-contao%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    The codefog/contao-news_categories extension in version 3.x also uses the newsListFetchItems hook to filter the news list items (see here). The hook will only work for one extension - which ever one returns something other than false first.



    If you need both your custom sorting and filtering by a category, then you will need to implement the news category filtering yourself and you have to make sure that your hook is executed first.






    share|improve this answer

























      up vote
      1
      down vote



      accepted










      The codefog/contao-news_categories extension in version 3.x also uses the newsListFetchItems hook to filter the news list items (see here). The hook will only work for one extension - which ever one returns something other than false first.



      If you need both your custom sorting and filtering by a category, then you will need to implement the news category filtering yourself and you have to make sure that your hook is executed first.






      share|improve this answer























        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        The codefog/contao-news_categories extension in version 3.x also uses the newsListFetchItems hook to filter the news list items (see here). The hook will only work for one extension - which ever one returns something other than false first.



        If you need both your custom sorting and filtering by a category, then you will need to implement the news category filtering yourself and you have to make sure that your hook is executed first.






        share|improve this answer












        The codefog/contao-news_categories extension in version 3.x also uses the newsListFetchItems hook to filter the news list items (see here). The hook will only work for one extension - which ever one returns something other than false first.



        If you need both your custom sorting and filtering by a category, then you will need to implement the news category filtering yourself and you have to make sure that your hook is executed first.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 9 at 9:35









        fritzmg

        1,2671930




        1,2671930






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53206793%2fnews-category-filtering-issue-in-exended-class-contao%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Academy of Television Arts & Sciences

            L'Équipe

            1995 France bombings