在后台中的generateList()中显示图像

时间:2019-02-13 16:29:16

标签: prestashop prestashop-1.6

我想通过后台的助手功能显示图像。在documentation中,您可以添加以下内容:

    ['image'] => 's',                              // If set, an image will be displayed in this field located in the '/img' subfolder defined as value here (optional).
    ['image_id'] => 3,                             // If 'image' is set abd if 'image_id' is set, it will be used as the image filename,
                                                   // else the record item id will be used (optional)

我尝试用添加HTML替换内容列表,显然这并不漂亮,并且不起作用。

public function renderBanners()
{
     $fields_list = array(
        'id_product' => array(
            'title' => $this->l('Id product'),
            'type' => 'text',
            'orderby' => true,
        ),
        'id_category' => array(
            'title' => $this->l('Id category'),
            'type' => 'text',
            'orderby' => false,
        ),
        'image_desktop' => array(
            'title' => $this->l('Image desktop'),
            'type' => 'image',
            'image' => $this->name
        ),
        'image_mobile' => array(
            'title' => $this->l('Image mobile'),
            'type' => 'text',
        ),
        'from_date' => array(
            'title' => $this->l('From date'),
            'type' => 'text',
            'orderby' => false,
        ),
        'to_date' => array(
            'title' => $this->l('To date'),
            'type' => 'text',
            'orderby' => false,
        ),
        'active' => array(
            'title' => $this->l('active'),
            'type' => 'text',
            'orderby' => false,
        ),
    );
    $helper = new HelperList();
    $helper->shopLinkType = '';
    $helper->no_link = true;
    $helper->list_no_link = false;
    $helper->identifier = 'id_insanetopbanner';
    $helper->actions = array('delete', 'edit');
    $helper->show_toolbar = true;
    $helper->imageType = 'jpg';
    $helper->toolbar_btn['new'] = array(
        'href' => AdminController::$currentIndex.'&configure='.$this->name.'&addBanner&token='.Tools::getAdminTokenLite('AdminModules'),
        'desc' => $this->l('Add new')
    );
    $helper->title = $this->l('Banners');
    $helper->table = $this->name;
    $helper->token = Tools::getAdminTokenLite('AdminModules');
    $helper->currentIndex = AdminController::$currentIndex . '&configure=' . $this->name;
    $list_content = $this->getListContent();
    $helper->listTotal = count($list_content);
    return $helper->generateList($list_content, $fields_list);
}

我想使用本地的PrestaShop代码在后台的列表中显示图像。

0 个答案:

没有答案