나는 카트 내용을 pdf 파일로 인쇄하고 다운로드해야합니다.PRESTASHOP에서 PDF 출력으로 장바구니 내용을 만드는 방법
내가 pdfinvoicecontroller.php를 사용하여 몇 가지 코드를 시도해야
내가 새로운 컨트롤러 만든-
클래스 CartprintControllerCore은을 FrontController 확장 컨트롤러/앞/CartprintController.php을 { 보호 $의 display_header = 거짓; 보호 된 $ display_footer = false;
public $content_only = true; protected $template; public $filename; public function postProcess() { if (!$this->context->customer->isLogged() && !Tools::getValue('secure_key')) Tools::redirect('index.php?controller=authentication&back=cartprint'); } public function display() { $displayproducts = $this->context->cart->getProducts(); $pdf = new PDF($displayproducts, PDF::TEMPLATE_INVOICE_CART, $this->context->smarty, $this->context->language->id); $pdf->render(); } public function getTemplate() { $template = _PS_THEME_PDF_DIR_.'/cartprint.tpl'; return $template; } }
추가
const를 TEMPLATE_INVOICE_CART = 'Cartprint'; 클래스/PDF로
라인/PDF.php는
3. 그 다음은 내가 만든 PDF에서 HTML 템플릿 파일/cartprint.tpl
<table id="cart_summary" class="std">
<thead>
<tr>
<th class="cart_product first_item">{l s='Product'}</th>
<th class="cart_description item">{l s='Description'}</th>
<th class="cart_unit item">{l s='Unit price'}</th>
<th class="cart_quantity item">{l s='Qty'}</th>
<th class="cart_total item">{l s='Total'}</th>
</tr>
</thead>
{foreach $displayproducts item=prodpef name=prodpef }
<tr>
<td class="cart_product first_item">{$prodpef.name}</td>
<td class="cart_description item">{$prodpef.description_short}</td>
<td class="cart_unit item">{$prodpef.price}</td>>
<td class="cart_quantity item">{$prodpef.cart_quantity}</td>>
<td class="cart_total item">{$prodpef.total}</td>>
</tr>
{/foreach}
</table>
4.in 쇼핑 카트 페이지를 만들었 링크
<a href="{$link->getPageLink('cartprint', true, NULL)}" title="{l s='Invoice'}" class="_blank"><img src="{$img_dir}icon/pdf.gif" alt="{l s='Invoice'}" class="icon" /></a>
그러나 여전히 나는 pdf 출력을 얻지 못하고있다.
어떤 도움?