I have a CCK node called Restaurants where I submit restaurants from around town to my website. In the past I used a plain text box and manually listed out a businesses hours. (Mon - Fri 9-5, Closed weeeknds, etc)

Now I am trying to make a more advanced site. I want business hours to be uniform across all nodes. So each node will have 7 fields where the open and close hours for each day of the week can be set. Using this info, when you view the node it might say "Closing soon" if that business will be closed in less then 1 hour, or 'Closed' if they have already closed for the day. I also hope to generate a view showing only results from restaurants that are currently open so users can look through a list of places to order from.

How can I do this in Drupal 6?

Comments

pritish’s picture

I've tried to hack the same thing with a contributed module called Office Hours. Although there are some major limitations with the module (insofar as the hours validation logic not working if the open hours are past midnight) it may work for you. Set up the Office Hours field to allow repeating, and you'll have the basic functionality of setting the day of week and the hours each day. The views logic (displaying closed, closing soon, etc) will have to be based off the evaluation of the user's time and the returned values from a node's Office Hours.

For some example php code, see http://drupal.org/node/165711

pio.fernandes’s picture

Thanks for this knowledge ... I actually can display (or not) content in a view based on office hours module with your help.