Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2006-07-04 14:49:54
- 1ukaz
- Archived Plugin Author
- From: Buenos Aires, Argentina
- Registered: 2006-05-05
- Posts: 17
[archived] ort_article_psort - Sorts articles by numeric customField
Notice: This thread is archived, this plugin is no longer available.
**********************************************************
Hi everyone; here I´m again. This is another plugin I developed.
This plugin comes from here where camello asks for something like this.
This plugin will sort by a numeric field of your choice; or define a Custom Field as Priority and you don’t need to pass params to the tag.
EXAMPLES:
<txp:ort_article_psort />
>> Defaults; if you defined a Custom Field as Priority
<txp:ort_article_psort sortby="your_field" />
>> You already have a numeric Custom Field and want to order by that field
<txp:ort_article_psort sortby="your_field" />
>> Name a Custom Field as you wish and want to order by that field<br><br>
DOWNLOAD
Version 1.0
Click Here to download
Version 1.0.1 (Not mine)
Version 1.2 (Improved Help)
Offline
#2 2006-07-04 15:34:52
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: [archived] ort_article_psort - Sorts articles by numeric customField
Excuse me if I’m overlooking something, but how does this differ from <txp:article sortby="custom_n" />
?
Offline
#3 2006-07-04 16:20:27
- 1ukaz
- Archived Plugin Author
- From: Buenos Aires, Argentina
- Registered: 2006-05-05
- Posts: 17
Re: [archived] ort_article_psort - Sorts articles by numeric customField
- if you do
<txp:article sortby="custom_n" />
it won´t do a numeric sort, since the custom fields in the DB are type of varchar; meaning that when you assign more than one digit to the numeric value, it won´t behave as a two/three/n digits number; for example to MySQL (or any database engine) the “10” number would come after “1” and not “9” when managing varchar types - but if you use the plugin and do
<txp:ort_article_psort sortby="custom_n" />
you will get the articles list ordered by that custom_n treated like numeric values; since the query is made to do that by using a CAST function; and since the request was ordering the articles by some kind of “Priority” - Was I clear enough?
- Any doubt about the differences about this go here where the plugin was born
Offline
#4 2006-07-04 16:33:37
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: [archived] ort_article_psort - Sorts articles by numeric customField
1ukaz wrote:
Was I clear enough?
Yes, very clear, thank you ;) I am using a custom field for this on one of my sites and have to remember each time to give it the right value (i.e. 03) to prevent 12 from showing up before 3. So I can definitely use your plugin ;)
Offline
#5 2006-11-20 18:16:26
- Niconemo
- Member
- From: Rhône-Alpes, France
- Registered: 2005-04-18
- Posts: 557
Re: [archived] ort_article_psort - Sorts articles by numeric customField
Wow ! I need it and it ever exists ! Thank you 1ukaz.
I’ll use it in an history site to sort years of events.
Last edited by Niconemo (2006-11-20 18:17:37)
Nico
Offline
Re: [archived] ort_article_psort - Sorts articles by numeric customField
Is there a way to make this plug-in sort by current category or section?
I know if can sort by “category =“name” but I need it to search using whatever category or section it is in.
(I’m making a “Most Read: This Category”“ chart in conjunction with dzd_counter_view)
Last edited by amordecosmos (2006-11-27 02:53:18)
Offline
Re: [archived] ort_article_psort - Sorts articles by numeric customField
1ukaz
Thank You! This plug-in rules!
I’ve added it to my “essential plug-ins” that I use for every install.
Don’t know how I lived without it.
- )
Cheers.
Offline
#8 2007-01-12 03:50:34
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: [archived] ort_article_psort - Sorts articles by numeric customField
Any assistance would be appreciated.
Not sure what I may be doing wrong.
The field I am using has prices, but therer are dollar signs that precedd the numbers (ie $400,000 and $350,000)
When I use the plug in it just throws everything into a wacky order. If I use article_custom then it sorts correctly except that $5,000,000 comes before $600,000.
Thanks.
progre55
Offline
#9 2007-01-13 13:59:14
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: [archived] ort_article_psort - Sorts articles by numeric customField
I think you have to take the $ out of the custom field, and change your article form to show it, something like this:
Price: $ <txp:custom_field name="price" />
Last edited by els (2007-01-13 14:00:11)
Offline
#10 2007-03-05 04:40:09
- rohner
- New Member
- Registered: 2006-11-12
- Posts: 7
Re: [archived] ort_article_psort - Sorts articles by numeric customField
Is there any possibility that this could also be done in the rss_unlimited_categories plugin? I am using that for most of my content that I sort and that plugin also uses the limited numeric order and does not order things past 100 correctly. I did post this question in the rss_unlimited_categories plugin post about this a long time ago but I never heard anything about it.
Offline
#11 2007-04-12 03:30:59
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: [archived] ort_article_psort - Sorts articles by numeric customField
Els:
Sorry for the long delay in getting back to you on this one, but thanks … that did the trick. On that same topic, do you know how I may be able to add “,” so instead of the price reading $600000 it would read $600,000.
progre55
Offline
#12 2007-04-12 11:43:54
- FireFusion
- Member
- Registered: 2005-05-10
- Posts: 698
Re: [archived] ort_article_psort - Sorts articles by numeric customField
Is there any way to add decimals support?
Say i’ve got a menu of 50 items sorted and I want one to go in the middle. I can’t just do 25.5 can I?
Offline