Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Mar 2009
    Posts
    5
    Plugin Contributions
    0

    Idea or Suggestion Working hours...

    Hi Folks,
    I would like to restrict my store. Orderings need to possible only in working hours. I am just testing the latest Zen Cart version, before use it in real environment, but it is very important aspect for me. Could anybody suggest method, links etc.


    Thanks in advanced,


    Gyurci

  2. #2
    Join Date
    Oct 2006
    Location
    Alberta, Canada
    Posts
    4,571
    Plugin Contributions
    1

    Default Re: Working hours...

    Hi and Welcome to the Forum.

    Till you find something different the easiest way is to manually put the Store in Maintenance mode, then enable Store when open again.

    Admin > Configuration > Website Maintenance

  3. #3
    Join Date
    Jan 2008
    Posts
    1,700
    Plugin Contributions
    6

    Default Re: Working hours...

    I would create two php files. One contains an sql statement to put the store in showcase mode. The other contains an sql statement to put the store in normal mode. Then create two cron jobs to call the files at the appropriate times.

  4. #4
    Join Date
    Mar 2009
    Posts
    5
    Plugin Contributions
    0

    Default Re: Working hours...

    Website Rob and Steven300,
    thanks for your quick help. Theoretically I totally understand Steven300's solution and it is very creative, but I am a graphic designer and I have no programming knowledge at all.
    So with PhpMyadmin I can find in configuration table the Store Status value but I can not write a PHP code to change it.
    Could you give me some cue words what should I search in PHP help or forums. I definitely like to solve this problem so if I have to learn, I will do that. Please correct me if I wrong, I should connect to the local database, make a value change in a table and close the connection. Can I make it only with the built in PHP functions?
    The two php files should be in public_html folder or not?

    Thanks and have a nice day!


    Gyurci

  5. #5
    Join Date
    Jan 2008
    Posts
    1,700
    Plugin Contributions
    6

    Default Re: Working hours...

    I think it would go something like this..

    PHP Code:
    <?php

    require('includes/application_top.php');

    $sql="UPDATE configuration SET configuration_value = 2 where configuration_id = 23;";

    $result=$db->Execute($sql);

    ?>
    Including application_top.php will automatically connect you to the database. The example above puts the store in showcase mode (with prices). To put it in normal mode, you would change configuration_value from 2 to 0. This example assumes the file is in your root directory. I think you could put it elsewhere providing you update the path to application_top.php. Hope this helps.

  6. #6
    Join Date
    Jan 2008
    Posts
    1,700
    Plugin Contributions
    6

    Default Re: Working hours...

    Or if you wanted to avoid cron jobs for whatever reason, you could take a different approach whereby you create a php file containing the following code and include it so it loads on each page visit to your site. It gets the current time and checks to see whether the store should be in normal mode or showcase mode and sets it accordingly. I'm not sure whether it would affect the speed of your site doing this on each page visit, but I think it should be okay.

    PHP Code:
    <?php

    require('includes/application_top.php');

    //Define opening time
    $opening_time "09:00:00";
    $closing_time "17:00:00";

    //Remove characters
    $opening_time str_replace(':'''$opening_time);
    $closing_time str_replace(':'''$closing_time);

    //Get current time
    $t time();
    $now date('His'$t);

    //Check if it's opening time
    if ( ($now $opening_time ) && ( $now $closing_time ) ) {
    //opening time, put store in normal mode
    $sql_opening="UPDATE configuration SET configuration_value = 0 where configuration_id = 23;";
    $result_opening=$db->Execute($sql_opening);
    } else {
    //closing time, put store in showcase mode
    $sql_closing="UPDATE configuration SET configuration_value = 2 where configuration_id = 23;";
    $result_closing=$db->Execute($sql_closing);
    }

    ?>

  7. #7
    Join Date
    Mar 2009
    Posts
    5
    Plugin Contributions
    0

    Default Re: Working hours...

    I am in late because of test Your first method. At first sight it not worked for me because I put a pre (zen) tag to my all table at installation and I forgot about it. But now everything works fine.
    Absolutelly You are the king.

    I will try Your second method in a minute. Thanks for Your help.


    Best regards,


    Gyurci

  8. #8
    Join Date
    Mar 2009
    Posts
    5
    Plugin Contributions
    0

    Default Re: Working hours...

    It's an another brilliant solution!

    " create a php file containing the following code"
    for example changemod.php

    "and include it "
    to where? You mean I should place this row "require('changemod.php');"to every visible php file on my webpage?! Tell the truth, this is my first try with Zen Cart, so I can not know the stucture pretty much.

    Just a quick tip in theoretically:
    May be I should only include this file to the index.php, so the first visitor will turn off the store shopping cart in the closed time, and vica versa. Is it true, that Your function works only when someone calls in my case the index.php from a web browser?


    Bye,


    Gyurci

  9. #9
    Join Date
    Jan 2008
    Posts
    1,700
    Plugin Contributions
    6

    Default Re: Working hours...

    To be honest I'm still learning about the Zen Cart structure as well, especially when it comes to auto-loading. My (minimal) understanding of index.php is that it is like the "engine" for Zen Cart and is used to "put together" every page. So you might find that including it from index.php will load it on every page visit, not just the first. Hopefully someone more experienced in this area can jump in.

  10. #10
    Join Date
    Mar 2009
    Posts
    5
    Plugin Contributions
    0

    Default Re: Working hours...

    Thanks once more, You solved my problem in a minute.
    The cron version absolute perfect for me.


    Good luck!


    Gyurci

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v138a how many working hours needed to upgrade from 1.38 to 1.50? big risk?
    By mybiz9999 in forum Upgrading to 1.5.x
    Replies: 18
    Last Post: 4 May 2012, 06:40 PM
  2. Holiday Hours?
    By SDImagine in forum General Questions
    Replies: 1
    Last Post: 29 May 2010, 07:56 PM
  3. PayPal stopped working in last 24 hours
    By timcfi in forum PayPal Website Payments Pro support
    Replies: 4
    Last Post: 10 Feb 2009, 05:18 AM
  4. Store Hours
    By brycej2 in forum Basic Configuration
    Replies: 5
    Last Post: 8 Mar 2007, 10:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR