Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
cronjob中的Magento存储id_Magento_Parameters_Cron_Store - Fatal编程技术网

cronjob中的Magento存储id

cronjob中的Magento存储id,magento,parameters,cron,store,Magento,Parameters,Cron,Store,在使用cronjob执行模型时,是否有方法将存储id作为参数指定?您不能为Magento Cron Job指定存储范围,但可以添加可在其中使用的其他参数 指定可以通过cron方法处理的其他节点: <crontab> <jobs> <job_name> <schedule> <cron_expr>* * * * * *</cron_expr>

在使用cronjob执行模型时,是否有方法将存储id作为参数指定?

您不能为Magento Cron Job指定存储范围,但可以添加可在其中使用的其他参数

  • 指定可以通过cron方法处理的其他节点:

    <crontab>
       <jobs>
           <job_name>
               <schedule>
                   <cron_expr>* * * * * *</cron_expr>     
               </schedule>
               <run>
                   <model>module/observer::myJob</model>
               </run>
               <store>store_code</store>
           </job_name>
       </jobs>
    </crontab>
    

  • 所有与商店相关的模型都只能加载特定商店的数据,因此我希望它能解决您的问题。

    答案很老,但我还是会尝试……Magento 1.7,$schedule for me为空。您使用的是哪个版本?有什么提示吗?检查mysql中的cron_schedule表,它有条目吗?M2的过程是什么?
    public function myJob($schedule) 
    {
        $jobsRoot = Mage::getConfig()->getNode('crontab/jobs');
        $jobConfig = $jobsRoot->{$schedule->getJobCode()};
        $yourStoreNode = (string) $jobConfig->store;
    
        // Here goes store related functionality
    }