ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Displaying Bank Holidays - Help Needed.

January 17, 2012 11:18am

Subscribe [1]
  • #1 / Jan 17, 2012 11:18am

    OwensDDB

    42 posts

    I am developing a site for a shopping centre in which every store has different opening hours. Each store profile has a Matrix containing the following (please ignore the “specific” column which is to be removed)

    Opening Hours Matrix

    In the store directory, I want to show a list of opening hours on that particular day (i.e. show Monday opening hours if it is a Monday). This works very well with the following code.

    {opening_hours search:day="=Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday"}
        {if "{day}" == "{current_time format='%l'}" AND "{hours}" != "Closed"}
            {hours}
        {if:elseif "{day}" == "{current_time format='%l'}" AND "{hours}" == "Closed"}
            {hours} 
        {if:else}
            Contact Store
        {/if}
    {/opening_hours}

    However, if it is a Bank Holiday, then the hours in the “Bank Holiday” row must be shown. The trick is determining if the day the user accesses the site is a bank holiday, as they change from year to year. Presently, I have a channel specifically for Bank Holiday Dates, which I will fill until the year 2020 or so. 

    Bank Holiday Dates

    Other techniques I’ve used mean that it is both true it is a bank holiday, and a monday, so two sets of opening hours are show. Presently, I’m unsure how to approach altering the above code so that I can say “If today is a bank holiday, show the Bank Holiday hours”.

    I would much appreciate any thoughts, as I am presently stumped.

    Many thanks

    P.S : My previous thread regarding this died, so I’m starting again in the hope that somebody can help with this!

     

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases