0

I'm trying a different approach to random ordering and pagination, as this approach seems doomed: (Paginating a random ordered list of tag:related_entries)

I'm setting the list of IDs in order and then trying to use them in a fixed_order parameter, which I believe will work with pagination:

{exp:stash:parse process="start"}
    {exp:tag:related_entries
        channel="things-to-do"
        disable="category_fields|member_data|trackbacks"
        status="open"
        dynamic="no"
        cache="no"
        orderby="random"
    }
        {exp:stash:append replace="no" name="viewed_ids" scope="user" save="yes"}{entry_id}|{/exp:stash:append}

    {/exp:tag:related_entries} 

{/exp:stash:parse}

And trying to retrieve like this:

{exp:stash:set_list name="entries" parse_tags="yes" process="end"}
    {exp:channel:entries
        channel="channel_one"
        disable="category_fields|member_data|trackbacks"
        status="open"
        dynamic="no"
        cache="no"
        fixed_order="{stash:viewed_ids}"
        limit="3"
    }
        {stash:id}{entry_id}{/stash:id}
        {stash:title}{title}{/stash:title}

    {/exp:channel:entries} 
{/exp:stash:set_list}

But it's not working quite right, viewed_ids is getting refreshed every page load.

0

You could try moving the {exp:channel:entries} sections that shows your results to an embed and then putting a cache time for that embed file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.