Andreas von Ballmoos Posted June 5, 2020 Share Posted June 5, 2020 (edited) Dear all While having the phone number for the invoice address, it may be unwanted on the delivery address. It is printed on the invoice template right under the address and can be seen by anyone. My shop owner doesn't want this. So I try to find a solution to print the phone number for the invoice address but NOT for the delivery address. Finding so far: PS 1.7.5.0 treats an address as an address. It's format is defined in Internation - Countries. Where could I build in a switch like: IF delivery_address THEN don't print the phone number? Thanks for your support. Edited June 7, 2020 by Andreas von Ballmoos (see edit history) Link to comment Share on other sites More sharing options...
Guest Posted June 7, 2020 Share Posted June 7, 2020 (edited) Modify ./classes/HTMLTemplateInvoice.php $formatted_delivery_address or add custom address format and change $formatted_delivery_address: $data = array( 'order' => $this->order, 'order_invoice' => $this->order_invoice, 'order_details' => $order_details, 'carrier' => $carrier, 'cart_rules' => $cart_rules, 'delivery_address' => $formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, 'addresses' => array('invoice' => $invoice_address, 'delivery' => $delivery_address), 'tax_excluded_display' => $tax_excluded_display, 'display_product_images' => $display_product_images, 'layout' => $layout, 'tax_tab' => $this->getTaxTabContent(), 'customer' => $customer, 'footer' => $footer, 'ps_price_compute_precision' => _PS_PRICE_COMPUTE_PRECISION_, 'round_type' => $round_type, 'legal_free_text' => $legal_free_text, ); to custom $_address and variable $new_formatted_delivery_address: $_address = new Address((int) $this->order->id_address_delivery); $_country = Db::getInstance()->getValue('SELECT name FROM '._DB_PREFIX_.'country_lang WHERE id_country = '.$_address->id_country.' AND id_lang = '.$this->order->id_lang); $delivery_company = $_address->company; $delivery_order_name = $_address->lastname.' '.$_address->firstname; $delivery_address1 = $_address->address1; $delivery_address2 = $_address->address2; $delivery_postcode = $_address->postcode; $delivery_city = $_address->city; $delivery_other = $_address->other; $delivery_vat = $_address->vat_number; $delivery_dni = $_address->dni; $country_name = $_country; $is_company = ''; if ($delivery_company) {$is_company = $delivery_company.'<br />'.$delivery_vat.'<br />';} $new_formatted_delivery_address = $delivery_order_name.'<br />'.$is_company.$delivery_address1.'<br />'.$delivery_address2.'<br />'.$delivery_postcode.' '.$delivery_city.'<br />'.$country_name.'<br />'; $data = array( 'order' => $this->order, 'order_invoice' => $this->order_invoice, 'order_details' => $order_details, 'carrier' => $carrier, 'cart_rules' => $cart_rules, 'delivery_address' => $new_formatted_delivery_address, 'invoice_address' => $formatted_invoice_address, 'addresses' => array('invoice' => $invoice_address, 'delivery' => $delivery_address), 'tax_excluded_display' => $tax_excluded_display, 'display_product_images' => $display_product_images, 'layout' => $layout, 'tax_tab' => $this->getTaxTabContent(), 'customer' => $customer, 'footer' => $footer, 'ps_price_compute_precision' => _PS_PRICE_COMPUTE_PRECISION_, 'round_type' => $round_type, 'legal_free_text' => $legal_free_text, ); Edited June 7, 2020 by Guest (see edit history) Link to comment Share on other sites More sharing options...
Guest Posted June 7, 2020 Share Posted June 7, 2020 (edited) You can do the same with your invoice address. Added $new_formated_invoice_address. $new_formated_invoice_address = $new_formated_delivery_address; if ($this->order->id_address_invoice == $this->order->id_address_delivery) {$new_formated_invoice_address = $formatted_invoice_address;} full code for delivery and invoice address: $_address = new Address((int) $this->order->id_address_delivery); $_country = Db::getInstance()->getValue('SELECT name FROM '._DB_PREFIX_.'country_lang WHERE id_country = '.$_address->id_country.' AND id_lang = '.$this->order->id_lang); $delivery_company = $_address->company; $delivery_order_name = $_address->lastname.' '.$_address->firstname; $delivery_address1 = $_address->address1; $delivery_address2 = $_address->address2; $delivery_postcode = $_address->postcode; $delivery_city = $_address->city; $delivery_other = $_address->other; $delivery_vat = $_address->vat_number; $delivery_dni = $_address->dni; $country_name = $_country; $is_company = ''; if ($delivery_company) {$is_company = $delivery_company.'<br />'.$delivery_vat.'<br />';} $new_formatted_delivery_address = $delivery_order_name.'<br />'.$is_company.$delivery_address1.'<br />'.$delivery_address2.'<br />'.$delivery_postcode.' '.$delivery_city.'<br />'.$country_name; $new_formated_invoice_address = $new_formated_delivery_address; if ($this->order->id_address_invoice == $this->order->id_address_delivery) {$new_formated_invoice_address = $formatted_invoice_address;} $data = array( 'order' => $this->order, 'order_invoice' => $this->order_invoice, 'order_details' => $order_details, 'carrier' => $carrier, 'cart_rules' => $cart_rules, 'delivery_address' => $new_formatted_delivery_address, 'invoice_address' => $new_formated_invoice_address, 'addresses' => array('invoice' => $invoice_address, 'delivery' => $delivery_address), 'tax_excluded_display' => $tax_excluded_display, 'display_product_images' => $display_product_images, 'layout' => $layout, 'tax_tab' => $this->getTaxTabContent(), 'customer' => $customer, 'footer' => $footer, 'ps_price_compute_precision' => _PS_PRICE_COMPUTE_PRECISION_, 'round_type' => $round_type, 'legal_free_text' => $legal_free_text, ); Edited June 7, 2020 by Guest (see edit history) Link to comment Share on other sites More sharing options...
Andreas von Ballmoos Posted June 7, 2020 Author Share Posted June 7, 2020 Great - thanks! Link to comment Share on other sites More sharing options...
Guest Posted June 7, 2020 Share Posted June 7, 2020 I gladly helped. You can like my posts. Click on the gray heart below my posts. If the topic is solved, you can change the first post and write SOLVED in the topic name. 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