VM does not set a last_name value when a user selects a different shipping address.
When vm_order_user_info has address_type = BT all the values are filled correctly.
Where address_type = ST, title, last_name, first_name and middle_name are all NULL.
Therefore when it checks for first_name it fails, but the row contains the alternative delivery address data.
Where does your code
// if ST address is empty and should be shown always both
if ($adressType == 'both' && strlen($address['ST']->last_name) == 0) {
$address['ST'] = $address['BT'];
}
come from?
My invoicehtml.php file has
// if ST address is empty and should be shown always both
if ($adressType == 'both' && empty($address['ST']->last_name)) {
$address['ST'] = $address['BT'];
}
This only checks if
both has been selected anyway.
I have mine set to BT and ST from config so the above if statement doesn't matter, and
$address['ST'] = $this->getVMAddress('ST');
is still set and then
if (($adressType == 'ST' || $adressType == 'both') && ! empty($address['ST']->last_name))
fails as last_name = NULL.