Jump to content

Override default invoice generator by my own (PS 1.6)


pitrrs

Recommended Posts

 

Create a new file as /override/classes/pdf/PDFGenerator.php and put some method(s) inside the brackets.

 

class PDFGenerator extends PDFGeneratorCore
{

} 

 

Hi,

 

thanks for your reply. 

 

Okay and how in this class i get order details (customer detail, shop details(name etc.), seller detail, Products...)? 

Link to comment
Share on other sites

I need this:

 

ignore original PDF invoice generator and use my own class for PDF invoice generation. In my invoice generator i need use get order details.

 

I do not use HTML templating like PS. I have other solution. 

Link to comment
Share on other sites

  • 10 months later...

Hello guys   :) 

Why am i not able to override PDFGenerator.php file?

 

Under "Override/classes/pdf/" i have created the same file, which is PDFGenerator.php. Within that file i have put code below, because i want to define different header and footer height. The problem is, that override doesn't work at all, even if i disable cache and delete class_index.php file within cache directory. What am i doing wrong? Is there maybe a bug or something?

<?php

class PDFGeneratorCoreOverride extends PDFGeneratorCore {

    /* Header and Footer HEIGHT change */
    public function writePage() {
        
        $this->SetHeaderMargin(10);
        $this->SetFooterMargin(30);
        $this->setMargins(10, 40, 10);

        $this->AddPage();

        $this->writeHTML($this->content, true, false, true, false, '');
    }
    
} 

I am using Prestashop version 1.6.0.14.

 

If i change code directly, it affects PDF, when it is exported. It works as it should but no results, when overriding PDFGenerator.php file. Overriding works good for modules as well.

Could you guys take a look and help me here please?

Thank you and best regards,
Housy

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...