PrestaShop - Как создать модуль для чтения PDF? - PullRequest
0 голосов
/ 31 мая 2019

Я пытаюсь создать модуль PrestaShop для чтения PDF-файлов и их отображения.

  1. Сначала я создал модуль Hello World и подключил его
  2. Затем ясоздал новый файл класса HTMLTemplateCustomPdf extends from HTMLTemplate в папке моего модуля

Я не уверен, что будет следующим шагом?Что я должен поместить в мой custom_template_content.tpl файл?

Вот содержимое моего класса HTMLTemplateCustomPdf

<?php

class HTMLTemplateCustomPdf extends HTMLTemplate
{
    public $custom_model;

    public function __construct($custom_object, $smarty)
    {
        $this->custom_model = $custom_object;
        $this->smarty = $smarty;

        // header informations
        $id_lang = Context::getContext()->language->id;
        $this->title = HTMLTemplateCustomPdf::l('Custom Title');
        // footer informations
        $this->shop = new Shop(Context::getContext()->shop->id);
    }

    public function getContent()
    {
        $this->smarty->assign(array(
        'custom_model' => $this->custom_model,
        ));

        return $this->smarty->fetch(_PS_MODULE_DIR_ . 'my_module/custom_template_content.tpl');
    }

    public function getFilename()
    {
        return 'custom_pdf.pdf';
    }

    public function getBulkFilename()
    {
        return 'custom_pdf.pdf';
    }
}
...