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

Support archive

Low Variables 'Select Categories' fieldtype ordering no honoured

Brendan Underwood 5 Dec 2011 04:09 problem, complete

Using the Low Variables 'Select Categories' fieldtype with 'Allow for multiple categories to be selected' checked.

We have placed the category items in a fairly specific order into the Low Variable field, and have used the following in the template:

 
{exp:channel:categories
channel="product_sheets"
style="linear"
disable="category_fields"
show="{lv_search_common}"
}
<li><a href="/product-sheets/browse/{category_url_title}/">{category_name}</a></li>
{/exp:channel:categories}


Unfortunately, the resulting list is not the same order as what was setup in the Low Variable field. Running EE 2.2.2 on this particular site, wondering if the Category Ordering bug that ailed previous EE versions is still in play in some capacity?

Cheers
Brendan

Replies

  1. Low 5 Dec 2011 08:04

    Hi Brendan,

    I'm afraid the show="" parameter for the channel:categories tag doesn't actually force the order to the categories shown, like the fixed_order="" parameter does for the channel:entries tag. But you can work around this by using the Query module.

    First, make sure you're using the "Comma" option as value separator in the variable details, then save your selection again in the desired order. You can then use this query, as long as there's at least one category selected:

    {exp:query sql="SELECT cat_url_title, cat_name 
    FROM exp_categories WHERE cat_id IN ({lv_search_common})
    ORDER BY FIELD (cat_id,{lv_search_common})"}
    <li><a href="/product-sheets/browse/{cat_url_title}/">{cat_name}</a></li>
    {/exp:query}

  2. Rick Robinson 11 Feb 2013 21:16

    Thanks, this solved the problem for me too.