Thread: Cron Job

Results 1 to 10 of 20

Hybrid View

  1. #1
    Join Date
    Sep 2010
    Location
    Finland
    Posts
    59
    Plugin Contributions
    0

    Default Re: Cron Job

    Thanks for your answer.
    I try and it came error message.
    ERROR: admin/includes/configure.php file not found. Suggest running zc_install/index.php?

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

    Default Re: Cron Job

    Quote Originally Posted by Cenkki View Post
    Thanks for your answer.
    I try and it came error message.
    ERROR: admin/includes/configure.php file not found. Suggest running zc_install/index.php?
    Just noticed that you are running ZC 1.5.1 but the header of the file you posted says

    ZenCart 1.3.x > 1.3.9c
    That add on may not be compatible with your version of ZC

  3. #3
    Join Date
    Sep 2010
    Location
    Finland
    Posts
    59
    Plugin Contributions
    0

    Default Re: Cron Job

    I just need basic script, open-closed shop auto whit cron job. I found store_status.php script from zen cart forum. And i can't update version.

    and i four this otter subject of zen cart forum...

    Dr Byte's solution works well for me but I thought I'd add a little caveat which might save somebody some time.

    If you run your php program directly as a cron job it won't have the right working directory and won't find /includes/config.php so it will fail with;
    ERROR: admin/includes/configure.php file not found. Suggest running zc_install/index.php?
    To avoid this you need to tell cron to change directory before invoking PHP to run the program, so your cron command should read
    Code:
    cd "public_html/admin"; /usr/local/bin/php my_program.php
    Remember to leave a space between your path to PHP and the program name, you are invoking PHP with the program name as a parameter.

    I hope this helps someone.

  4. #4
    Join Date
    Jun 2008
    Location
    Washington, DC
    Posts
    789
    Plugin Contributions
    7

    Default Re: Cron Job

    Quote Originally Posted by Cenkki View Post
    Thanks for your answer.
    I try and it came error message.
    ERROR: admin/includes/configure.php file not found. Suggest running zc_install/index.php?
    require('includes/application_top.php'); this file loads the paths needed for configure.php

    For testing uncomment the echo commands.

    Then call the script www.xxxxxx/adminxxx/store_status.php

    After you get the script to work then setup the cron up.

    Skip
    • 446F63746F722057686F •

  5. #5
    Join Date
    Sep 2010
    Location
    Finland
    Posts
    59
    Plugin Contributions
    0

    Default Re: Cron Job

    fortunately it works.
    wget -O - www.xxxxxx/xxxxx/adminxxx/store_status.php
    add... define('CRON_ADMIN_USER_ID', '1');

    but :)

    if store status 2= Showcase with prices, it change 1= Showcase no prices
    if store status 0= Normal Store, its change 1= Showcase no prices again
    if store status 1= Showcase no prices, its not changing

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

    Default Re: Cron Job

    Quote Originally Posted by Cenkki View Post
    fortunately it works.
    wget -O - www.xxxxxx/xxxxx/adminxxx/store_status.php
    add... define('CRON_ADMIN_USER_ID', '1');

    but :)

    if store status 2= Showcase with prices, it change 1= Showcase no prices
    if store status 0= Normal Store, its change 1= Showcase no prices again
    if store status 1= Showcase no prices, its not changing
    That indicates that the script is working as per configuration:

    PHP Code:
    if ((date(H) >= $store_open) && (date(H) <= $store_close)) {
    $zen_store_stat 0// Store is Open Normal Zen Cart
    } else {
    $zen_store_stat 1// Store is Closed Showcase no Prices

    If you wanted store status = 2 then you would need to set

    PHP Code:
    $zen_store_stat 2// Store is Closed Showcase with prices 

  7. #7
    Join Date
    Sep 2010
    Location
    Finland
    Posts
    59
    Plugin Contributions
    0

    Default Re: Cron Job

    It doesn't change store status open (0), with all combination.

  8. #8
    Join Date
    Sep 2010
    Location
    Finland
    Posts
    59
    Plugin Contributions
    0

    Default Re: Cron Job

    I forget add that code also...

    admin/init_includes/init_admin_auth.php

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

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

    Default Re: Cron Job

    Quote Originally Posted by Cenkki View Post
    It doesn't change store status open (0), with all combination.
    Played with this on a local install. I changed

    PHP Code:
    if ((date(H) >= $store_open) && (date(H) <= $store_close)) { 
    to

    PHP Code:
    if ((date('H:i:s') >= $store_open) && (date('H:i:s') <= $store_close)) { 
    and it appears to work

  10. #10
    Join Date
    Sep 2010
    Location
    Finland
    Posts
    59
    Plugin Contributions
    0

    Default Re: Cron Job

    You know this work.
    Thanks

 

 

Similar Threads

  1. v154 Cron job coding
    By droidmcse in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 24 Apr 2015, 11:29 PM
  2. Cron Job to enable a EZ Page?
    By cs_jono in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 4 Jun 2010, 08:20 PM
  3. CRON job help
    By Jeff G in forum General Questions
    Replies: 10
    Last Post: 9 Oct 2008, 12:20 AM
  4. zen_mail as part of a cron job...
    By savage in forum General Questions
    Replies: 0
    Last Post: 30 Nov 2007, 06:25 PM

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