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

后端 未结 5 826
感情败类
感情败类 2020-12-20 18:50

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

         


        
5条回答
  •  半阙折子戏
    2020-12-20 19:35

    You should initialize the Magento Framework first:

    /* Store or website code */
    $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
    
    /* Run store or run website */
    $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
    
    Mage::init($mageRunCode, $mageRunType, array());
    

提交回复
热议问题