#LOCAL("BasketID",#ID) #LOCAL("BasketShippingAddress",#ShippingAddress) #IF(NOT #DEFINED(#BasketShippingAddress))#SET("BasketShippingAddress",#User.ShippingAddress)#ENDIF #IF(NOT #DEFINED(#BasketShippingAddress))#SET("BasketShippingAddress",#User.BillingAddress)#ENDIF #LOCAL("AddressNo",0) #LOCAL("BillingAddressFormErrorVisible", 0) #LOCAL("ShippingAddressFormErrorVisible", 0) #LOOP(#User.Addresses) #IF(#FormErrors.Reason.BILLINGADDRESS_REGISTRATION_SET AND #User.BillingAddress.ID == #ID AND NOT #BillingAddressFormErrorVisible)

{BillingAddressRegistrationSetTestFails} {ChangeAddress}

#SET("BillingAddressFormErrorVisible", 1) #ENDIF #IF(#FormErrors.Reason.SHIPPINGADDRESS_REGISTRATION_SET AND (#User.BillingAddress.ID != #ID OR NOT #DEFINED(#User.ShippingAddress)) AND NOT #ShippingAddressFormErrorVisible)

{ShippingAddressRegistrationSetTestFails} {ChangeAddress}

#SET("ShippingAddressFormErrorVisible", 1) #ENDIF
#IF(#User.BillingAddress.ID == #ID) {BillingAddress}#ELSE#SET("AddressNo", #AddressNo+1){ShippingAddress} #AddressNo #ENDIF
#FUNCTION("LocaleInclude", "Address", #Country.Code2) #IF(#EMail)
#EMail #MENU("AdditionalFormElements")#INCLUDE(#Template)#ENDMENU #ENDIF
{ChangeAddress}

#ENDLOOP #ENDLOCAL#ENDLOCAL#ENDLOCAL#ENDLOCAL#ENDLOCAL
#IF(#Session.SessionID) #ENDIF {NewAddress}