ComGrafPL Posted January 22 Share Posted January 22 Hello, Any tips, how to add a customer VAT ( NIP ) number to invoice {$invoice_address}? Tried old guides from 1.6 with no luck. Also to remove customer name and phone number from {$invoice_address} Thanks. PS: @ps8moduly.cz Link to comment Share on other sites More sharing options...
ps8modules Posted January 23 Share Posted January 23 (edited) Hi @ComGrafPL There's nothing wrong with that. You're a programmer and you can't handle such a simple task 🙂 All you have to do is create ./override/classes/pdf/HTMLTemplateInvoice.php and add your own function to show/hide parts of the address. For example PrestaShop 8.x: public function customInvoiceAddress( $address, $showCompany = true, $showLastname = false, $showFirstname = false, $showAddress1 = true, $showAddress2 = true, $showPostcode = true, $showCity = true, $showOther = false, $showPhone = false, $showPhoneMobile = false, $showDniNumber = false, $showVatNumber = false, $showCountry = true ) { if ($showLastname == false) { unset($address->lastname); } if ($showFirstname == false) { unset($address->firstname); } if ($showCompany == false) { unset($address->company); } if ($showVatNumber == false) { unset($address->vat_number); } if ($showDniNumber == false) { unset($address->dni); } if ($showAddress1 == false) { unset($address->address1); } if ($showAddress2 == false) { unset($address->address2); } if ($showPostcode == false) { unset($address->postcode); } if ($showCity == false) { unset($address->city); } if ($showOther == false) { unset($address->other); } if ($showPhone == false) { unset($address->phone); } if ($showPhoneMobile == false) { unset($address->phone_mobile); } if ($address) { return $address; } } and you copy the getContent() function from the original and change $formatted_invoice_address: $formatted_invoice_address = AddressFormat::generateAddress( $this->customInvoiceAddress($invoice_address, true, false, false, true, false, true, true, false, false, false, false, true, true), $invoiceAddressPatternRules, '<br />', ' ' ); Similarly, you can change the delivery address, or change the first function. Full override file PrestaShop 8.x (after override Clear cache): HTMLTemplateInvoice.zip Edited January 23 by ps8moduly.cz (see edit history) 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now