Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-09-19 18:01:19

liamdempsey
Member
From: Philadelphia, PA
Registered: 2009-09-16
Posts: 10
Website

Sort by custom field only sorts up to 10 items

Hi,

I am trying to sort a list of articles via a custom field. There are 14 items in this list and I can’t get TXP to sort all 14. It sorts the first 10 and then organises the remaining 4 by article date. I trust that I am just getting the code wrong.

Here is the code in the TXP form:

<txp:article_custom form="results-list" section="results" wraptag="ul" break="li" class="results" limit="99999" sort="custom_2" sortdir="asc" offset="0"/>

The draft page is online at: http://wlg.lbdesign.eu/results/

The list of results should be listed in ascending order. I have numbered the articles 1-14, using a custom field entitled ‘results’.

Any assistance would be greatly appreciated. Thanks!

Offline

#2 2009-09-19 18:30:00

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: Sort by custom field only sorts up to 10 items

Sortdir is deprecated. Try this way instead:

<txp:article_custom form="results-list" section="results" wraptag="ul" break="li" class="results" limit="99999" sort="custom_2 asc" offset="0"/>

Offline

#3 2009-09-19 18:49:37

liamdempsey
Member
From: Philadelphia, PA
Registered: 2009-09-16
Posts: 10
Website

Re: Sort by custom field only sorts up to 10 items

Hi Redbot,

Thanks for that. I gave it a try, copying and pasting your code directly. It changed the order a bit, but did not organise the list in the correct order.

Oh, I have confirmed that the individual articles do have the proper entry in the custom field, so that they should be sorted properly.

Last edited by liamdempsey (2009-09-19 19:06:14)

Offline

#4 2009-09-19 19:37:20

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: Sort by custom field only sorts up to 10 items

Hmm… strange, it should work. Or maybe I’m missing something obvious.
What happens if you change numbers with letters (a,b,c,d…. instead of 1,2,3,4…)?

Offline

#5 2009-09-19 19:41:56

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Sort by custom field only sorts up to 10 items

Try sort="custom_2+0 asc" instead of sort="custom_2 asc" to force numerical sorting instead of alphabetic sorting.

Offline

#6 2009-09-19 19:47:44

liamdempsey
Member
From: Philadelphia, PA
Registered: 2009-09-16
Posts: 10
Website

Re: Sort by custom field only sorts up to 10 items

Hi Redbot and Ruud,

Since Ruud’s approach was less time-consuming than re-entering a,b,c,d, … in the custom field, I tried that first. And it worked!

Thanks to both of you for the generous – and quick – help. I had been struggling for some time with the issue.

Cheers!

Offline

Board footer

Powered by FluxBB