在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');
    }

    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();
        }
    }

    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();

results matching ""

    No results matching ""