Jump to content

Change of company in invoice (according to a date)


salvadorbiedma

Recommended Posts

Hello Everybody!

 

I need to change the name of my company in the PDF invoice. The PDF invoice print me the text "Company X" but what i would like is the Next:

 

If the invoice is before March 31 2012 the Company X is right and the PDF will show this one.

 

But If the invoice is later than April 1, 2012 the system will print in the PDF Company Y.

 

Any help?

Thanks so much people!

 

Best regards from Spain.

Link to comment
Share on other sites

Hello,

 

you'll just have to create /override/classes/PDF.php modify your classes/PDF.php function Header at this part :

 


 $conf = Configuration::getMultiple(array('PS_SHOP_NAME', 'PS_SHOP_ADDR1', 'PS_SHOP_CODE', 'PS_SHOP_CITY', 'PS_SHOP_COUNTRY', 'PS_SHOP_STATE'));
 $conf['PS_SHOP_NAME'] = isset($conf['PS_SHOP_NAME']) ? Tools::iconv('utf-8', self::encoding(), $conf['PS_SHOP_NAME']) : 'Your company';
 $conf['PS_SHOP_ADDR1'] = isset($conf['PS_SHOP_ADDR1']) ? Tools::iconv('utf-8', self::encoding(), $conf['PS_SHOP_ADDR1']) : 'Your company';
 $conf['PS_SHOP_CODE'] = isset($conf['PS_SHOP_CODE']) ? Tools::iconv('utf-8', self::encoding(), $conf['PS_SHOP_CODE']) : 'Postcode';
 $conf['PS_SHOP_CITY'] = isset($conf['PS_SHOP_CITY']) ? Tools::iconv('utf-8', self::encoding(), $conf['PS_SHOP_CITY']) : 'City';
 $conf['PS_SHOP_COUNTRY'] = isset($conf['PS_SHOP_COUNTRY']) ? Tools::iconv('utf-8', self::encoding(), $conf['PS_SHOP_COUNTRY']) : 'Country';
 $conf['PS_SHOP_STATE'] = isset($conf['PS_SHOP_STATE']) ? Tools::iconv('utf-8', self::encoding(), $conf['PS_SHOP_STATE']) : '';

 

Check the invoice date (self::$order->invoice_date) : IF it's before 31st of march 2012 you define your old parameters (

$conf['PS_SHOP_NAME']="my old company"; ...

ELSE you let the code above

  • Like 1
Link to comment
Share on other sites

Hi daYmo,

 

Thanks for your help. I have created the next code. But Prestashop show me an error at the moment in that I generate the invoice.

 

   if substr($shipping_date, 4, 2) =< 4
 $this->Cell(0, 5, 'Company X','');
   else
 $this->Cell(0, 5, ' Company Y','');

 

Prestashop show me the next error:

 

Parse error: syntax error, unexpected T_STRING, expecting '(' in /home/tiendagr/public_html/classes/PDF.php on line 206

 

I work with Prestashop 1.2.5.

 

Thanks.

Best regards.

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...