Jump to content

add variable to the override/classes


Rissinko

Recommended Posts

Hi, i am really confused about how to add variable to the class.
 
I need to add variale "$orderstatus" to the classes/pdf/HTMLTemplateInvoice.php to the __construct.
 
so i did this :
- created HTMLTemplateInvoice.php in override/classes/pdf/
and put in this :
 
class HTMLTemplateInvoice extends HTMLTemplateInvoiceCore {
fasdsdfsd
     public function __construct(OrderInvoice $order_invoice, $smarty, $bulk_mode = false) {
        
        $orderstatus = $this->order->current_state;
        $this->smarty->assign(array( 
            'orderstatus' => $orderstatus,
        ));
        parent::__construct(OrderInvoice $order_invoice, $smarty, $bulk_mode);
     }

}

I know that there is something wrong in it but i cant find what.

 

 

Thanks for help.

 

Link to comment
Share on other sites

  • 4 weeks later...

hmm I tried it use like this ... 

<?php

class HTMLTemplateInvoice extends HTMLTemplateInvoiceCore {

     public function __construct(OrderInvoice $order_invoice, $smarty, $bulk_mode = false) {
        parent::__construct();
        $orderstatus = $this->order->current_state;
        $this->smarty->assign(array( 
            'orderstatus' => $orderstatus,
        ));

     }

}

and i Got this error from overrided file

Fatal error: Call to a member function getInvoiceNumberFormatted() on a non-object in /public_html/classes/pdf/HTMLTemplateInvoice.php on line 59

Any suggestions ?? :(

Edited by Rissinko (see edit history)
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...