Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,443
    Plugin Contributions
    9

    Default Auto Store Open/Close (ASOC) - [Support Thread]

    This plugin is intended for a Fast Food / Pizza etc bricks & mortar shop with online ordering facility.

    It enables the store owner to automatically open or close the online store depending on the actual opening hours of the physical store.

    As an example, a pizzeria offers home delivery and/or pre-ordering online. The physical store operates from say 10.00 to 23.00 hrs. Last orders are taken at 22.30 hrs. Therefore the store owner does not want to see any online orders after the kitchen closes - or the customer would be mighty unhappy.....

    A few cron jobs and 2 files added to the admin section automatically opens and closes the online store by changing the store status to 'Showcase with prices' or 'Showcase - no prices' (selecting the former would make sense...).

    The store owner receives an email once the online store status has actually changed.

    If the physical store operates the same hours every day of the week then only 2 cron tabs need to be set, one for open and one for close. If the hours vary for certain weekdays then additional cron tabs need to be set - depending on the owner's requirements.

    It is recommended to also install the module Product Delivery by Postcode (PDP) to ensure that vistors from a far away residence can not place an order. You would not want to take money from someone who lives in Adelaide if your store is located in Melbourne or Sydney only because the customer lives in a suburb with a name that exists in all 3 cities (eg Cheltenham) and does not notice that the online store is attached to a physical store which is not in his/her city - makes sense???

    This plugin is now available for download

    Frank

  2. #2
    Join Date
    Jun 2015
    Location
    Germany
    Posts
    3
    Plugin Contributions
    0

    Default Re: Auto Store Open/Close (ASOC) - [Support Thread]


    Hello everybody! This is my first post to this support forum, maybe not so professional and not in good english, but I'll try do my best:

    I’m using ZenCart v. 1.5.4 on a virtual server / Linux + Ubuntu 14.04.3 LTS +
    cPanel: Plesk v12.5.30_build1205150826.19 os_Ubuntu 14.04

    I‘ve installed „Auto Store Open/Close“-plugin V.24.Jul.2014 (this is recomanded for ZenCart v1.5.0, v1.5.1, v1.5.2, v1.5.3)
    I’ve read 100 times the plugin documentation,
    I’ve edit+replased as said the auto_store_open_close.php with the times of my physical store
    I’ve tried several cronjobs:
    1. As in documentation recomanded
    30 11 * * * wget http://My_Domain/zencart/my_zen_admi...open_close.php >/dev/null 2>&1
    00 22 * * * wget http://My_Domain/zencart/my_zen_admi...open_close.php >/dev/null 2>&1

    2. lynx -source http://My_Domain/zencart/my_zen_admi...open_close.php -auth=user_PW
    30 11 * * * * (every day at 11.30 am)
    In both cases I get only the result of a succefully login, but the php-code is not resolved. Shop does not open/close.
    Is there also an optimasation for ZENCart v.1.5.4 ? Can somebody see what I make wrong?
    Is somebody knowing a solution for this cronjob?
    I find this is a verry important function for a good shop.I should be happy to get it working on my shop.
    Thank you in advance for helping.

  3. #3
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,443
    Plugin Contributions
    9

    Default Re: Auto Store Open/Close (ASOC) - [Support Thread]

    Guten Tag,

    Assuming you have installed/merged all files correctly and in the file YOUR_ADMIN/auto_store_open_close.php you did configure the lines as follows

    PHP Code:
    $store_open = ('11:30:00');

    $store_close = ('22:00:00'); 
    set your cron jobs 5 minutes earlier to

    25 11 * * * wget http://My_Domain/zencart/my_zen_admi...open_close.php >/dev/null 2>&1
    55 21 * * * wget http://My_Domain/zencart/my_zen_admi...open_close.php >/dev/null 2>&1

    Now, if your server is located in a different time zone compared to your store then you will not see your store set to open or closed at these times.

    Example:

    Your store is in Hamburg / Germany (local time is UTC +1) and your server is in Los Angeles / USA (server time is UTC -7) then you have a time difference of 8 hours. In that case try to set your cron jobs to

    25 03 * * * wget http://My_Domain/zencart/my_zen_admi...open_close.php >/dev/null 2>&1
    55 13 * * * wget http://My_Domain/zencart/my_zen_admi...open_close.php >/dev/null 2>&1

    To see if the cron jobs are actually running, set an email address in your cPanel / Plesk whatever and make the cron jobs to look like this:

    25 03 * * * wget http://My_Domain/zencart/my_zen_admi...open_close.php
    55 13 * * * wget http://My_Domain/zencart/my_zen_admi...open_close.php

    Let us know how you go with this.

    Frank

  4. #4
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,443
    Plugin Contributions
    9

    Default Re: Auto Store Open/Close (ASOC) - [Support Thread]

    If you are still having issues then replace your file YOUR_ADMIN/auto_store_open_close.php with this code:

    PHP Code:
    <?php
    /*
    ***********************************************************************
    $Id: auto_store_open_close.php, v 1.2 2016/02/15

    ZenCart 1.5.4
    Copyright 2003-2010 Zen Cart Development Team
    Portions Copyright 2004 osCommerce
    http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0

    Originally written By SkipWater <skip@ccssinc.net> 05.08.10

    Modified by Frank Riegel (frank18) isonetwork.net.au - Mon 15 Feb 2016 14:23:02 +1000 $

    Use at your own risk.

    ***********************************************************************
    All we do is set the store status value based on the time of day.
    The admin of the zen cart should setup a cron to run this script a
    minute or two after the hour set to open and close the store.

    That is 2 (two) cron calls a day. One to open and one to close.

    This file must be run from the admin folder of the zen cart site.

    */

    define('CRON_ADMIN_USER_ID''1'); // as suggested by DrByte --- DO NOT EDIT THIS LINE OR YOUR CRON TAB WILL NOT WORK!!!

    require('includes/application_top.php');

    $now_time date('H:i:s'); // --- DO NOT EDIT THIS LINE OR YOUR CRON TAB WILL NOT WORK!!!

    // Change to meet your opening and closing times - you need to set below times to 5 mins earlier than your advertised opening/closing times
    // and then set your cron tab times to the exact advertised opening/closing times of your physical store
    // Time is based on 24 hour clock 12 = noon, 00 = Midnight
    $store_open = ("10:55:00");// 10:55 am
    $store_close = ("21:55:00"); // 09:55 pm

    // If you want an email sent to store owner, that notifies that the status of the Online Store has actually changed
    // Set this to 1
    $notify 1;

    /*
    0 = Normal Store
    1 = Showcase no prices
    2 = Showcase with prices
    */

    if ((strtotime($now_time) >= strtotime($store_open)) && (strtotime($now_time) <= strtotime($store_close))) {    
    $zen_store_stat 0// Store is Open Normal Zen Cart
    } else {
        
    // comment / uncomment ONE of the next 2 lines to fit your requirements

    // $zen_store_stat = 1; // Store is Closed - Showcase no Prices
    $zen_store_stat 2// Store is Closed - Showcase with Prices  >> RECOMMENDED
    }

    // Should not need to edit below this line
    // ***********************************************************************

    $check_query "SELECT * FROM " TABLE_CONFIGURATION " WHERE configuration_key = 'STORE_STATUS';";
    $check_result $db->Execute($check_query);
    if (
    $check_result->RecordCount() > 0) {
    $insert_query "UPDATE " TABLE_CONFIGURATION " SET configuration_value='" $zen_store_stat "' WHERE `configuration_key` = 'STORE_STATUS'; ";
    $insert_result $db->Execute($insert_query);
    // uncomment if not running cron
    // if ($insert_result) echo 'Store Status Set to '.$zen_store_stat.'<br />';
     
    }
     
    // by now the Store Status should be updated as specified above

    // now let's notify the store owner by email

    if ($notify != 0) {

    $email_updated_status false;
    zen_mail();
    switch (
    true) {
      case (
    $zen_store_stat == 0):
        
    $email_updated_status true;
        
    zen_mail('',STORE_OWNER_EMAIL_ADDRESS'Store Status Changed to OPEN''Online Store OPEN - updated: 'date('Y M d H:i:s'), '',STORE_OWNER_EMAIL_ADDRESS); // email admin if status change to OPEN
        
    break;
      case (
    $zen_store_stat == 1):
        
    $email_updated_status true;
        
    zen_mail('',STORE_OWNER_EMAIL_ADDRESS'Store Status Changed to CLOSED (Showcase no prices)''Online Store CLOSED (Showcase no prices) - updated: 'date('Y M d H:i:s'), '',STORE_OWNER_EMAIL_ADDRESS); // email admin if status change to CLOSED
        
    break;
      case (
    $zen_store_stat == 2):
        
    $email_updated_status true;
        
    zen_mail('',STORE_OWNER_EMAIL_ADDRESS'Store Status Changed to CLOSED (Showcase with prices)''Online Store CLOSED (Showcase with prices) - updated: 'date('Y M d H:i:s'), '',STORE_OWNER_EMAIL_ADDRESS); // email admin if status change to CLOSED
        
    break;
      default:
      
    // uncomment if not running cron
      // echo 'Error Setting Store Status <br />';
        
    zen_mail('',STORE_OWNER_EMAIL_ADDRESS'Error Failed Setting Store Status!!''ERROR - No Store Status set on OnLine Store! '.date('Y M d H:i:s'),'',STORE_OWNER_EMAIL_ADDRESS); // email admin if status change failed
        
    break;
      }

    }
    ?>
    I tested this on a 1.5.4 server with PHP 5.5.9 and had no issues.

    Please let me know how it works for you.

  5. #5
    Join Date
    Jun 2015
    Location
    Germany
    Posts
    3
    Plugin Contributions
    0

    Default Re: Auto Store Open/Close (ASOC) - [Support Thread]

    Hallo Frank!
    Thank you for your 2 statements.
    This is my test plattform:
    V-Server from Strato.AG (in Berlin) / My Zen-Shop in Stuttgart / There is no time difference in between. Die Zeitzone zum Ausführen der Aufgabe ist (UTC +01:00) Europe / Berlin
    Server Betriebssystem: Linux 3.13.0-042stab111.12 Datenbank: MySQL 5.5.47-0ubuntu0.14.04.1
    Server Datum: 15.02.2016 13:09:07 Datenbank Datum: 15.02.2016 13:09:07
    Server Up Time: 13:09:07 up 2:27, 0 users, load average: 0.14, 0.06, 0.03 HTTP Server: Apache
    PHP Version: 5.5.9-1ubuntu4.14 (Zend: 2.5.0) PHP Memory Limit: 256M PHP Safe Mode: Off
    PHP Datei Uploads: On Max. Größe: 16M POST Max. Größe: 16M

    My shop is to see under: lieferservice.restaurant-weilerhau.de
    Now I did (once more than 100 times) the same as in installation documentation and after your statement:
    1.Install „auto_store_open_close.php“ (today: auto_store_open_close.php, v 1.2 2016/02/15 / code edited direct in cPanel , no copy per FTP)
    2.Than, I’ve uploaded the „init_cron_admin_user_id.php“ file in /includes/init_includes/overrides/
    3.Cron jobs:
    If I write the cron job with „wget“ like:

    30 11 * * * wget http://My_Domain/zencart/zen_admin/a...open_close.php
    00 22 * * * wget http://My_Domain/zencart/my_zen_admi...open_close.php

    I do not get any answer……

    If I comand:
    lynx -source http://www.restaurant-weilerhau.de/z...open_close.php -auth=?Skalkos$2015
    every day at 11.30

    The Apache server starts correctly his cron job and send
    allways same report per Email:

    regarding: Cron <skalkos@h2184067> lynx -source http://www.restaurant-weilerhau.de/z...open_close.php -auth=?Skalkos$2015

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="de">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Zen-Cart 1.5</title>
    <link href="includes/stylesheet.css" rel="stylesheet" type="text/css" />
    <meta name="robots" content="noindex, nofollow" />
    <script language="javascript" type="text/javascript"><!--
    function animate(f)
    {
    var button = document.getElementById("btn_submit");
    var img = document.getElementById("actionImg");
    button.style.cursor="wait";
    button.disabled = true;
    button.className = 'hiddenField';
    img.className = '';
    return true;
    }
    //--></script>
    </head>
    <body id="login" onload="document.getElementById('admin_name').focus()">
    <form id="loginForm" name="loginForm" action="http://restaurant-weilerhau.de/zencart/zen_admin/login.php?camefrom=auto_store_open_close.php" method="post" onsubmit="animate(this)">
    <fieldset>
    <legend>Admin Login</legend>
    <label class="loginLabel" for="admin_name">Benutzername: </label>
    <input style="float: left" type="text" id="admin_name" name="admin_name" value="" autocomplete="off" />
    <br class="clearBoth" />
    <label class="loginLabel" for="admin_pass">Passwort: </label>
    <input style="float: left" type="password" id="admin_pass" name="admin_pass" value="" autocomplete="off" />
    <br class="clearBoth" />
    <p class="messageStackError"></p>
    <input type="hidden" name="securityToken" value="f2563929bffddfc95bdb352566d9cff0">
    <input type="submit" name="submit" class="button" value="Login" id="btn_submit"/>
    <input type="hidden" name="action" value="dof2563929bffddfc95bdb352566d9cff0" id="action1"/>
    <img id="actionImg" src = "images/loading.gif" class="hiddenField" />
    <br /><a style="float: right;" href="http://restaurant-weilerhau.de/zencart/zen_admin/password_forgotten.php">Passwort vergessen?</a>
    </fieldset>
    </form>
    <div id="loginExpiryPolicy">LOGIN_EXPIRY_NOTICE</div>
    </body>
    </html>


    By the way:
    1. wget is one of the files that needs to have rights 700, else every hackers uploaded script can use it to download the rest of the hack from external websites.
    2. “lynx” - advantage is that the php file is executed with the rights of the website user and not root.
    the "-auth=loginP asswd" is the login info because the cron.php is placed inside a password protected directory.
    An extra advantage of running a cron with lynx is that it is executed with not only the rights, but also the configuration of that website.
    If the site has a custom php.ini then it will be run with those settings.
    Do you think that this could be a reson, why the “„init_cron_admin_user_id.php“ in our case is not doing well?

    I’m desolate, unfortunately I can not get it work.
    let me know if you see any mistake.
    Thank you and have a nice night.
    Best regards, Mihaela

  6. #6
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,443
    Plugin Contributions
    9

    Default Re: Auto Store Open/Close (ASOC) - [Support Thread]

    Thanks for your detailed info Mihaela.

    Firstly change the name of your admin folder as soon as possible and in future postings do not disclose the real name of your admin!!!

    Quote Originally Posted by mihaela View Post
    Hallo Frank!
    Thank you for your 2 statements.
    This is my test plattform:
    V-Server from Strato.AG (in Berlin) / My Zen-Shop in Stuttgart / There is no time difference in between. Die Zeitzone zum Ausführen der Aufgabe ist (UTC +01:00) Europe / Berlin
    Server Betriebssystem: Linux 3.13.0-042stab111.12 Datenbank: MySQL 5.5.47-0ubuntu0.14.04.1
    Server Datum: 15.02.2016 13:09:07 Datenbank Datum: 15.02.2016 13:09:07
    Server Up Time: 13:09:07 up 2:27, 0 users, load average: 0.14, 0.06, 0.03 HTTP Server: Apache
    PHP Version: 5.5.9-1ubuntu4.14 (Zend: 2.5.0) PHP Memory Limit: 256M PHP Safe Mode: Off
    PHP Datei Uploads: On Max. Größe: 16M POST Max. Größe: 16M
    That looks fine to me.

    Quote Originally Posted by mihaela View Post
    My shop is to see under: lieferservice.restaurant-weilerhau.de
    Now I did (once more than 100 times) the same as in installation documentation and after your statement:
    1.Install „auto_store_open_close.php“ (today: auto_store_open_close.php, v 1.2 2016/02/15 / code edited direct in cPanel , no copy per FTP)
    2.Than, I’ve uploaded the „init_cron_admin_user_id.php“ file in /includes/init_includes/overrides/
    3.Cron jobs:
    If I write the cron job with „wget“ like:

    30 11 * * * wget http://My_Domain/zencart/zen_admin/a...open_close.php
    00 22 * * * wget http://My_Domain/zencart/my_zen_admi...open_close.php

    I do not get any answer……
    Looks like wget may not be installed/enabled on your server or it would send you an email when the cron job is executed. You could check with your server people in Berlin if this is the case, and if not then you may ask them to enable wget. This is the first thing to do.

    Quote Originally Posted by mihaela View Post
    By the way:
    1. wget is one of the files that needs to have rights 700, else every hackers uploaded script can use it to download the rest of the hack from external websites.
    All files (with the exception of the 2 configure.php files) should be set to 644, wget works with these permissions

    Quote Originally Posted by mihaela View Post
    Do you think that this could be a reson, why the “„init_cron_admin_user_id.php“ in our case is not doing well?

    It may be possible that the YOUR_ADMIN/includes/init_includes/overrides/init_cron_admin_user_id.php does not respond to your lynx command. I had something similar happening on a client's server....

    Try this:

    1. copy the file YOUR_ADMIN/includes/init_includes/init_admin_auth.php into the folder YOUR_ADMIN/includes/init_includes/overrides/
    2. in the copied file (not the original) init_admin_auth.php add this code


    PHP Code:
    if (!isset($_SESSION['admin_id']) && defined('CRON_ADMIN_USER_ID') && (int)CRON_ADMIN_USER_ID != 0) { 
      
    $_SESSION['admin_id'] = CRON_ADMIN_USER_ID

    right after the line

    PHP Code:
    if (!defined('IS_ADMIN_FLAG')) die('Illegal Access'); 
    3. delete the file YOUR_ADMIN/includes/init_includes/overrides/init_cron_admin_user_id.php

    4. in the file YOUR_ADMIN/auto_store_open_close.php (which I posted above) set

    PHP Code:
    $store_open = ("10:55:00");// 10:55 am
    $store_close = ("21:55:00"); // 09:55 pm 
    which is 5 minutes before your cron job times.

    Let us know what transpires.

    Cheers / Frank

    PS: Ich bin in Schwenningen am Neckar (jetzt Villingen-Schwenningen) geboren und aufgewachsen, lebe seit fast 40 Jahren in Australien...

  7. #7
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,443
    Plugin Contributions
    9

    Default Re: Auto Store Open/Close (ASOC) - [Support Thread]

    Another option is to use cURL (curl in the command line):

    Code:
    30 11 * * * curl -s 'http://yourdomain.com/zencart-installation/youradmin/auto_store_open_close.php'
    00 22 * * * curl -s 'http://yourdomain.com/zencart-installation/youradmin/auto_store_open_close.php'
    Make sure you leave the -s switch intact (runs the command in silent mode) and also do not remove the single quotes before and after the URL.

  8. #8
    Join Date
    Jun 2015
    Location
    Germany
    Posts
    3
    Plugin Contributions
    0

    Default Re: Auto Store Open/Close (ASOC) - [Support Thread]

    Oh, happy day!
    You Frank taught me how,
    how to watch, How to fight………………….
    And living rejoicing everyday…….

    I followed yor last recomanded solution:

    1. copy the file YOUR_ADMIN/includes/init_includes/init_admin_auth.php into the folder YOUR_ADMIN/includes/init_includes/overrides/
    2. in the copied file (not the original) init_admin_auth.php add this code

    PHP Code:

    if (!isset($_SESSION['admin_id']) && defined('CRON_ADMIN_USER_ID') && (int)CRON_ADMIN_USER_ID != 0) {
    $_SESSION['admin_id'] = CRON_ADMIN_USER_ID;
    }

    right after the line
    PHP Code:

    if (!defined('IS_ADMIN_FLAG')) die('Illegal Access');

    3. delete the file YOUR_ADMIN/includes/init_includes/overrides/init_cron_admin_user_id.php

    4. in the file YOUR_ADMIN/auto_store_open_close.php (which I posted above) set

    PHP Code:

    $store_open = ("10:55:00");// 10:55 am
    $store_close = ("21:55:00"); // 09:55 pm

    which is 5 minutes before your cron job times.


    Everything works as wanted!
    Thank you Frank. You have considerable enriched the value of Zen with your plugin.
    Sie haben den Wert des ZenCart mit Ihrem Plugin erheblich
    angereichert.

    I want to share my joy with all who support this wonderfull ZenCart. I'll donate a Cup of coffee.Mihaela

  9. #9
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,443
    Plugin Contributions
    9

    Default Re: Auto Store Open/Close (ASOC) - [Support Thread]

    Quote Originally Posted by mihaela View Post
    Oh, happy day!
    You Frank taught me how,
    how to watch, How to fight………………….
    And living rejoicing everyday…….

    ......

    Everything works as wanted!
    Thank you Frank. You have considerable enriched the value of Zen with your plugin.
    Sie haben den Wert des ZenCart mit Ihrem Plugin erheblich
    angereichert.

    I want to share my joy with all who support this wonderfull ZenCart. I'll donate a Cup of coffee.Mihaela
    Thanks Mihaela, I am glad all is working for you now.

    Donation? Eine Portion Spaetzle bitte.....

  10. #10
    Join Date
    Nov 2007
    Location
    Sunny Coast, Australia
    Posts
    3,443
    Plugin Contributions
    9

    Default Re: Auto Store Open/Close (ASOC) - [Support Thread]

    ASOC v1.2 is now available from the downloads at https://www.zen-cart.com/downloads.php?do=file&id=1891

    This update is compatible with ZC 1.5.4 and ZC 1.5.5

    Changes:

    - Updated file YOUR_ADMIN/auto_store_open_close.php
    - Added file init_admin_auth.php to folder YOUR_ADMIN/includes/init_includes/overrides/ with modifications
    - Added extra styling to stylesheet.css

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Hebrew Support - new release [Support Thread]
    By eranariel in forum Addon Language Packs
    Replies: 12
    Last Post: 9 Oct 2019, 09:32 PM
  2. Replies: 1
    Last Post: 16 Feb 2011, 07:46 AM
  3. Temporarily close store
    By scottb in forum General Questions
    Replies: 10
    Last Post: 14 Jul 2007, 05:20 AM
  4. Failed to open thread?
    By tison in forum General Questions
    Replies: 2
    Last Post: 6 Dec 2006, 03:57 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