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.
Re: Time setting for ENABLE_DISABLED_UPCOMING_PRODUCT
Quote:
Originally Posted by
wcbutler
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.
Re: Time setting for ENABLE_DISABLED_UPCOMING_PRODUCT
Quote:
Originally Posted by
carlwhat
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.
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.
Re: Time setting for ENABLE_DISABLED_UPCOMING_PRODUCT
Quote:
Originally Posted by
swguy
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.
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.
Re: Time setting for ENABLE_DISABLED_UPCOMING_PRODUCT
Quote:
Originally Posted by
swguy
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
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.
Re: Time setting for ENABLE_DISABLED_UPCOMING_PRODUCT
I see your point - I had overlooked this:
> turn ENABLE_DISABLED_UPCOMING_PRODUCT to manual.