在magento/shell/下Virtualcard.php
<?php
require_once 'abstract.php';
class Mage_Shell_Virtualcard extends Mage_Shell_Abstract
{
protected function _getPool()
{
return Mage::getModel('virtualcard/pool');
}
/**
* Run script
*
*/
public function run()
{
if ($option = $this->getArg('option'))
{
switch ($option){
case 'generation':
$this->_getPool()->applyCodesGeneration();
break;
case 'updateStates':
Mage::getModel('virtualcard/cron')->updateStates();
break;
}
}else{
echo $this->usageHelp();
}
}
/**
* Retrieve Usage Help Message
*
*/
public function usageHelp()
{
return <<<USAGE
Usage: php -f virtualcard.php -- [options]
--option generation | updateStates
help This help
USAGE;
}
}
$shell = new Mage_Shell_Virtualcard();
$shell->run();
将这个文件加入crontable即可