在确认控制器上调用 model_tool_image 调整大小

Calling model_tool_image resize on Confirm Controller

我想要 url link 的产品图片

即时编辑 catalog/controller/checkout/confirm.php

            $data['products'][] = array(
                'cart_id'    => $product['cart_id'],
                'product_id' => $product['product_id'],
                'name'       => $product['name'],
                'model'      => $product['model'],
                'option'     => $option_data,
                'recurring'  => $recurring,
                'quantity'   => $product['quantity'],
                'subtract'   => $product['subtract'],
                'price'      => $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax'))),
                'total'      => $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')) * $product['quantity']),
                'href'       => $this->url->link('product/product', 'product_id=' . $product['product_id']),

我试着添加

'thumb'     => $this->model_tool_image->resize($product['image'], $this->config->get('config_image_related_width'), $this->config->get('config_image_related_height')),

在 checkout/confirm.tpl 调用 $product['thumb'] 后 我收到致命错误

Fatal error: Call to a member function resize() on a non-object in /var/www/xxx.dev/public_html/catalog/controller/checkout/confirm.php on line 393

我只是添加

$this->load->model('tool/image');

之后

$this->load->model('tool/upload');

在 confirm.php 控制器上