Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#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>

PARAMETERS ACCEPTED BY THE TAG <br> status=“5” >> order fixed articles; default is published section=“MySection” >> get that section ordered by priority or by your Custom Field author=“author” >> get that author ordered by priority or by your Custom Field category=“MyCat” >> get that category ordered by priority or by tour Custom Field limit=“number” >> limit the amount of articles to be listed; default is 10 form=“form” >> changes de default form to list the articles sortdir=“dir” >> changes the direction of the ordering; default is DESC from higher to lower <br><br>

DOWNLOAD

Version 1.0
Click Here to download

Version 1.0.1 (Not mine)

Click Here to download

Version 1.2 (Improved Help)

Click Here to download

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

Let me explain Els;
  • 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

#6 2006-11-27 02:52:00

amordecosmos
Plugin Author
From: London (Hometown: Vancouver)
Registered: 2004-08-03
Posts: 106
Website

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

#7 2006-11-30 17:05:56

renobird
Member
From: Gainesville, Florida
Registered: 2005-03-02
Posts: 786
Website

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

Board footer

Powered by FluxBB