Post by B.G » Thu Jan 04, 2018 10:32 pm

hello
i made pdf.php file in /controller/checkout/

Code: Select all

<?php
    class ControllerCheckoutPdf extends Controller {
	public function index() {
	
	    require_once(DIR_SYSTEM . '/library/mpdf/vendor/autoload.php'); // Include mdpf
     
                $html = '<div id="pdf-content">  Content to display </div>';
                $mpdf = new mPDF('utf-8', 'A4-P');
               
                $mpdf->SetHTMLHeader('<div class="pdf-header"><img class="left" src="image/catalog/logos/logo.png"/> </div>');                    
                $mpdf->SetHTMLFooter('<div class="pdf-footer" align="right"> </div> <div style="font-size:90%">Footer</div>'); 

                $mpdf->WriteHTML($html);
                $mpdf->Output(); 
	}  
}	

	?>
made button in cart.tpl

Code: Select all

<div><a href="<?php echo $pdf; ?>" class="btn btn-default"><?php echo $text_pdf; ?></a>
everything works but

i want to make pdf with Shopping Cart items like invoice to download from Shopping Cart without login

B.G
Newbie

Posts

Joined
Fri Dec 22, 2017 5:59 pm

Post by straightlight » Fri Jan 05, 2018 6:00 am

The $data['pdf'] and $data['text_pdf'] would also need to be defined in your controller in order to use $pdf and $text_pdf in your theme file. In v3.x releases, the $data['text_pdf'] does not entirely required to be defined but just in case.

The most generated errors being found on Opencart forum originates from contributed programming.

Regards,
Straightlight


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 7 guests