1

Looking for the best solution for this. Ideally I would like it to be similar to how we put a Drupal website in and out of maintenance mode.

It would need to disable the add to cart button and change the text to Restaurant closed or something similar.

I would then as well like to have a message on the site in the header somewhere that says Open or closed for business.

I have some minimal module development experience so looking to advance my skills with this one and get stuck into some further development.

What I really need is someone with a better understanding of drupal to point me in a good direction so that I can figure this one out.

Appreciate any words of wisdom here.

3 Answers 3

0

To do some flip-flopping with the Add to Cart buttons, take a look into the Commerce Stock module(s). I'd imagine it's in the commerce simple stock. When a product goes out of stock, it disables the Add to Cart button on the relevant product displays. Though if even one product is available on that display, it won't disable it. So, I would recommend checking out the commerce_stock.module and commerce_stock.rules.inc to see how they are doing that.

I envision a simple admin form page with a Close Store and Open Store buttons, and in their submit handlers, just running through and disabling the Add to Cart(s). I'm sure there's a good way to do the "Restaurant Closed", "Restaurant Open" text, it's escaping me at the moment.

1
  • Thanks for this daviedos. Yes I have been thinking to look into this stock module. I guess I can do a check using form_alter Hook and disabling the add to cart option if the shop is closed. Although I'm not sure how to go about this. I guess I would need to use the database in some way, as I would need to have a true or false value, if you know what I mean... Feb 2, 2015 at 19:51
0

I'd use rules and the submodule rules scheduler to make the open/close work according to a set schedule. Then you could also probably implement a button for adhoc close/open to override the normal schedule. I might do this with a simple form alter that disables/enables the order/checkout button based on an admin flag.

To think further ahead though, what you probably want to do is modify the order to allow "Pre-order" or "Order Now". Thus, when the store is closed allows orders to be accepted in anticipation of when the restaurant will be open next and at all normal/open times allow the orders to be for now (optionally, you could still offer the ability to pre-order/schedule an order when the restaurant is open if desired).This would mean you'd have to implement the ability for an order to have a date/time element (Now = now, Preorder = nominated time/date)

0

Refer to my answer to the question about How can I put a Drupal Commerce site in 'Shop Closed' mode, similar to Drupal's maintenance mode? for a Rules based suggestion to open/close the restaurant/takeaway.

No "module development experience" required, only sie building (and "Rules").

Your Answer

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

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