Array/Section Merge

5 posts by 3 authors in: Forums > CMS Builder
Last Post: October 9, 2013   (RSS)

By clowden - October 3, 2013

A few months back I worked on a website for a client who needed to merge two different sections into one listing, events and training. I followed a tutorial here on the forums http://www.interactivetools.com/forum/forum-posts.php?postNum=2198678 and got the merge to work properly, or so I thought. The two sections are merged into one list, but they are not sorting properly. Events stay grouped with events and trainings with training. You can see an example at http://catalystconnection.org/trainings/ and on the homepage as well. The first two records (as of today) are both events, Oct 16 and Oct 25, however, the next one is a training and has a start date of Oct 3, as you can see the dates are out of order. You cannot tell by the page, but in the CMS each event/training has a start date which is how the items are being sorted.

Any help would be greatly appreciated as I am at a loss. I have uploaded the page which will probably explain things a little better than what I did. The code in question starts on line 90.

Thank you,

Chris

Attachments:

index_051.php 10K

By clowden - October 8, 2013

Anyone have any thoughts on this? Thanks.

By mizrahi - October 8, 2013

I have a similar issue and am interested in knowing this too.

By ross - October 9, 2013

Hi Clowden

Thanks for posting!

My first thought here is that you are actually using a "date" field to set the date of your events.  What I think is happening on the page though is your events are being sorted by the createdDate field instead of the "date" field you created.  The reason this becomes a problem is because your events will be sorted based on the date you did the merge and not the date set with your actual "date" field.

If this is the case, your solution is going to be changing the sort order of this section to be based on your "date" field. This can either be done in the section editor on the Sorting tab for that section, or in the code on your page in the getRecords part with a "orderBy" attribute.

Does this make sense? Let me know what you think. Thanks!

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