`
hudeyong926
  • 浏览: 2017272 次
  • 来自: 武汉
社区版块
存档分类
最新评论

Magento Shell

 
阅读更多

在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即可

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics