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.

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

报告相同问题?

悬赏问题

  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应