opencart 编辑 download.php 出现错误

opencart editing download.php get error

我无法真正找到我的问题的直接答案,而且当我几乎 99% 确定我已正确添加所有内容时,我无法弄清楚为什么会返回错误。也许新鲜的眼睛会有所帮助。

问题:

我正在尝试向 table 添加一个新列以显示所有已添加的下载,但我收到此错误并且无法弄清楚原因。我正在尝试查看下载是否已附加到产品。

错误:

Fatal error: Call to undefined function isUsed() in /customers/b/4/a/athomestudios.net/httpd.www/admin/controller/catalog/download.php on line 178 

controller/catalog/download.php:

foreach ($results as $result) {
        $data['downloads'][] = array(
            'download_id' => $result['download_id'],
            'name'        => $result['name'],
            'used'        => isUsed($result['download_id']),
            'date_added'  => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
            'edit'        => $this->url->link('catalog/download/edit', 'token=' . $this->session->data['token'] . '&download_id=' . $result['download_id'] . $url, 'SSL')
        );
    }

model/catalog/download.php:

public function isUsed($download_id) {
    $query = $this->db->query("SELECT COUNT(*) as `total` FROM " . DB_PREFIX . "product_to_download WHERE download_id = '" . (int)$download_id . "'");

    return $query->row['total'];
}

view/template/catalog/download_list.php:

<?php foreach ($downloads as $download) { ?>
            <tr>
              <td class="text-center"><?php if (in_array($download['download_id'], $selected)) { ?>
                <input type="checkbox" name="selected[]" value="<?php echo $download['download_id']; ?>" checked="checked" />
                <?php } else { ?>
                <input type="checkbox" name="selected[]" value="<?php echo $download['download_id']; ?>" />
                <?php } ?></td>
              <td class="text-left"><?php echo $download['name']; ?></td>
              <td class="text-center">
                  <?php 
                    if ($download['used'] == 0) {
                        echo 'No';
                    }else{
                        echo 'Yes';
                    }
                  ?>
              </td>
              <td class="text-right"><?php echo $download['date_added']; ?></td>
              <td class="text-right"><a href="<?php echo $download['edit']; ?>" data-toggle="tooltip" title="<?php echo $button_edit; ?>" class="btn btn-primary"><i class="fa fa-pencil"></i></a></td>
            </tr>
            <?php } ?>

如@Fred -ii- 所述,添加数据库连接字符串。

foreach ($results as $result) {
    $data['downloads'][] = array(
        'download_id' => $result['download_id'],
        'name'        => $result['name'],
        'used'        => $this->model_catalog_download->isUsed($result['download_id']),
        'date_added'  => date($this->language->get('date_format_short'), strtotime($result['date_added'])),
        'edit'        => $this->url->link('catalog/download/edit', 'token=' . $this->session->data['token'] . '&download_id=' . $result['download_id'] . $url, 'SSL')
    );
}