
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.
Bookmarks