Asset Listings and Sorting


(Daniel Woodward) #1

Hi.

 

On our travel site we have just introduced cruise holidays.

 

On the homepage of this I have six offers. I have used an asset listing to show these randomly out of 30+ offers so the content is always changing.

 

However I would like the 6 shown to then be sorted by departure date.

 

Is this possible as if I set sorting to the departure date the asset listing only shows the 6 six departing soonest and will no randomise.

 

I hope this makes sense.

 

thanks.

Dan


(Nic Hubbard) #2

No it isn't possible to do two sorting procedures in an asset listing. I might be inclined to do the sorting by date using javascript.


(Anthony) #3

Its a bit of a hack, but in theory would it be possible to have one asset listing that picked the six random ones and formatted the output in CSV, XML, RSS or some other "data" format, then use another asset listing or search asset on the resulting shadow assets to sort them and format for display? I've never tried to do anything like that but I'd be interested to hear if its possible as its the sort of thing I might just need myself one day!


(Bart Banda) #4

An even simpler method based on Anthony's approach, would be to use 1 asset listing to just print the 6 asset ids separated by commas, then the second asset listing would just use the %asset_contents_raw% from the first asset listing as a dynamic root nodes source. That should work. 


(Daniel Woodward) #5

Thanks for your suggestion Bart. I have just given this a try but nothing was displayed.

When you get a moment please can you explain this in a bit more detail.

 

many thanks.

Dan


(Bart Banda) #6

I would start with working on the first asset listing, make it output the comma separate list of ids and nothing else, not HTML or nothing. It should just print the following when you use the %globals_asset_contents_raw:1234% keyword, where 1234 is the id of the asset listing:

1111,2222,3333,4444

Just asset ids. 

 

Once you can confirm that it is doing that, you can use the the Dynamic Parameters section on  the other asset listing and use the Array of specific asset ids option, and use set value as the source, and put %globals_asset_contents_raw:1234% in there. 

 

Hope that helps. 


(Kequi) #7

Hi Anthony - I used to do something similar for a 'most read' listing - where I just wanted the last 30 days of content - ordered by hitcount.

Generated a what's new page to get last 30 days - then an RSS data source to list the assets - then an asset lisiting page to order the rss shadow assets by hitcount.

 

It worked OK - but it was an appalling hit to performance so I had to work out an alternative.

 

Settled for building triggers to move new assets in and out of a 'recent content' folder - then a straight hitcount lsiting page to sort them (much faster).

 

Dan - my advice would be to check the /_performance after you set  up Bart's suggestion (which sounds pretty good although I've not that before)