Opencart 致命错误:在第795行的D:\xampp\htdocs\ramesh\project1\dealer\admin\controller\sale\order.php中调用null上的成员函数calculate()

Opencart 致命错误:在第795行的D:\xampp\htdocs\ramesh\project1\dealer\admin\controller\sale\order.php中调用null上的成员函数calculate(),opencart,price,Opencart,Price,我正在为产品创建自定义总计。我正在使用这个代码 $customerGroupId=$_COOKIE['customerGroupId']; if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) { $priceOld = $new

我正在为产品创建自定义总计。我正在使用这个代码

$customerGroupId=$_COOKIE['customerGroupId'];

if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) 
{
    $priceOld = $newPrice;
    if($customerGroupId==25||$customerGroupId==0||$customerGroupId==26) 
    {
        $total1 = $this->getPriceListForGhee($product['name'], $priceOld, $product['types'], $product['quantity']);
    }
    else
    {
        $total1 = $this->getPriceList($product['name'], $priceOld, $product['types'], $product['quantity']);
    }
        $total=$this->currency->format($this->tax->calculate($total1, $product['tax_class_id'], $this->config->get('config_tax')));
}
else
{
    $total = false;
}
但我有一些错误,比如

致命错误:在第795行的D:\xampp\htdocs\ramesh\project1\dealer\admin\controller\sale\order.php中调用null上的成员函数calculate()


如何解决此错误…?

如果您希望在管理路径中获取产品的总计,则可以使用以下代码实现您的:

$total = $this->currency->format($product['total'], $currency_code, $currency_value);

当然,您必须指定自己的
$currency\u code
$currency\u value

您是否加载了税务模型?不,我不确定您是否可以帮助我..?但此代码正在工作
$total=$this->currency->format($total1,$product['tax\u class\u id',$this->config->get('config\u tax')似乎税务只存在于控制器前面。不是管理员路径。这里是remove
calculate
function
$total=$this->currency->format($total1,$product['tax\u class\u id',$this->config->get('config\u tax')它是一样的,对吧..?不完全一样。因为参数不同