ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Ordering By View_Count

March 08, 2012 11:27am

Subscribe [1]
  • #1 / Mar 08, 2012 11:27am

    Jeremy Bise

    77 posts

    Hi folks—

    We’re on EE v2.4.0 - Build: date 20120123.

    I’m having some trouble with ordering entries by view_count.  Here’s our setup:

    The single entry page:

    {exp:channel:entries channel="ask_the_experts" limit="1" track_views="one"}          
    <h2>{title}</h2>
    <p><strong>{expert_user_question}</strong><br />
    {expert_answer}<br />
    {/exp:channel:entries}

    As you can see, we have track_views=“one” there.  Here’s the listings page:

    <h3>Most Popular Questions:</h3>
    <p><ul><br />
    {exp:channel:entries channel="ask_the_experts" dynamic="no" orderby=”view_count_one”}<br />
    <li><br />
    <strong><a href="http://{page_url}">Q:// {expert_user_question}</strong></a></p>
    
    <p>{expert_answer} - Views: {view_count_one}<br />
    </li><br />
    {/exp:channel:entries}<br />
    </ul>

    So what is happening is that the views are being tracked because they’re spitting out with the {view_count_one} variable on the listings page.  However, they are not ordering correctly.  Even though an entry has a count of, say, 8 and the other has a count of 5, they’re not being ordered like that.

    All caching is disabled from what I can tell.

    Can anybody help?

    Thanks,
    Jeremy

  • #2 / Mar 08, 2012 8:45pm

    Sean C. Smith

    3818 posts

    Hi Jeremy Bise,

    I’m sorry that you are having trouble with view tracking. Have you enabled view tracking by going to Admin > Security & Privacy > Tracking Preferences ? Does that fix the problem?

    Sean

  • #3 / Mar 08, 2012 8:51pm

    Jeremy Bise

    77 posts

    Hi Sean,

    Views Tracking is enabled in the control panel.  Any other ideas?

    Thanks,
    Jeremy

  • #4 / Mar 09, 2012 6:05pm

    Sean C. Smith

    3818 posts

    Jeremy,

    Could you add sort sort=“asc” and if that doesn’t change try sort=“desc” If you change orderby=”” to order by “title” does it sort the entries alphabetically? Are you using any add-ons that interact with the orderby parameter such as Low Reeorder?

    Sean

  • #5 / Mar 09, 2012 6:21pm

    Jeremy Bise

    77 posts

    Sean,

    I got this fixed today, but I honestly have absolutely NO idea how.  It seems to me I’m using the exact same code I started with, but it’s working now.  I don’t know.  I appreciate your trying to help though!!

  • #6 / Mar 09, 2012 8:13pm

    Sean C. Smith

    3818 posts

    Jeremy,

    Glad its working now. Will keep this thread open in case the issue crops up again. If it does, just update us and we’ll be ready to help you.

    Sean

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases