Jump to content

[SOLVED] Get correct delivery state


Recommended Posts

Hi to all,

in this row I get the iso code of Billing Address Country:

$fattura_invoice->appendChild($domtree->createElement('CustomerProvince', $state->iso_code));

I need to do the same thing but with Shipping Address Country

I tried to add code like this: 

$fattura_invoice->appendChild($domtree->createElement('DeliveryProvince', $delivery_address->state->iso_code));

Whats wrong?

Thanks to all

Edited by d.iandoli75 (see edit history)

Share this post


Link to post
Share on other sites

I found a mistake in the lines and I Solved.

here below the code BEFORE the solution:

if (!empty($delivery_address->id_state)){
                $state = new State($ga->id_state); // deve cercare l'indirizzo nel delivery_address
                $fattura_invoice->appendChild($domtree->createElement('DeliveryProvince', $state->iso_code));

here the code AFTER the solution:

if (!empty($delivery_address->id_state)){
                $state = new State($delivery_address->id_state); // deve cercare l'indirizzo nel delivery_address
                $fattura_invoice->appendChild($domtree->createElement('DeliveryProvince', $state->iso_code));

My snippet was checking the Object State in the wrong instance.

hope this helps someone

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More