News:

Looking for documentation? Take a look on our wiki

Main Menu

Ship-to address formatting bug

Started by David, September 20, 2017, 13:11:49 PM

Previous topic - Next topic

David

In components\com_virtuemart\views\cart\tmpl\default_address.php, the following code displays the ship-to address:

foreach ($this->cart->STaddress['fields'] as $item) {

if($item['name']=='shipto_address_type_name') continue;
if (!empty($item['value'])) {
?>
<!-- <span class="titles"><?php echo $item['title'?></span> -->
<?php
if ($item['name'] == 'first_name' || $item['name'] == 'middle_name' || $item['name'] == 'zip') {
?>

<span class="values<?php echo '-' $item['name'?>"><?php echo $item['value'?></span>
<?php } else { ?>
<span class="values"><?php echo $item['value'?></span>
<br class="clear"/>
<?php
}
}
}


The if condition is never met, because $item['name'] could be 'shipto_first_name', but never 'first_name' - the same applies to middle_name and zip. That's why ship-to address looks so ugly in checkout.
Hence, the first step to remedy is replace 'first_name' with 'shipto_first_name' etc. Then the address look better, but full name and zip-city combination is reverse compared to bill-to address. I am not a PHP programmer - can anyone advice a code which would output things as first name + middle name + surname and zip + city?
Joomla 3.8.3, VirtueMart 3.4.2