0

i want to get all orders from Magento but its returning the db info not the data

class Host_Autox_OrderController extends Mage_Core_Controller_Front_Action
{
    public function indexAction(){  
        $ordersCollection = Mage::getModel('sales/order')->getCollection();
        echo "<pre>"; print_r($ordersCollection->getData());
    }


}

And here is the output

object(Mage_Sales_Model_Resource_Order_Collection)#70 (34) { ["_eventPrefix":protected]=> string(22) "sales_order_collection" ["_eventObject":protected]=> string(16) "order_collection" ["_model":protected]=> string(11) "sales/order" ["_resourceModel":protected]=> string(11) "sales/order" ["_resource":protected]=> object(Mage_Sales_Model_Resource_Order)#102 (21) { ["_eventPrefix":protected]=> string(20) "sales_order_resource" ["_eventObject":protected]=> string(8) "resource" ["_grid":protected]=> bool(true) ["_useIncrementId":protected]=> bool(true) ["_entityCodeForIncrementId":protected]=> string(5) "order" ["_useIsObjectNew":protected]=> bool(true) ["_entityTypeForIncrementId":protected]=> string(0) "" ["_virtualGridColumns":protected]=> NULL ["_gridColumns":protected]=> NULL ["_resources":protected]=> object(Mage_Core_Model_Resource)#83 (5) { ["_connectionTypes":protected]=> array(0) { } ["_connections":protected]=> array(69) { ["core_setup"]=> object(Magento_Db_Adapter_Pdo_Mysql)#38 (31) { ["_defaultStmtClass":protected]=> string(29) "Varien_Db_Statement_Pdo_Mysql" 

Something like that

Update

is there any limit to getData because its only fetching approx 1200 records after that it shows the blank page. Getting this error.

Fatal error: Unknown: Cannot use output buffering in output buffering display handlers in Unknown on line 0
2
  • How do you output the result ? What code do you use? May 18, 2017 at 11:50
  • @RaphaelatDigitalPianism var_dump($order ); also tried foreach
    – Aziz Badar
    May 18, 2017 at 11:56

2 Answers 2

0
$ordersCollection = Mage::getModel('sales/order')->getCollection();
echo "<pre>"; print_r($ordersCollection->getData());
8
  • Now page is blank, not printing anything.
    – Aziz Badar
    May 18, 2017 at 12:01
  • try uncommenting this line (#ini_set('display_errors', 1);) from the index.php present at root dir and check for any error present. May 18, 2017 at 12:05
  • that's already uncommented.
    – Aziz Badar
    May 18, 2017 at 12:06
  • show ur code please May 18, 2017 at 12:09
  • i updated my original post please check.
    – Aziz Badar
    May 18, 2017 at 12:13
0

try below code

  $ordersCollection = Mage::getModel('sales/order')->getCollection();
         echo "<pre>";
  foreach($ordersCollection as $order){
     print_r($order->getData());
  }  
2
  • is there any limit to getData because its only fetching approx 1200 records after that it shows the blank page.
    – Aziz Badar
    May 18, 2017 at 14:02
  • May be max_execution_time error increase max_execution_time from php.ini for that May 18, 2017 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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