Giter Site home page Giter Site logo

bolt-store-hours's Introduction

Bolt Store Hours

This bolt.cm extension adds business hours as a field type within Bolt based on PHP Store Hours.

PHP Store Hours is a simple PHP class that outputs content based on time of the day and day of the week.

Simply adjust opening and closing hours for each day of the week and you can output content based on the time ranges you specify.

Installation

  1. Login to your Bolt installation
  2. Go to "Extend" or "Extras > Extend"
  3. Type bolt-store-hours into the input field
  4. Click on the extension name
  5. Click on "Browse Versions"
  6. Click on "Install This Version" on the latest stable version

Configuration

To use this extension, you should add a field to your contenttypes, and use the tags in your twig templates accordingly.

In your contenttypes, you should add a single storehours field. The extension will use this to store the data for each weekday that show in the backend when editing a record. Simply add it to your fields like this:

business:
    name: Businesses
    singular_name: Business
    fields:
        [..]
        hours:
            type: storehours

After you've done this, it will look like this in the Bolt backend:

screenshot

Use

You can use store_hours_is_open() to return true or false if the store is open.

    {{ store_hours_is_open(record.hours) }} {# Returns true or false #}

Or you can display today's hours by doing:

{% for hour in store_hours_hours_today(record.hours) %}
    {% set this_day_hours = hour|split('-') %}
    Open: {{ this_day_hours[0]|date('g:i a') }}
    Close: {{ this_day_hours[1]|date('g:i a') }}
{% endfor %}

Note: This is a new extension, so the functionality is still pretty bare bones. What's there works well, but there is probably a lot of functionality to add and improve. If you'd like to contribute, or have a good idea, feel free to open an issue on the tracker at the Bolt Store Hours repository on Github.


License

This Bolt extension is open-sourced software licensed under the [Your preferred License]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.