
Originally Posted by
LightBrown
Is there a way for the shipping address box on the checkout_one page to automatically display/contain the account's shipping address (or second address in the address book) if one exists?

Originally Posted by
lat9
That's something you could add via custom programming; it's very non-standard so it's not a feature that I'll currently consider in the plugin's base processing.
In case anyone needs this in the future:
My site uses a forced COWOA feature, and the "login" page includes a field for the billing address as well as an optional shipping address field. So, if the customer chose to input a shipping address in the "login" page, when they move to the checkout_one page, there is already a sendto address in the session. So to make the checkout_one page display the shipping address I only needed to comment out a few lines of code:
includes\modules\pages\checkout_one\header.php
Code:
// if no shipping destination address was selected, use the customers own address as default
if (!isset ($_SESSION['sendto'])) {
$_SESSION['sendto'] = $_SESSION['customer_default_address_id'];
/*the following lines have been commented out to allow login page to assign a sendto address in the session
} elseif ($shipping_billing) {
$_SESSION['sendto'] = $_SESSION['billto'];
*/
} else {
// verify the selected shipping address
includes\templates\template_default\templates\tpl_checkout_one_default.php
Code:
<?php
// -----
// Display shipping-address information **only if** the order contains at least one physical product (i.e. it's not virtual).
//
if ($is_virtual_order) {
echo zen_draw_checkbox_field ('shipping_billing', '1', false, 'id="shipping_billing" style="display: none;"');
} else {
?>
<!--This section disabled to remove shippingIsBilling checkbox
<div id="checkoutOneShippingFlag" style="display: none;"><?php //echo zen_draw_checkbox_field ('shipping_billing', '1', $shipping_billing, 'id="shipping_billing" onchange="shippingIsBilling ();"');?>
<label class="checkboxLabel" for="shipping_billing"><?php //echo TEXT_USE_BILLING_FOR_SHIPPING; ?></label>
</div>
-->
<div id="checkoutOneShipto">
<fieldset>
<legend><?php echo TITLE_SHIPPING_ADDRESS; ?></legend>
<!--This section should pull the sendto address if there is one, otherwise it will repeat the billing address-->
<address><?php echo zen_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br />'); ?></address>
<div class="buttonRow forward"><?php echo '<a href="' . $editShippingButtonLink . '">' . zen_image_button (BUTTON_IMAGE_EDIT_SMALL, BUTTON_EDIT_SMALL_ALT) . '</a>'; ?></div>
</fieldset>
</div>
<?php
}
?>
I have only tested these changes with my exact setup, so your mileage may vary. Or let me know if anyone thinks these changes will break anything.
Bookmarks