All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Total number of results, without having the number put out multiple times?

Heiko 24 Aug 2012 11:54 problem, complete

Hi there,

I want to display the number of hits for the keywords entered. I've tried using {total_results}, but the problem is, that I have to use it inside if the {exp:low_search:results}-loop so that my markup will be generated for every item found.

I've also tried to use Stash, like this: http://pastie.org/4580051

But this results in the following problem:



So, how can I show the total number of results, without having the number put out multiple times?

Replies

  1. Low 24 Aug 2012 11:56

    I'd recommend using a conditional and the variable {absolute_results}:

    {if count == 1}Results: {absolute_results}{/if}


    Or using a parameter limit="1" for the stash bit.

  2. Heiko 24 Aug 2012 12:00

    Wow, you're so darn fast, man...

    Well, if I set a limit of 1, the number seems to always show 1, no matter the actual number of results.

    And strangely the conditional doesn't output anything...

  3. Heiko 24 Aug 2012 12:01

    Ah, but this works:

    {exp:stash:set name='search_results' output="no" replace="yes"}
    {exp:low_search:results query="{segment_3}" status="sichtbar|unsichtbar" {par_channel_disable_basic}}
    {if count == 1}{absolute_results}{/if}
    {/exp:low_search:results}
    {/exp:stash:set}

  4. Heiko 24 Aug 2012 12:02

    Oh, and thank you very much! :)

  5. Low 24 Aug 2012 12:03

    Cool. :)

  6. Heiko 24 Aug 2012 12:19

    Sorry, but there's still one little problem...

    When I hit the back button to return from the results page and then try to do another search directly after that, I get the following system message telling me, that I don't have the necessary rights to perform this action:

    "Die erforderliche Berechtigung für diese Aktion liegt nicht vor."

    Why's that?! And - even more important - how do I fix this?

  7. Low 24 Aug 2012 12:21

    That's a result of the Secure Forms setting. To disable that for Low Search only, use secure="no" in the Low Search Form tag.

  8. Heiko 24 Aug 2012 12:23

    Yes, you were right... I enabled this yesterday and totally forgot about it.

    Thanks a lot!