Hi,
1. What you can try is to add the line:
<?php $this->options['edit_address'] = (!empty($this->cart_addresses['data']) ? key($this->cart_addresses['data']) : true); ?>
at the beginning of the show_block_address view file via the menu Display>Views.
That will force the address block to always be in edit mode with either the first address of the customer in edit mode or a new address if the customer doesn't have any addresses. Hopefully, it should still allow the user to proceed to the next step.
To do the display/hidding of the fields based on a different type of custom field poses two problems:
- You need to add custom javascript to the page to hide/display the address fields based on the order field, and you still have the issue of what happens when an address is already there and the user doesn't edit it.
- If, among the fields you hide, you have required fields, that will still be enforced by the server side. So that would require extra development.
2. You need to add PHP code to it. Same as is done by default for the telephone field:
<?php if(!empty($this->address->address_telephone)) echo JText::sprintf('TELEPHONE_IN_ADDRESS','{address_telephone}');?>
That code will display the text of the TELEPHONE_IN_ADDRESS and the tag address_telephone only if there is something in the address_telephone field.
So if you want to check the type of the address, you could change the condition to be $this->address->address_type == 'shipping' instead of !empty($this->address->address_telephone)