2
<?php

ini_set('max_execution_time', 93600);
ini_set('memory_limit', '4096M'); 

require str_replace('importers', '', dirname(__FILE__)) . 'app/Mage.php';

error_reporting(E_ALL);
ini_set('display_errors', 1);

try {

$app = Mage::app('default');
    $toDate = date('Y-m-d H:i:s',strtotime('now'));
    $fromDate = date('Y-m-d H:i:s', strtotime('-100 days'));

 $orders = Mage::getModel('sales/order')->getCollection();

echo $orders->getSelect();
//print_r($orders);

}  catch (Exception $e) {
    Mage::printException($e);
    echo "Some Error Occurred";
}
0

The problem lies in the following line of code:

require str_replace('importers', '', dirname(__FILE__)) . 'app/Mage.php';

Please try to use the below code:

<?php
ini_set('max_execution_time', 93600);
ini_set('memory_limit', '4096M'); 

define('MAGENTO_ROOT', getcwd());
require MAGENTO_ROOT . '/app/Mage.php';

error_reporting(E_ALL);
ini_set('display_errors', 1);

try {

$app = Mage::app('default');
    $toDate = date('Y-m-d H:i:s',strtotime('now'));
    $fromDate = date('Y-m-d H:i:s', strtotime('-100 days'));

 $orders = Mage::getModel('sales/order')->getCollection();

echo $orders->getSelect();
//print_r($orders);

}  catch (Exception $e) {
    Mage::printException($e);
    echo "Some Error Occurred";
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.