Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2006
    Posts
    107
    Plugin Contributions
    0

    Default Address Formats...Where do they apply?

    I think I must be missing something obvious.

    Under Locations/Taxes--->Countries, you can select whichever Address Format you want (1-6) or create a new one for each country. I understand this part fine.
    But why are the invoices and packing slips unaffected by the specific address format you set?

    I tried formats 1-7 (including one of my own) but the invoices look the same with each address format.

  2. #2
    Join Date
    Nov 2003
    Posts
    1,987
    Plugin Contributions
    15

    Default Re: Address Formats...Where do they apply?

    It only affects invoices and packing slips created after you change the setting. Not the existing ones.

    (I remember banging my head against the wall over the same issue once ;-) )

  3. #3
    Join Date
    Oct 2006
    Posts
    107
    Plugin Contributions
    0

    Default Re: Address Formats...Where do they apply?

    Thanks Paul, I appreciate it.

    Would you or anyone else know how to specify the state abbreviations in the United States when creating a new address format?

    For example, California displays as California, but our Postal Service wants us to use two-letter codes like CA instead.

    Code:
    INSERT INTO address_format 
    (address_format, address_summary) 
    VALUES ('$firstname $lastname$cr$streets$cr$city, $state $postcode',
    '$city, $state $postcode');
    $state is displaying full state names, not abbreviations.
    Last edited by absoluteblock; 30 Jan 2007 at 12:09 PM.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Address Formats...Where do they apply?

    Is this only a concern for the invoices and packing slips printed from the Admin area ?
    .

    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.

  5. #5
    Join Date
    Oct 2006
    Posts
    107
    Plugin Contributions
    0

    Default Re: Address Formats...Where do they apply?

    Quote Originally Posted by DrByte View Post
    Is this only a concern for the invoices and packing slips printed from the Admin area ?
    Yes. I've noticed that in other places, the state's abbreviation is used. This isn't the case for invoices and packing slips.

  6. #6
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Address Formats...Where do they apply?

    Try this:

    /admin/includes/functions/general.php
    insert this before line 491:
    Code:
            $zone_query = "select zone_code
                           from " . TABLE_ZONES . " z 
                           left join " . TABLE_COUNTRIES . " c on c.countries_id = z.zone_country_id
                           where zone_name = '" . $address['state'] . "'";
            $zone = $db->Execute($zone_query);
            if ($zone->RecordCount() > 0 ) $state = $zone->fields['zone_code'];
    Thus it'll look like this (starting from 479:
    Code:
        if (isset($address['country_id']) && zen_not_null($address['country_id'])) {
          $country = zen_get_country_name($address['country_id']);
    
          if (isset($address['zone_id']) && zen_not_null($address['zone_id'])) {
            $state = zen_get_zone_code($address['country_id'], $address['zone_id'], $state);
          }
        } elseif (isset($address['country']) && zen_not_null($address['country'])) {
          if (is_array($address['country'])) {
            $country = zen_output_string_protected($address['country']['countries_name']);
          } else {
            $country = zen_output_string_protected($address['country']);
          }
            $zone_query = "select zone_code
                           from " . TABLE_ZONES . " z 
                           left join " . TABLE_COUNTRIES . " c on c.countries_id = z.zone_country_id
                           where zone_name = '" . $address['state'] . "'";
            $zone = $db->Execute($zone_query);
            if ($zone->RecordCount() > 0 ) $state = $zone->fields['zone_code'];
        } else {
          $country = '';
        }
        $postcode = zen_output_string_protected($address['postcode']);
        $zip = $postcode;

    Do similarly to
    /includes/functions/functions_customers.php
    insert on line 67, making it look like this (quoted from 55 onward):
    Code:
        if (isset($address['country_id']) && zen_not_null($address['country_id'])) {
          $country = zen_get_country_name($address['country_id']);
    
          if (isset($address['zone_id']) && zen_not_null($address['zone_id'])) {
            $state = zen_get_zone_code($address['country_id'], $address['zone_id'], $state);
          }
        } elseif (isset($address['country']) && zen_not_null($address['country'])) {
          if (is_array($address['country'])) {
            $country = zen_output_string_protected($address['country']['countries_name']);
          } else {
            $country = zen_output_string_protected($address['country']);
          }
          $zone_query = "select zone_code
                         from " . TABLE_ZONES . " z 
                         left join " . TABLE_COUNTRIES . " c on c.countries_id = z.zone_country_id
                         where zone_name = '" . $address['state'] . "'";
          $zone = $db->Execute($zone_query);
          if ($zone->RecordCount() > 0) $state = $zone->fields['zone_code'];
        } else {
          $country = '';
        }
    .

    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.

 

 

Similar Threads

  1. v153 Where are they?
    By maperr55 in forum General Questions
    Replies: 3
    Last Post: 24 Nov 2014, 04:10 AM
  2. v151 Address Formats eval Allows for arbitrary code execution
    By robryan in forum Bug Reports
    Replies: 0
    Last Post: 7 Mar 2013, 03:56 AM
  3. Where Did They Go????
    By Jaygee74 in forum General Questions
    Replies: 8
    Last Post: 22 Nov 2007, 05:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg