SEO Search URLs and OrderBy

4 posts by 3 authors in: Forums > CMS Builder
Last Post: January 20, 2011   (RSS)

By mark99 - April 16, 2010

I'd like to do a simple CSS header bar for my products with a list of one-click ordering options for readers to select. For example they might like to order the list of products by title or by the price field, but is it possible to do that with SEO URL's or does that only support exact matches?

I tried this but obviously never expected it to work, I've just included it as an example so you're able to see what I'm aiming for.

listViewer.php/orderBy-title ASC

Re: [mark99] SEO Search URLs and OrderBy

By Jason - April 16, 2010

Hi,

You can use the orderBy variable in the URL to sort by any field that is in the table you are returning. So for example:

listViewer.php?orderBy=title

This will order them automatically doesn't support adding ASC or DESC however. If you need further control, you can add orderBy directly to your query:
example:
list($productRecords,$productMetaData)=getRecords(array(
'tableName'=>'products',
'orderBy' => mysql_escape(@$_REQUEST['orderBy']),
'allowSearch'=>0,
));


In this example, you could add ASC or DESC to the orderBy variable.

There isn't any automatic functionality that would support the: listViewer.php/orderBy-title ASC format.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] SEO Search URLs and OrderBy

By Rusty - January 20, 2011 - edited: January 20, 2011

So just to be crystal clear, there isn't a way to sort records Ascending or Descending in CMSBuilder via URL.

That means I can do the following URL Query string: ?orderBy=title&direction=DESC or ?orderBy=title&direction=ASC

If we wanted to do that we'd have to code a page for each?

But we CAN sort simply by ?orderBy=title where title is the name of the field we wish to sort by.
Rusty

Re: [Rusty] SEO Search URLs and OrderBy

By Jason - January 20, 2011

Hi Rusty,

That post I made was actually wrong (I was young and didn't know any better).

You can set sorting direction in the url. So, in your example using title, if you wanted it ascending:
page.php?orderBy=title

For descending
page.php?orderBy=title DESC

It's important that DESC be in capitals.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/