Is there a way to allow the add-to-cart only during store hours?
This is for online ordering for a restaurant. Do not want people sending order if the store is closed.
Thanks,
Jeff
Is there a way to allow the add-to-cart only during store hours?
This is for online ordering for a restaurant. Do not want people sending order if the store is closed.
Thanks,
Jeff
You can certainly write/or hire someone to write a simple cronjob to do that. The job just have to change the store mode to view price only when it closes, and change back to normal when it opens. Or you can do it manually.
I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me
Thanks for the reply.
After reading about cron jobs, it seems they run at a set time.
Would it work if a code was added to index.php (I think that's where it is needed) that would do the date/time checks and set "STORE_STATUS" for the current session?
I think the answer to my question depends on whether STORE_STATUS is set once or if it is read from the database multiple times? If read once, my logic says this will work. If read multiple times, the program would need to update the table. This leads to the question of if I am correct that index.php would always be executed upon entering the site preventing someone from getting an incorrect status?
Sorry I took so long to respond. I missed your reply somehow.
Jeff
What if someone is online for an hour before your restaurant closes, and orders after that?
The check really needs to happen when an order is placed, and possibly also when the add to cart is clicked.
I dont understand why you dont like the idea of having cronjob running at certain time. It seems to help you with your requirement. Or is there any I'm missing?
I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me
yellow1912,
The site will potentially host hundreds of restaurants, each a separate ZC install on a single server. My thought process was that it might be easier to just have a single mod on each site that checked a store hours table (one table created for each store).
After giving more thought to your suggestion, I do like your idea. I'm sure the routine could run every half hour and check if any stores need to be updated. That makes sense.
gjh42,
Good question! I'm going to have to test this. I'll see what happens if I change the store status after beginning order entry.
Thanks to all. I really appreciate the help.
have the store flip on down for maintenance manually every night just like they were closing the store doors....
and you can easily change teh DFM page to read
Closed Store Hours are
Zen cart PCI compliant Hosting
I am also looking to be able to do this.
The problem with pulling the site down for maintenance is that I want customers to be able to see the menu (Online food ordering) and browse while the physical store is closed. However, when they try to put something into the cart or try to check out it would redirect them to a page stating the opening hours.
So far I reckon the best way to do this is via the observer class
http://www.zen-cart.com/wiki/index.p..._API_Tutorials
Once the customer adds something to the cart or tries to check out, it would run my code.
But heres my problem, how do I create a global variable ie ($STORE_STATUS) which can be set via a short php script, and how do I get it to redirect to my store openning hours page?PHP Code:
function storeStatus() {
$_SESSION['cart']->attach($this, array('NOTIFIER_CART_ADD_CART_END', 'NOTIFY_CHECKOUT_PROCESS_BEGIN'));
}
Any help of either of those issue please!!
my 2 cents
I have been watching this time setting option.
I agree that a cron approach is the best way to activate the change.
Write a small script that changes the STORE_STATUS value of the DB and insert into the configuration table.
open_shop cron insert 0= Normal Store
close_shop cron insert 2= Showcase with prices
With this approach it can be out side zen-cart code or write it into the admin as a mod.
Just a suggestion.
• 446F63746F722057686F •
NeoNexus,
STORE_STATUS is available, but I'm not sure if it's changed anywhere once you enter the store. I have not gotten that far yet. (I would think it is never changed in core code.)
As my developement & testing continues, I see areas where the cron job would not help in every situation. In my earlier reply to Yellow1912, I knew in the back of my mind I would probably need more than the cron job, but it was too soon to know the full extent of what would be needed.
Using a cron job & changing store status to showroom after closing is a starting point. As NeoNexus said, maint is not desired because we also want people to browse after hours.
The problem comes with delivery hours vs. ordering hours vs. store hours. Store closes at 11:00, delivery till 10:00, accept pickup orders till 10:30.
The logic for this will likely be what's needed to deal with lunch specials. (Price/item only good till 3:00pm kind of thing.)
In the month since I first posted, I have gained a lot more insight into php and ZC and I think NeoNexus might be heading in the right direction. As most long time developers, I of course did not RTFM. I guess it's time now.
As I see now that others have an interest, I will post back when I find a solution.
Thanks for all the suggestions,
Jeff
Last edited by Jeff G; 3 Oct 2008 at 03:37 AM.
Bookmarks