Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Archived

This topic is now archived and is closed to further replies.

marymae

Province abbreviation

Recommended Posts

I am using OSC 2.2.RC2. I found how to abbreviate the states, but it does not affect the province for international countries. My province and country shows as example Queensland Australia. I need it to show QLD Austraila. I need the abbreviation for provinces. The database already shows the zone abbreviations for provinces. Can someone please help. I have been looking and trying so many different ways to achieve this for 3 months now. I just cannot find anything.

Share this post


Link to post
Share on other sites

Anyone? I would appreciate a little help please. I'm desperate.

MaryMae

Share this post


Link to post
Share on other sites

Hello @marymae,

 

It would be easier to help if you gave exact samples of what you already changed and where you wish to change it.

 

I'll try to guess then what you need.

If you have a look in your database table "zones", you'll see that the zone name used now ( Queensland) is the column " zone_name ".

In the files you wish to change it, for example "create_account.php", you just need to search for "zone_name " and change it to " zone_code".

You'll need to change it in the database queries and also in the menu content definition.

Example in "create_account.php:

.......................
            $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)$country . "' order by zone_name");
            while ($zones_values = tep_db_fetch_array($zones_query)) {
              $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
            }

........................

Same in all other pages where you wish to change it.

 

Hope this helps

Rgds
Rainer

Share this post


Link to post
Share on other sites

I appreciate your help. I am trying to change it in admin orders only. I tried your method but it did not work for me. I get states abbreviated but provinces disappear.

MaryMae

Share this post


Link to post
Share on other sites

Go to Admin -> Locations/Taxes -> Zones and change the names from the long version to the abbreviations.


osCommerce user since 2003! :thumbsup:

Share this post


Link to post
Share on other sites
4 hours ago, frankl said:

Go to Admin -> Locations/Taxes -> Zones and change the names from the long version to the abbreviations.

@frankl, this would be a tedious job if she has a lot of states filled in. Anyway as she told us now that she only wants it changed in admin/orders.php, it won't do it.

 

5 hours ago, marymae said:

I appreciate your help. I am trying to change it in admin orders only. I tried your method but it did not work for me. I get states abbreviated but provinces disappear.

MaryMae

@marymae,

Then it is totally different. In admin/orders.php the addresses are retieved form the orders table via orders class.

In the orders table there is only the long name availble as it was registered during the checkout process. The state abbreviation is not stored there.

So you would need to modify your orders class: admin/includes/classes/orders.php:

Find the orders query fetch:

      $order = tep_db_fetch_array($order_query);

Just below add 3 additional queries to get the abbreviation.

Something like : "select zone_code from zones where zone_name = $order['customers_state']"

That's not the correct code, just conceptual what to do.

Then the same for delivery address and billing address.

Then you would need to check if the results are not empty (for the case a custom state name has been introduced and no zone is available).

Then define variables with your query result (if not empty) or with $order['customers_state'].

Then further on where the arrays are defined:

      $this->customer = array('id' => $order['customers_id'],
                              'name' => $order['customers_name'],
                              'company' => $order['customers_company'],
                              'street_address' => $order['customers_street_address'],
                              'suburb' => $order['customers_suburb'],
                              'city' => $order['customers_city'],
                              'postcode' => $order['customers_postcode'],
                              'state' => $order['customers_state'],
                              'country' => array('title' => $order['customers_country']),
                              'format_id' => $order['customers_address_format_id'],
                              'telephone' => $order['customers_telephone'],
                              'email_address' => $order['customers_email_address']);

change "$order['customers_state']" to your variable(s). Same for the delivery and billing array.

If you can't get this done you can always post in the commercial support.

 

rgds

Rainer

Share this post


Link to post
Share on other sites

×