我收到错误当我从magento根文件getstoredata.php调用模型函数时,调用boolean getstoredata.php 上的成员函数getStores()。 请检查以下文件并帮助找出我的错误。
getstoredata.php。
<?php
define('MAGENTOROOT', realpath(dirname(__FILE__)));
require_once(MAGENTOROOT.'/app/Mage.php');
Mage::app()->cleanCache();
flush();
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$model= Mage::getModel('fulfillment/processorders');
$data = $model->getStores();
print_r($data);
config.xml中
<?xml version="1.0" encoding="utf-8" ?>
<config>
<modules>
<Test_Fulfillment>
<version>0.1.2</version>
</Test_Fulfillment>
</modules>
<global>
<models>
<fulfillment>
<class>Test_Fulfillment_Model</class>
<resourceModel>fulfillment_mysql4</resourceModel>
</fulfillment>
<fulfillment_mysql4>
<class>Test_Fulfillment_Model_Mysql4</class>
<entities>
<clearpathparcel>
<table>test_fulfillment_clearpathparcel</table>
</clearpathparcel>
</entities>
</fulfillment_mysql4>
</models>
</global>
</config>
Processorders.php
class Test_Fulfillment_Model_ProcessOrders extends Test_Fulfillment_Model_Abstract {
protected $_orderStatusXml = null;
protected function getStores() {
$stores = array();
$stores[] = Mage::getModel('core/store')->load('dunkin_recognition')->getId();
$stores[] = Mage::getModel('core/store')->load('baskinrobbins')->getId();
$stores[] = Mage::getModel('core/store')->load('spotify')->getId();
$stores[] = Mage::getModel('core/store')->load('duffandphelps_inv')->getId();
$stores[] = Mage::getModel('core/store')->load('amex')->getId();
$stores[] = Mage::getModel('core/store')->load('ab')->getId();
$stores[] = Mage::getModel('core/store')->load('jackson_hewitt')->getId();
return $stores;
}
答案 0 :(得分:0)
请将受保护的内容更改为公开。如果将函数声明为protected,则不能在类外调用protected函数。