1

我有一个外观“CustomMage”,但我无法从中包含 magento api。

<?php namespace Bond\CustomMage;

class CustomMage {

    /* Using mage configurations*/
    public static function changeIsActive($table, $id, $status){  
        $api_path = \Config::get('api.mage_soap_api_path');
        require_once("{$api_path}app/Mage.php");

        /*umask(0);
        Mage::app('default');
        $quote = Mage::getModel('sales/quote')->load($id);
        $quote->setIsActive($status)->save();*/
    }   

}

我收到这个错误,

[2018-02-07 08:47:09] local.ERROR: 异常 'ErrorException' 带有消息 'include(Bond\CustomMage\Mage.php): 无法打开流:/var/www 中没有这样的文件或目录/html/FootballTicketPad/ecomm/lib/Varien/Autoload.php:93

但是如果我在 app/helpers.php 中使用这段代码就可以了。

function GetModal($table, $id){ 
    $api_path = \Config::get('api.mage_soap_api_path');
    require_once("{$api_path}app/Mage.php");
    umask(0);
    Mage::app('default');       
    return Mage::getModel($table)->load($id);
}
4

0 回答 0