dtrphb5597 2014-05-05 12:53
浏览 26
已采纳

代码通过vqmod添加,因此在OpenCart中获取错误

I have add below code in core file( catalog\controller\product\category.php ) for Refine categories images. So, It is working fine.

But, when, this same code add via vqmod (without change core file). So, It is working fine. But, if, not available Refine categories in categories page.So, Get error ( Notice: Undefined variable:.... )

ADDED code :

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

How to fix it?

Thanks.

  • 写回答

1条回答 默认 最新

  • douyu7210 2014-05-05 13:45
    关注

    Its quite simple actually change the code you add to:

        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   
     }
    

    It depends on what you want it to do, so you need to check the right variable,and afterwards call the code so you do not get these kind of errors.

    Same logic is applied in every case that get this kind of error.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样