Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Primary Mailing Address in addition to a Primary Shipping Address

Primary Mailing Address in addition to a Primary Shipping Address

Locked

Views: 3,028

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
23 Feb 2009, 7:42 AM
#1
southpacific avatar

southpacific

New Zenner

Join Date:
Feb 2009
Location:
Sydney, Australia
Posts:
44
Plugin Contributions:
0

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

<?php echo zen_address_label($_SESSION['customer_id'], $_SESSION['customer_default_address_id'], true, ' ', '<br />'); ?>

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 customer*s*]).

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.
23 Feb 2009, 12:02 PM
#2
southpacific avatar

southpacific

New Zenner

Join Date:
Feb 2009
Location:
Sydney, Australia
Posts:
44
Plugin Contributions:
0

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
$_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
<?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
  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.

3 Mar 2009, 10:11 PM
#3
southpacific avatar

southpacific

New Zenner

Join Date:
Feb 2009
Location:
Sydney, Australia
Posts:
44
Plugin Contributions:
0

Re: Primary Mailing Address in addition to a Primary Shipping Address

Does anyone have any suggestions?

Thanks