magento:有没有办法“运行配置文件"?与克朗? [英] magento: is there a way to "run profile" with cron?

查看:61
本文介绍了magento:有没有办法“运行配置文件"?与克朗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在magento 1.6上有一个导出配置文件,可以手动运行它(在弹出窗口中运行配置文件"),但是我需要它每天自动运行.有什么办法可以设置cron作业来做到这一点?

I have an export profile on magento 1.6 and I can run it manually ("Run profile in popup"), but I need it to run automatically every day. Is there a way to set up a cron job to do that somehow?

推荐答案

我使用了以下摘自的内容(注意:链接断开,代码复制如下):

I used the following taken from (note: broken link, code is copied below):

http://www.premasolutions.com/content /magento-dataflow-exportimport-form-命令行

<?php
//THIS SCRIPT JUST INITIALS THE PROFILE TO BE RUN VIA MAGENTO ADMIN "RUN PROFILE IN POPUP". Its the same thing as click just via this file that you can run via cron
$profileId = 8; // SYSTEM - IMPORT/EXPORT - ADVANCED PROFILES <-- you need to go into your magento admin and grab the exact profile ID
   
require_once 'app/Mage.php';
umask(0);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
  
$profile = Mage::getModel('dataflow/profile');
$userModel = Mage::getModel('admin/user');
$userModel->setUserId(0);
Mage::getSingleton('admin/session')->setUser($userModel);
$profile->load($profileId);
if (!$profile->getId()) {
    Mage::getSingleton('adminhtml/session')->addError('ERROR: Incorrect profile id');
}
  
Mage::register('current_convert_profile', $profile);
$profile->run();
$recordCount = 0;
$batchModel = Mage::getSingleton('dataflow/batch');
echo "EXPORT COMPLETE. BATCHID: " . $batchModel->getId();

它在1.5.x上正常运行(抱歉,在1.6.x上尚未测试).

It worked properly on 1.5.x (not tested yet on 1.6.x, sorry).

如果可行,只需安排一个cron作业以自动调用脚本即可.

If it works, it's only matter of scheduling a cron job to call the script automatically.

关于亚历山德罗

这篇关于magento:有没有办法“运行配置文件"?与克朗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆