2

Had a magento installation for about 10 months now, originally installed as 1.8 and been using it fine for the whole period. In december I upgraded to 1.9.1 and since this time, we have only been receiving transaction emails for orders that are paid via Credit Card. BACS and PayPal (our other payment methods) are not generating the emails.

I downloaded the exception.log and there have been no errors recorded.

I have googled and saw here that all emails in 1.9.1 have been made to use Cron. So I went to try and run the cron.php and it didn't bring any output, so I modified the try/catch to echo results to help me figure out where it was running, and the file doesn't seem to want to run and just spins and produces a blank page. So i'm lead to believe it's something to do with this.

cPanel is set with the following cron: */5 * * * * wget -O /dev/null -q http://www.domain-name.com/cron.php and this is also the location I am going too to get the blank output from cron.php

See below the contents of the cron.php file.

try {
if (stripos(PHP_OS, 'win') === false) {
    $options = getopt('m::');
    if (isset($options['m'])) {
        if ($options['m'] == 'always') {
            $cronMode = 'always';
        } elseif ($options['m'] == 'default') {
            $cronMode = 'default';
        } else {
            Mage::throwException('Unrecognized cron mode was defined');
        }
        echo "Cron Run<br />";
    } else if (!$isShellDisabled) {
        $fileName = basename(__FILE__);
        $baseDir = dirname(__FILE__);
        shell_exec("/bin/sh $baseDir/cron.sh $fileName -mdefault 1 > /dev/null 2>&1 &");
        shell_exec("/bin/sh $baseDir/cron.sh $fileName -malways 1 > /dev/null 2>&1 &");
        echo "Cron Run by Shell<br />";
        exit;
    }
}

Mage::getConfig()->init()->loadEventObservers('crontab');
Mage::app()->addEventArea('crontab');
if ($isShellDisabled) {
    Mage::dispatchEvent('always');
    Mage::dispatchEvent('default');
} else {
    Mage::dispatchEvent($cronMode);
}
echo "CronTab Run<br />";
} catch (Exception $e) {
Mage::printException($e);
exit(1);
}

I'm unsure how I can expand on my testing so that I can at least put this section of debugging to rest.

If you have any ideas why the site won't correctly send on just some payment types, then I can fix that directly and worry about cron when it's causing issues. If the above is the issue then any help on how to make it work again would be great.

Thanks for your help.

1 Answer 1

1

I modified the Cron.php file to add some code to see where it was executing up too, and when I tried to run cron.php again, it worked fine. I'm not sure if the file was corrupt or not but this was affecting it.

I tested with a fake order on a BACS payment method, and it processed and all the emails came through again, also the emails that where supposed to have been sent previously also came through.

I hope this helps anyone else that may have come across this problem.

It seems like cron.php is now used for all transactional emails, so this must be set correctly!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.