Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Remove Customer primary address from Invoice when shipping/billing are displayed?

Remove Customer primary address from Invoice when shipping/billing are displayed?

Views: 2,279

Results 1 to 9 of 9
25 Jul 2012, 12:22 PM
#1
barendfaber avatar

barendfaber

Zen Follower

Join Date:
Apr 2010
Posts:
263
Plugin Contributions:
0

Remove Customer primary address from Invoice when shipping/billing are displayed?

Hi,

I wonder if someone can help me. I am using version 1.3.9 h. At present, when a customer purchases from us, we can auto generate the invoice. If the shipping and billing address matches, it shows on the invoice two addresses next to each other, Sold To: and Ship To:. However, in instances where the customer Billing and Shipping addresses are different, the format changes on my invoices. I will first have CUSTOMER: displaying the customer address, underneath that Sold To: and address, and next to it Ship To: and the address. How can I remove this CUSTOMER: address where the shipping and billing don't match, so all my invoices display in the same layout?

25 Jul 2012, 10:27 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Remove Customer primary address from Invoice when shipping/billing are displayed?

barendfaber:

when a customer purchases from us, we can auto generate the invoice.
Please explain what you mean by "auto generate the invoice". Is this something you've added from a plugin?

26 Jul 2012, 7:27 AM
#3
barendfaber avatar

barendfaber

Zen Follower

Join Date:
Apr 2010
Posts:
263
Plugin Contributions:
0

Re: Remove Customer primary address from Invoice when shipping/billing are displayed?

Hi DrByte,

Thank you for the reply. I just mean that when you look in Admin for Customer - Orders, there is a button (Invoice) that you can click and it opens the invoice. I have looked at my Admin folder on FTP, I have found invoice.php, there is a bit of code there a bit of code like this:

<tr> <td class="main"><b><?php echo ENTRY_CUSTOMER; ?></b></td> </tr> <tr> <td class="main"><?php echo zen_address_format($order->customer['format_id'], $order->customer, 1, '', '<br>'); ?></td> </tr> <?php } ?>

I can assume that this is to display the details for CUSTOMER?

Just underneath that there is two more, one for "php echo ENTRY_SOLD_TO" and "php echo ENTRY_SHIP_TO". I am no wizard, and just need help to know what I can remove to never display CUSTOMER if shipping and billing addresses do not match?

26 Jul 2012, 10:03 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Remove Customer primary address from Invoice when shipping/billing are displayed?

You'll need to write some custom code to handle those conditions, and wrap your if/else code around that part of the output to prevent it from displaying when you don't want it.

26 Jul 2012, 2:17 PM
#5
barendfaber avatar

barendfaber

Zen Follower

Join Date:
Apr 2010
Posts:
263
Plugin Contributions:
0

Re: Remove Customer primary address from Invoice when shipping/billing are displayed?

Hi DrByte,

Hmm, this will be above my experience level, so I will need to let go of this change. Thanks for your help though.

26 Jul 2012, 9:18 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Remove Customer primary address from Invoice when shipping/billing are displayed?

I finally had a chance to look at the code.

The code specifically checks to see if the billing and delivery address are different, and in that case it specifically displays the customer's primary address, intentionally.

If you want to bypass that safety so that you never see the customer's primary address for validation purposes, you can add a new line into the code as shown here, a couple lines above the stuff you quoted earlier:```
$show_customer = 'true';
}[B]
// ADDED HERE TO SKIP SHOWING CUSTOMER'S PRIMARY ADDRESS SO WE DON'T HAVE IT FOR VERIFICATION PURPOSES:
$show_customer = 'false';[/B]

if ($show_customer == 'true') {
?>
<tr>
<td class="main"><b><?php echo ENTRY_CUSTOMER; ?></b></td>

30 Jul 2012, 1:41 PM
#7
barendfaber avatar

barendfaber

Zen Follower

Join Date:
Apr 2010
Posts:
263
Plugin Contributions:
0

Re: Remove Customer primary address from Invoice when shipping/billing are displayed?

Hi DrByte,

Sorry for the very late reply! I took a chance just after our last correspondence and deleted this code:

<tr> <td class="main"><b><?php echo ENTRY_CUSTOMER; ?></b></td> </tr> <tr> <td class="main"><?php echo zen_address_format($order->customer['format_id'], $order->customer, 1, '', '<br>'); ?></td> </tr>

This seem to have removed the extra address, and the invoice looks good. So far no issues, let's hope it stays that way!

Kind regards

B

23 Oct 2013, 3:39 PM
#8
militaryamy avatar

militaryamy

New Zenner

Join Date:
Apr 2013
Location:
Lincolnshire
Posts:
3
Plugin Contributions:
0

Re: Remove Customer primary address from Invoice when shipping/billing are displayed?

Would it be possible to use this to move swap the addresses round or put them in a certain place. I would like to use some paper with built in labels to make despatching orders quicker but at the moment if the shipping is different it moves the shipping address about. I need it to stay in one place so I know it will end up on the address label.
Is this possible?
Thank you Amy :blink:

26 Oct 2013, 12:48 AM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: Remove Customer primary address from Invoice when shipping/billing are displayed?

Yes, you could edit the corresponding files to set a fixed output, however needed. And if "conditional" stuff like shipping address needs to "always" display, remove the IF, or add an ELSE to it so it creates an empty placeholder.