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:
Code:
<?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:
Code:
<?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
Bookmarks