Php 通过vqmod添加代码,以便在OpenCart中获取错误

Php 通过vqmod添加代码,以便在OpenCart中获取错误,php,opencart,vqmod,Php,Opencart,Vqmod,我在核心文件(catalog\controller\product\category.php)中添加了以下代码,用于优化类别图像。因此,它运行良好 但是,当这个代码通过vqmod添加时(不改变核心文件)。因此,它运行良好。但是,如果在categories页面中不可用,那么,获取错误(注意:未定义变量:…) 新增代码: $image = $this->model_tool_image->resize($result['image'], $this->config->get(

我在核心文件(catalog\controller\product\category.php)中添加了以下代码,用于优化类别图像。因此,它运行良好

但是,当这个代码通过vqmod添加时(不改变核心文件)。因此,它运行良好。但是,如果在categories页面中不可用,那么,获取错误(注意:未定义变量:…)

新增代码:

$image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));
如何修复它


谢谢。

更改添加到的代码非常简单:

    if(isset($the_varialbe_that_is_undefined)){
    //code you want to exexute
    $image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height'));
    //end   
 }
这取决于您希望它做什么,因此您需要检查正确的变量,然后调用代码,以避免出现此类错误


同样的逻辑适用于所有出现此类错误的情况。

您能帮我解决这个问题吗-