0

I have a channel which searches by various custom fields and returns 4 results.

What I want to do is to order them by 1,2,3,4 etc and have a custom field to order them with to that effect. No problem there.

Where the question arises is if only 3 entries are returned - there have to be 4 as each entry equals a time: 1 - 10.00, 2 - 10.30, 3 - 11.00 and 4 - 11.30.

So we need to have a conditional to show one of these but can't actually test against one as it doesn't exist. Ie if no-one has submitted an entry for 10.00 I want it to show "AVAILABLE" or some such. Doesn't seem that easy to do....

3
  • Can I assume you trying to do this dynamically? meaning you don't know the entry ID's? Is there an entry ID for a time that should show as "Available"?
    – Anna_MediaGirl
    Feb 7, 2014 at 23:16
  • Do you have a question or are you just telling is a nice story..?
    – Timo002
    Feb 7, 2014 at 23:19
  • Hi Anna yes, is dynamic so don't know the IDs but have been working with the idea of having a fixed 'blank' entry to show for 'Available' which would have a known ID. Problem is though that this would also be ordered by the custom field that has a 1.2, 3 or 4 in it and I can get it showing but it messes up the order as the ordering field is shown as: 1,2,2,3 for example (because the 'Available' field is also #2 like the user submitted field is) whereas I need:1,2,3,4. Thanks for this though - hadn't thought of it and opens up another angle. Cheers!
    – segovius
    Feb 8, 2014 at 7:20

1 Answer 1

1

EE can't show what it doesn't have. So the channel entries should not be the starting point of your quest, but i guess the timeslots should be.

I would either go for a frontend solution and let jquery (or a library like angular/knockout) solve the display problem. Or i would prepare a timeslot-list with stash and add the entries to another list and/or compare them. See also: https://speakerdeck.com/croxton/stash-core-principles?slide=55

1
  • I went the way of the two Stash lists - thanks for that. One for the Timeslots and one for the entries. Have hit a snag though as I can't get a conditional going to show the Timeslot (which is essentially a 'holder') if the corresponding entry is not there.
    – segovius
    Feb 12, 2014 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.