opencart中的豪华礼券不会在前端显示图像

时间:2017-11-30 17:30:11

标签: php html opencart

我正在网站http://www.lemongrasshouse.com.au/上工作但肯定没有显示礼品券名称后的http://www.lemongrasshouse.com.au/index.php?route=account/voucher拇指图像。我正在使用插件http://tlecode.com/deluxe_voucher 任何人都可以帮我解决问题 谢谢 Somdeb

1 个答案:

答案 0 :(得分:0)

您需要编辑这两个文件,打开控制器文件:

catalog\controller\account\voucher.php

<强>查找

$data['voucher_themes'] = $this->model_extension_total_voucher_theme->getVoucherThemes();

替换为:

    $data['voucher_themes'] = array();
    $results = $this->model_extension_total_voucher_theme->getVoucherThemes();

    $this->load->model('tool/image');
    foreach($results as $result){
        if($result['image']){
            $image = $this->model_tool_image->resize($result['image'], 50, 50);
            // Or use your custom size instead of 50
        } else {
            $image = false;
        }
        $data['voucher_themes'][] = array(
            'voucher_theme_id' => $result['voucher_theme_id'],
            'name' => $result['name'],
            'image' => $image
        );
    }

然后打开视图文件:

catalog\view\theme\{YOUR_THEME}\template\account\voucher.twig

<强>查找

<input type="radio" name="voucher_theme_id" value="{{ voucher_theme.voucher_theme_id }}" checked="checked" />

<input type="radio" name="voucher_theme_id" value="{{ voucher_theme.voucher_theme_id }}" />

在他们之后添加:

{% if voucher_theme.image %}
    <img src="{{ voucher_theme.image }}" alt="{{ voucher_theme.name }}" class="img-thumbnail" />
{% endif %}

保存文件并清除缓存(ocmod,vqmod,twig缓存)。