Custom sub-sort order?

5 posts by 4 authors in: Forums > CMS Builder
Last Post: June 16, 2009   (RSS)

By ncasares - May 27, 2009

I have a question that's semi-related to this post:
http://www.interactivetools.com/iforum/Products_C2/CMS_Builder_F35/folder_of_uploaded_images_P71859/

I have a multi-record editor of images with a custom field for category. So far I can display images based on a query for a particular category. The sort order is following the order defined in the editor (DragSortOrder).

My challenge is that I'd like to define a custom sub-sort order for each category. Right now if I search for images in category_a and order them in the editor it changes the order of photos in category_b if any of the photos are in both categories.

Technically, I understand why this is happening (since all images are in one table). Is there any work around for defining a sub-sort order for each category? I thought about using a third field called "category sort order", but that gets messy for the end user.

I'd love to retain the drag and drop functionality of DragSortOrder. I don't want to split each category into a separate photo editor because many of my photos need to show up in multiple categories and this would force me to upload images more than once.

Maybe I'm asking too much here? This is a sharp group so I thought I'd see if anyone has some insight.

Thanks.

Re: [ncasares] Custom sub-sort order?

By ross - May 27, 2009

Hi there.

Thanks for posting!

Do each of your categories have their on physical page? If so, you can actually use the orderBy option on each page to manually override the ordering.

Right after your "where" clause, add in:

'orderBy' => 'FIELD NAME',

Give that a shot and let me know how you make out :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [ross] Custom sub-sort order?

By ncasares - May 27, 2009

Hi Ross,
Thanks for the quick reply. This is actually what I'm doing now.

The snag is that I'd like to use DragSortOrder since it lets the client order photos visually. Since I only have one table of photos this approach means I only get 1 defined sort for DragSortOrder.

I guess what I'm really looking for is a way to sub-sort visually based on a filtered list of photos. Probably not doable, but I thought I'd pose the question.

I think something like this would require a third join table and making that work visually in the editor is probably asking too much [:)]

Re: [ncasares] Custom sub-sort order?

By Dave - June 1, 2009

One way would be to sort by category name, then dragSortOrder in the editor... But that's not really supported (I think you'd have to change the sort order in /data/schema/ to do it) and may have some unexpected results.

Also, if a image appeared in multiple categories I'm not sure how you'd indicate the sorting for both at the same time.

Another approach would be to have multiple sort order fields (or a custom one) and have an external app that let you update them (with a mysql UPDATE query). Not sure if that would be worth the effort though.
Dave Edis - Senior Developer
interactivetools.com