Results 1 to 8 of 8
  1. #1
    Join Date
    Mar 2010
    Posts
    4
    Plugin Contributions
    0

    Default Save US State as a initials in database instead of full name

    Hello, I Intergrated the zencart database with our Fedex and UPS software, but they can only match state with initials in it (NY, CA, etc..), but zencart saves the entire name of the state (New York, California, etc..), is there a place I can change it?

    thanks

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Save US State as a initials in database instead of full name

    Can't you map to the zone_code in the zones table?
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Mar 2010
    Posts
    4
    Plugin Contributions
    0

    Default Re: Save US State as a initials in database instead of full name

    it doesn't work like this, it wants to have this info in delevery_state field

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Save US State as a initials in database instead of full name

    You would have to customize the orders class to use a different field for the state ...

    Open the order.php class file and do a search on: state

    and you can see how it is currently being applied and if you look for where you can change it to the countries_iso_code_2 instead ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Mar 2010
    Posts
    4
    Plugin Contributions
    0

    Default Re: Save US State as a initials in database instead of full name

    would you be so kind and tell me if that is correct change for it?



    iso_code_2' => $shipping_address->fields['countries_iso_code_2'],

    to

    iso_code_2' => $shipping_address->fields['countries_name'],

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Save US State as a initials in database instead of full name

    You need to add the zone_code on the select for shipping:
    Code:
        $shipping_address_query = "select ab.entry_firstname, ab.entry_lastname, ab.entry_company,
                                        ab.entry_street_address, ab.entry_suburb, ab.entry_postcode,
                                        ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id,
                                        c.countries_id, c.countries_name, c.countries_iso_code_2,
                                        c.countries_iso_code_3, c.address_format_id, ab.entry_state,
                                        z.zone_code
                                       from " . TABLE_ADDRESS_BOOK . " ab
                                       left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id)
                                       left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id)
                                       where ab.customers_id = '" . (int)$_SESSION['customer_id'] . "'
                                       and ab.address_book_id = '" . (int)$_SESSION['sendto'] . "'";
    The you can try to use it on the build of the delivery:
    Code:
        $this->delivery = array('firstname' => $shipping_address->fields['entry_firstname'],
                                'lastname' => $shipping_address->fields['entry_lastname'],
                                'company' => $shipping_address->fields['entry_company'],
                                'street_address' => $shipping_address->fields['entry_street_address'],
                                'suburb' => $shipping_address->fields['entry_suburb'],
                                'city' => $shipping_address->fields['entry_city'],
                                'postcode' => $shipping_address->fields['entry_postcode'],
                                'state' => ((zen_not_null($shipping_address->fields['zone_code'])) ? $shipping_address->fields['zone_code'] : $shipping_address->fields['zone_name']),
                                'zone_id' => $shipping_address->fields['entry_zone_id'],
                                'country' => array('id' => $shipping_address->fields['countries_id'], 'title' => $shipping_address->fields['countries_name'], 'iso_code_2' => $shipping_address->fields['countries_iso_code_2'], 'iso_code_3' => $shipping_address->fields['countries_iso_code_3']),
                                'country_id' => $shipping_address->fields['entry_country_id'],
                                'format_id' => (int)$shipping_address->fields['address_format_id']);
    And test if this can work for you ...

    I have not tested it on everything so you really want to test this change ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  7. #7
    Join Date
    Mar 2010
    Posts
    4
    Plugin Contributions
    0

    Default Re: Save US State as a initials in database instead of full name

    It worked, thank you very much. :)

  8. #8
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Save US State as a initials in database instead of full name

    Glad that worked for you ... be sure you do numerous tests to make sure it doesn't cause issues on other countries ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 

Similar Threads

  1. WPP uses full state name
    By djdavedawson in forum PayPal Website Payments Pro support
    Replies: 0
    Last Post: 21 Jun 2012, 09:14 PM
  2. New York State Sales Tax by Zip Full Database for Local Sales Tax Mod 2011
    By SCHNiKEN in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 0
    Last Post: 11 Apr 2011, 04:51 AM
  3. full state name passing to gspay payment module
    By teflonchest in forum Addon Payment Modules
    Replies: 1
    Last Post: 16 Oct 2009, 06:40 AM
  4. Replies: 7
    Last Post: 24 Nov 2008, 04:25 AM
  5. Takes path to old database name instead of new
    By Dave Wilson in forum Upgrading from 1.3.x to 1.3.9
    Replies: 2
    Last Post: 29 Dec 2007, 12:16 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