Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2017
    Location
    Raleigh, NC, United States
    Posts
    73
    Plugin Contributions
    0

    Default Time setting for ENABLE_DISABLED_UPCOMING_PRODUCT

    I've been manually doing preorders and came across the ENABLE_DISABLED_UPCOMING_PRODUCT setting in Configuration - Stock. That probably makes an item go online at midnight. Is there a way to use this to go online at noon my timezone? That would be super handy because preorders sometimes slow down my store and setting enabled manually is a pain.

  2. #2
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,845
    Plugin Contributions
    11

    Default Re: Time setting for ENABLE_DISABLED_UPCOMING_PRODUCT

    Quote Originally Posted by wcbutler View Post
    I've been manually doing preorders and came across the ENABLE_DISABLED_UPCOMING_PRODUCT setting in Configuration - Stock. That probably makes an item go online at midnight. Is there a way to use this to go online at noon my timezone? That would be super handy because preorders sometimes slow down my store and setting enabled manually is a pain.
    there is no way to do it without modifying the zc core code.

    it looks like one could set up a cron job to handle it, ignoring that setting.

    if you do not know how to set up a cron job to do this task, perhaps someone else can help; else you could hire one of the developers on this board to set it up for you.

    best.
    author of square Webpay.
    mxWorks now has Apple Pay and Google Pay. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  3. #3
    Join Date
    Sep 2017
    Location
    Raleigh, NC, United States
    Posts
    73
    Plugin Contributions
    0

    Default Re: Time setting for ENABLE_DISABLED_UPCOMING_PRODUCT

    Quote Originally Posted by carlwhat View Post
    there is no way to do it without modifying the zc core code.

    it looks like one could set up a cron job to handle it, ignoring that setting.

    if you do not know how to set up a cron job to do this task, perhaps someone else can help; else you could hire one of the developers on this board to set it up for you.

    best.
    I'm a sys admin by day so I'm familiar with cron jobs in general, I'll research how to set this up and see if that will help, I appreciate you pointing me in the right direction.

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,292
    Plugin Contributions
    125

    Default Re: Time setting for ENABLE_DISABLED_UPCOMING_PRODUCT

    There is no timer associated with ENABLE_DISABLED_UPCOMING_PRODUCT. It fires once per session in includes/init_includes/init_special_funcs.php. Anytime someone starts using your cart, this logic fires, and as long as it's after 00:00 on the day the product is scheduled to go enabled, it goes enabled.

    The date check is done in includes/functions/functions_products.php and you could add a time check if you wanted to. Are you sure it's worth the added complexity? Guess it depends on your business.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  5. #5
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,845
    Plugin Contributions
    11

    Default Re: Time setting for ENABLE_DISABLED_UPCOMING_PRODUCT

    Quote Originally Posted by swguy View Post
    There is no timer associated with ENABLE_DISABLED_UPCOMING_PRODUCT. It fires once per session in includes/init_includes/init_special_funcs.php. Anytime someone starts using your cart, this logic fires, and as long as it's after 00:00 on the day the product is scheduled to go enabled, it goes enabled.

    The date check is done in includes/functions/functions_products.php and you could add a time check if you wanted to. Are you sure it's worth the added complexity? Guess it depends on your business.
    really?

    the whole point of a cronjob is to be able to run it at the specific time one wants.

    this thing is not that complex.

    here you go, free code:

    turn ENABLE_DISABLED_UPCOMING_PRODUCT to manual.

    create a file in your store root called something like cronUpcomingProducts.php

    add a cron job at your specified time. something like:

    /usr/local/bin/php /var/www/myStoreRoot/cronUpcomingProducts.php > /home/myUser/UpcomingProducts.log

    (you can figure out the times and days).

    use the following code in your new file:

    Code:
    #!/usr/bin/php
    <?php
    
        $is_browser = (isset($_SERVER['HTTP_HOST']) || PHP_SAPI !== 'cli');
        if ($is_browser && isset($_SERVER["REMOTE_ADDR"]) && $_SERVER["REMOTE_ADDR"] !== $_SERVER["SERVER_ADDR"]) {
            echo ' ERROR: Permission denied.';
            exit(1);
        };
    
        $baseDir = dirname(__FILE__);
    
        $_SERVER['REQUEST_URI'] = 'cronUpcomingProducts';
        $_SERVER['REMOTE_ADDR'] = 'localhost';
        $_SERVER['HTTP_HOST'] = 'localhost';
    
        chdir($baseDir);
    
        require $baseDir . '/includes/application_top.php';
    
        zen_enable_disabled_upcoming();
    done.

    hope that helps. not too complex. no changing of zc core code.
    author of square Webpay.
    mxWorks now has Apple Pay and Google Pay. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  6. #6
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,292
    Plugin Contributions
    125

    Default Re: Time setting for ENABLE_DISABLED_UPCOMING_PRODUCT

    You still have to edit includes/init_includes/init_special_funcs.php to remove the call to zen_enable_disabled_upcoming() or any visitor who happens along before noon will enable the disabled products which are set to the current day.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  7. #7
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,845
    Plugin Contributions
    11

    Default Re: Time setting for ENABLE_DISABLED_UPCOMING_PRODUCT

    Quote Originally Posted by swguy View Post
    You still have to edit includes/init_includes/init_special_funcs.php to remove the call to zen_enable_disabled_upcoming() or any visitor who happens along before noon will enable the disabled products which are set to the current day.
    i do not believe that is correct. the call of that function is controlled by a config value. as previously stated above:

    Quote Originally Posted by carlwhat View Post
    turn ENABLE_DISABLED_UPCOMING_PRODUCT to manual.
    from: includes/init_includes/init_special_funcs.php

    Code:
        if (defined('ENABLE_DISABLED_UPCOMING_PRODUCT') && ENABLE_DISABLED_UPCOMING_PRODUCT == 'Automatic') {
            zen_enable_disabled_upcoming();
        }
    best.
    author of square Webpay.
    mxWorks now has Apple Pay and Google Pay. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  8. #8
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,292
    Plugin Contributions
    125

    Default Re: Time setting for ENABLE_DISABLED_UPCOMING_PRODUCT

    I see your point - I had overlooked this:

    > turn ENABLE_DISABLED_UPCOMING_PRODUCT to manual.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

 

 

Similar Threads

  1. v157 setting time zone
    By travbacon in forum General Questions
    Replies: 9
    Last Post: 2 Oct 2021, 05:59 PM
  2. v150 Salemaker Time Setting?
    By Brian Anderson in forum Setting Up Specials and SaleMaker
    Replies: 0
    Last Post: 3 Nov 2012, 02:30 AM
  3. Setting Time Zone
    By axl23 in forum General Questions
    Replies: 2
    Last Post: 16 Dec 2006, 06:04 AM
  4. setting up shipping for the first time
    By sonicparke in forum Addon Shipping Modules
    Replies: 1
    Last Post: 29 Sep 2006, 11:19 PM
  5. Setting Up Zen Cart For The First Time
    By KaliKid in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 16 Aug 2006, 12:14 AM

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