简体   繁体   English

插件使选项下拉菜单在 opencart 产品中不起作用

[英]Plugin makes options dropdown not working in opencart product

I have a problem with Option tab on Add/Edit product.添加/编辑产品上的Option卡有问题。 The problem is that when I installed the extension Autocomplete No More and when I choose Option it throws this error问题是当我安装扩展Autocomplete No More并且当我选择选项时它会抛出这个错误

Fatal error: Uncaught Error: Call to a member function getOptionData() on null in /../ocartdata/storage/modification/admin/controller/catalog/option.php:437

in option.php line 437 isoption.php第 437 行是

$option_data = $this->model_extension_catalog_autocomplete_no_more->getOptionData($this->request->post['option_id']);

And full function is this one而全function就是这个

public function getOptionData() {
    
    if (isset($this->request->post['option_id'])) {

        $this->load->language('catalog/option');            
        $this->load->model('catalog/autocomplete_no_more');         
        $this->load->model('tool/image');
        
        $option_data = $this->model_extension_catalog_autocomplete_no_more->getOptionData($this->request->post['option_id']);
                        
        $this->response->setOutput(json_encode($option_data));
    }
}

Is anyone has an idea why this throws null?有谁知道为什么这会抛出 null?

Issue:问题:

You are trying to call a method of an Object您正在尝试调用 Object 的方法

$this->model_extension_catalog_autocomplete_no_more

with the extension in the object name. object 名称中的扩展名。

but then you are loading the model without the extension in the path:但随后您正在加载 model 路径中没有扩展名

$this->load->model('catalog/autocomplete_no_more')

So obviously the Error signals that you have not yet defined this object很明显,您尚未定义此 object 的错误信号

Call to a member function getOptionData() on null

Solution:解决方案:

Fix it by adding extension to the path:通过向路径添加扩展名来修复它:

$this->load->model('extension/catalog/autocomplete_no_more')

or remove if from the object name:或从 object 名称中删除 if:

$this->model_catalog_autocomplete_no_more

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM