Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Shipping - State not showing correctly


Recommended Posts

Hi all, in v2.3.4.1 CE BS I have selected Address Format: 2  for Australia and when I log in as a customer and go to address book the address presents correctly

Alex xxx
1 test st
Aldinga Beach, SA 5173
Australia

But on the invoice and in admin it is giving me the full state name IE instead of SA is giving South Australia, instead of VIC is giving Victoria. The issue with this is it won't fit our normal address label template

Alex xxx
1 test st
Aldinga Beach, South Australia 5173
Australia

How can I correct this??

Link to comment
Share on other sites

  • Replies 57
  • Created
  • Last Reply

Order address formats are recorded when the order is placed so if you've changed it since then it won't be affected.

What about on a new order? If so, then it's not being recorded correctly when the order is created. This could be in your payment modules or in checkout_process (or in a combination depending).

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

Hmm time for a  dig into the data. In the order record there are three fields

customers_address_format_id, delivery_address_format_id, billing_address_format_id

check if they are getting set to the correct value.

They aren't called the same thing when your code is accessing them though, because when the order class is used to gather the data it rearranges it, loading it up into three address arrays so when the pages access the order, these fields become

$order->customer['format_id'], $order->delivery['format_id'], $order->billing['format_id']

If the data in the database doesn't have the right values for the format ids, then something in the checkout processing is breaking it. If the order data is ok then my first stop would be checking the order class (substitute an unmodified version of the file if you've changed it and see what happens).

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

Not sure on how to check the above but on a fresh install of Frozen same issue...

Customer address books looks like this

image.png.f320292c924afd7648e68d8d82084ac8.pngBut after placing an order,  order history gives me image.png.311a97b762497dd76c4eb52a5c2db124.png

I have a fresh install of phoenix I will go test it

Link to comment
Share on other sites

So looking at the sql command to add the zones is appears address box is showing the zone_code but invoice and admin side is showing zone_name so where do I change the code to change it from zone_name to zone_code??

INSERT INTO zones (zone_id, zone_country_id, zone_code, zone_name) VALUES
(1, 13, 'VIC', 'Victoria'),
(2, 13, 'NSW', 'New South Wales'),
(3, 13, 'QLD', 'Queensland'),

 

Link to comment
Share on other sites

If you want SA and not South Australia, this is in the addon that you have to change the Autralia_Zones.sql file :

Lines 49 to 59 :

-- Add Australian states
DELETE FROM zones;
INSERT INTO zones (zone_id, zone_country_id, zone_code, zone_name) VALUES
(1, 13, 'VIC', 'Victoria'),
(2, 13, 'NSW', 'New South Wales'),
(3, 13, 'QLD', 'Queensland'),
(4, 13, 'SA', 'South Australia'),
(5, 13, 'NT', 'Northern Territory'),
(6, 13, 'TAS', 'Tasmania'),
(7, 13, 'ACT', 'Australian Capital Territory'),
(8, 13, 'WA', 'Western Australia');

to :

-- Add Australian states
DELETE FROM zones;
INSERT INTO zones (zone_id, zone_country_id, zone_code, zone_name) VALUES
(1, 13, 'VIC', 'VIC'),
(2, 13, 'NSW', 'NSW'),
(3, 13, 'QLD', 'QLD'),
(4, 13, 'SA', 'SA'),
(5, 13, 'NT', 'NT'),
(6, 13, 'TAS', 'TAS'),
(7, 13, 'ACT', 'ACT'),
(8, 13, 'WA', 'WA');

 

with OsC 2.2 since 2006 ...

Link to comment
Share on other sites

10 minutes ago, bonbec said:

If you want SA and not South Australia, this is in the addon that you have to change the Autralia_Zones.sql file :

agreed because the order class has

'state' => ((tep_not_null($customer_address['entry_state'])) ? $customer_address['entry_state'] : $customer_address['zone_name']),
'state' => ((tep_not_null($shipping_address['entry_state'])) ? $shipping_address['entry_state'] : $shipping_address['zone_name']),
'state' => ((tep_not_null($billing_address['entry_state'])) ? $billing_address['entry_state'] : $billing_address['zone_name']),

you don't want to be changing the code as that would affect all countries.

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

So can't I just change order class from zone_name to zone_code?

'state' => ((tep_not_null($customer_address['entry_state'])) ? $customer_address['entry_state'] : $customer_address['zone_code']),

 

Link to comment
Share on other sites

yes but you would also need to change the queries and remember the changes for any updates much easier to alter the table entries as given by bonbec

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

So either have everything not look right or just use another layout which is not 100% correct for Australia PosT

image.png.9e7e6c0b1d0af228df03fc85b17a6cb1.png   Which of course will change the SA to South Australia and still fit our labeler

Still frustrating... but you get that I guess

Link to comment
Share on other sites

you can add a layout that suites your needs and set Australia to use that layout in the table address format and set table countries entry for Australia to use that new address format

so if new format is id 6 set country Australia to use address_format_id 6 but still much easier to change the zone table as bonbec stated

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

@241 Thats the issue I have played with the address format and it looks correct and as needed in the customers address book and all the way threw check out but look at the order after it has been submitted and it has changed zone_code to zone_name and gives the long version of the state, this is also the format given in admin

I think this a coding bug / error that effects all versions - but oh well I will put up with it

 

Link to comment
Share on other sites

did you change the zone names as bonbec suggested.

It's not a bug my client wanted UK instead of United Kingdom so I changed the zone in the table from United Kingdom to UK

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

Nah not going down that avenue as it affects the customers side and just look crap...

I will stick with the below not 100% correct layout that will fit on our label, I was hoping it would be a simple fix as I had some time to address it
But I will let this go

image.png.b9dec1e304475b9c17ad069b501ec1e4.png

 

Link to comment
Share on other sites

so it is only the admin side that you want the changes made to order.php and invoice.php that way it still looks nice up front.

then the changes would be for orders.php and invoice.php governed by

tep_address_format($order->customer['format_id'], $order->billing, 1, '', '<br />');
tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br />');

 

 

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

@JcMagpie when you created the address the State would have been SA which is how it should be on the invoice and address label.

But as you have found if you then go to order history it has expanded SA to South Australia so in address book it is using  zone_code but then uses zone_name.

One would have thought you should be able to set the layout correctly in the database for each country as not all use zone_code ie New Zealand uses zone_name. I see this as a flaw / bug in osc

If you create an account with New Zealand as the country it shows incorrectly (zone_code) in address book and correctly in order history and admin (zone_name)

So due to the flip flop from address book to order history and admin means for one to be right the other has to be wrong

@241 Playing with this also does not make a difference, If I go the other way and set the format id for Australia to 1 the state displays correctly in address book but again is expanded in order history and the admin side

As said I have given up and will let his go... as it's the same in all versions frozen and phoenix...

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...