Primary Mailing Address in addition to a Primary Shipping Address
I am trying to create an add-on which allows customers to identify their primary "mailing address" in addition to their primary "shipping address".
I think I am getting the hang of things, I have added an extra field in the customers table called customers_default_postal_id. It has a number which collates to the address I want in the address book just the same as customer_default_address_id (ie. an Address ID of the corresponding address related to the customer in the address_book table)
When identifying this in the address_book.php, I just can't seem to work out how the command
PHP Code:
<?php echo zen_address_label($_SESSION['customer_id'], $_SESSION['customer_default_address_id'], true, ' ', '<br />'); ?>
uses the data from the field "customers_default_address_id" in the customers table, to display on the page (address_book.php)
I know that the field in the customer table is called customers_default_address_id but in the command line above it uses customer_default_address_id (ie with no "s" after customers]).
Please excuse me if this sounds ignorant but how does this work? How does the page recognize that the session 'customer_default_address_id' uses the data from the field customers_default_address_id in the customers table.
Thank you in advance for any help or ideas.
Re: Primary Mailing Address in addition to a Primary Shipping Address
I figured it out an addition needs to be made in ../pages/login/header_php.php
around line 87.
I added:
PHP Code:
$_SESSION['customer_default_postal_id'] = $check_customer->fields['customers_default_postal_id'];
I now have an additional issue I can't seem to add a tick box next to address_book_details.php
I noticed that primary shipping address uses:
PHP Code:
<?php
if ((isset($_GET['edit']) && ($_SESSION['customer_default_address_id'] != $_GET['edit'])) || (isset($_GET['edit']) == false) ) {
?>
<?php echo zen_draw_checkbox_field('primary', 'on', false, 'id="primary"') . ' <label class="checkboxLabel" for="primary">' . SET_AS_PRIMARY . '</label>'; ?>
<?php
}
?>
so I tried:
PHP Code:
<?php
if ((isset($_GET['edit']) && ($_SESSION['customer_default_postal_id'] != $_GET['edit'])) || (isset($_GET['edit']) == false) ) {
?>
<?php echo zen_draw_checkbox_field('primary', 'on', false, 'id="primary"') . ' <label class="checkboxLabel" for="primary">' . SET_AS_PRIMARY . '</label>'; ?>
<?php
}
?>
but it didn't seem to work. Does anyone have any suggestions?
Thanks again.
Re: Primary Mailing Address in addition to a Primary Shipping Address
Does anyone have any suggestions?
Thanks