Forums / General Questions / address format different on checkout page vs address book

address format different on checkout page vs address book

Locked

Views: 2,913

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
27 Mar 2009, 5:52 PM
#1
ladyhypnotist avatar

ladyhypnotist

New Zenner

Join Date:
Sep 2008
Posts:
21
Plugin Contributions:
0

address format different on checkout page vs address book

Zen Cart 1.3.8a from clean install.

The address formats are different on the address book page vs the change shipping or change billing address pages.

On the address book page, they are displaying in the correct format (address_format_id 2 for US addresses, etc from the address_format table). But when checking out, on the change shipping or change billing address pages, these same addresses are all displaying with a format of 1 no matter the country.

The files tpl_modules_checkout_address_book.php and tpl_address_book_default.php have not been changed from the original install.

Why is the checkout address book not displaying the address in the proper format?

I'm not an expert at php, but this is what I see in those files.

In tpl_address_book_default.php, the code that displays the addresses in the correct format:```

<?php /** * Used to loop thru and display address book entries */ foreach ($addressArray as $addresses) { ?> <h3 class="addressBookDefaultName"><?php echo zen_output_string_protected($addresses['firstname'] . ' ' . $addresses['lastname']); ?><?php if ($addresses['address_book_id'] == $_SESSION['customer_default_address_id']) echo ' ' . PRIMARY_ADDRESS ; ?></h3> <address><?php echo zen_address_format($addresses['format_id'], $addresses['address'], true, ' ', '<br />'); ?></address> <div class="buttonRow forward"><?php echo '<a href="' . zen_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'edit=' . $addresses['address_book_id'], 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_EDIT_SMALL, BUTTON_EDIT_SMALL_ALT) . '</a> <a href="' . zen_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'delete=' . $addresses['address_book_id'], 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_DELETE_SMALL, BUTTON_DELETE_SMALL_ALT) . '</a>'; ?></div> <br class="clearBoth" /> <?php } ?> ``` In the code for the file tpl_modules_checkout_address_book.php, which is not displaying the addresses correctly:``` <?php /** * require code to get address book details */ require(DIR_WS_MODULES . zen_get_module_directory('checkout_address_book.php')); ?> <?php while (!$addresses->EOF) { if ($addresses->fields['address_book_id'] == $_SESSION['sendto']) { echo ' <div id="defaultSelected" class="moduleRowSelected">' . "\n"; } else { echo ' <div class="moduleRow">' . "\n"; } ?>
    <div class="back"><?php echo zen_draw_radio_field('address', $addresses->fields['address_book_id'], ($addresses->fields['address_book_id'] == $_SESSION['sendto']), 'id="name-' . $addresses->fields['address_book_id'] . '"'); ?></div>
    <div class="back"><label for="name-<?php echo $addresses->fields['address_book_id']; ?>"><?php echo zen_output_string_protected($addresses->fields['firstname'] . ' ' . $addresses->fields['lastname']); ?></label></div>
  </div>
  <br class="clearBoth" />
   <address><?php echo zen_address_format($format_id, $addresses->fields, true, ' ', '<br />'); ?></address>
<?php $addresses->MoveNext(); } ?>
Again, these files are the same as the original install files. How can I make the checkout addresses display in the correct format?

Thanks!
Melissa
14 May 2009, 8:38 PM
#2
drbyte avatar

drbyte

Sensei

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

Re: address format different on checkout page vs address book

ladyhypnotist:

In the code for the file tpl_modules_checkout_address_book.php, which is not displaying the addresses correctly:```
<address><?php echo zen_address_format([B]$format_id[/B], $addresses->fields, true, ' ', '<br />'); ?></address>

What if you change $format_id, as shown?:
<address><?php echo zen_address_format([B]zen_get_address_format_id($addresses->fields['country_id'])[/B], $addresses->fields, true, ' ', '<br />'); ?></address> ```

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

22 May 2009, 3:13 PM
#3
ladyhypnotist avatar

ladyhypnotist

New Zenner

Join Date:
Sep 2008
Posts:
21
Plugin Contributions:
0

Re: address format different on checkout page vs address book

I changed the code as you suggested, and it fixed it the problem with the addresses not formatting with the correct country format. Thanks!