您好 Magento 专家,
我开发了一个Magento Extension
运行良好的Version 1.6 and 1.7
,但是当我安装它时Version 1.5
,它给了我一个错误:
Fatal error: Call to a member function getData() on a non-object in /home/broadcas/public_html/app/code/community/Gwb/Magecrmsync/controllers/Adminhtml/OrdersController.php on line 18
下面是我的OrderController.php
代码。
<?php
class Gwb_Magecrmsync_Adminhtml_OrdersController extends Mage_Adminhtml_Controller_Action
{
public function indexAction()
{
$model = Mage::getModel('sales/order');
$collection = $model->getCollection()
->addFieldToFilter('status', array("in" => array('complete','closed','pending','holded','payment_review','pending_payment','pending_paypal','processing')));
$data = array();
$orderArr = array();
// getting order details
$records = 0;
foreach($collection as $order)
{
$data[$records]['order_data']['shipping_address'] = $order->getShippingAddress()->getData(); // get shipping details
$data[$records]['order_data']['billing_address'] = $order->getBillingAddress()->getData(); // get billing details
$data[$records]['order_data']['order_total'] = $order->getGrandTotal(); // get total amount
$data[$records]['order_data']['shipping_amount'] = $order->getShippingAmount();
$data[$records]['order_data']['order_details'] = $order->toArray();
$records++;
}
// getting order details
}
}
谁能指导我我做错了什么,这不起作用Version 1.5
。
任何帮助,将不胜感激。
谢谢