Magento:致命错误:在第432行上的app \ Mage.php中的非对象上调用成员函数getModelInstance() [英] Magento: Fatal error: Call to a member function getModelInstance() on a non-object in app\Mage.php on line 432

查看:109
本文介绍了Magento:致命错误:在第432行上的app \ Mage.php中的非对象上调用成员函数getModelInstance()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用ajax调用PHP文件,在该PHP中,我将通过ajax调用下订单.但是当我使用该文件中的app/Mage.php时会抛出错误

I want to call a PHP file using ajax where in that PHP i will place order by the ajax call. But it throws error while i am using app/Mage.php from that file

require_once '../../../../../../../../../../app/Mage.php';    
$customer = Mage::getModel('customer/customer');

然后说

致命错误:在对象上调用成员函数getModelInstance() 第432行上的app \ Mage.php中的非对象

Fatal error: Call to a member function getModelInstance() on a non-object in app\Mage.php on line 432

任何人都可以帮助我吗?

Can anyone please help me???

推荐答案

您提出的解决方案不是最佳的.您尚未初始化Magento,因此模块XML尚未加载,并且工厂模式不起作用.

Your proposed solution is not optimal. You have not initialized Magento so module XML is not loaded yet and the factory pattern does not work.

只需使用其中之一:

Mage::init(); // 1.5+ 

Mage::app(); // (pretty much anything) below 1.5

在使用getModel之前.

before using getModel.

这篇关于Magento:致命错误:在第432行上的app \ Mage.php中的非对象上调用成员函数getModelInstance()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆