Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

[URGENT]I want to use adminhtml Controller from Cron Obeserver.. or can you help me login to admin through cron.. 
 
subesh
Sr. Member
 
Avatar
Total Posts:  145
Joined:  2009-01-08
 

Please Help ME.. I am in big problem.. :(

 
Magento Community Magento Community
Magento Community
Magento Community
 
mike222
Member
 
Total Posts:  41
Joined:  2008-04-07
Austria
 

Hi,

I did the following:

add an entry in /etc/cron.d:
32 * * * * www-data wget http://www.blu-ray-onlineshop.at/shop/externalscripts/export_customer.php >> /tmp/export.log 2>&1;create a new file /externalscripts/export_customer.php in your magento-dir:

<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/../../bluray/magento/app/Mage.php');

$toRun = new export_customer();
$toRun->export();

echo "<hr/>";
echo "<strong>Finished</strong>";

?>

create a new module app/code/local/Export/Customer.php:

<?php

class Export_Customer extends Varien_Object
{

public function export() {
Mage::app('default');
//uncomment when moved to server - to ensure this page is not accessed from anywhere else
//if ($_SERVER['REMOTE_ADDR'] !== '<your server ip address') {
// die("You are not a cron job!");
//}

$profileId = 5; //put your profile id here
$filename = 'export_customer';
$logFileName= $filename.'.log';
$recordCount = 0;

Mage::log("Export Started",null,$logFileName);

$profile = Mage::getModel('dataflow/profile');

$userModel = Mage::getModel('admin/user');
$userModel->setUserId(0);
Mage::getSingleton('admin/session')->setUser($userModel);
if ($profileId) {
$profile->load($profileId);
if (!$profile->getId()) {
Mage::getSingleton('adminhtml/session')->addError('The profile you are trying to save no longer exists');
}
}

Mage::register('current_convert_profile', $profile);

$profile->run();

echo 'Export Completed';
Mage::log("Export Completed",null,$logFileName);
}
}
?>

Hope this helps you a bit.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top