Support the VirtueMart project and become a member

Main Menu

Customer Name and Firstname in bold letters

Started by Maurice712, April 25, 2024, 12:08:14 PM

Previous topic - Next topic


Hello together

I am looking for a simple solution to display the customer name and first name in bold font in the PDF invoice.

According to my research it is defined in the /com_virtuemart/views/invoice/tmpl files. I have already tried various things, but it does not work. Is there a simple solution?

Joomla: 4.2.9
VM: 4.2.4 10922


It is not a very simple process.

The details are rendered in the file

You can override this using a template override

However the Customer Billing detail fields need to be "separated for individual handling"

<td valign="top"><strong>
    <?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_BILL_TO_LBL'?></strong> <br/>
    <table border="0"><?php
    foreach (
$this->userfields['fields'] as $field) {
if (!empty($field['value'])) {
    echo '<tr><td class="key">' $field['title'] . '</td>'
    . '<td>' $field['value'] . '</td></tr>';
<td valign="top" ><strong>
    <?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SHIP_TO_LBL'?></strong><br/>
<?php if(!empty($this->orderDetails['details']['has_ST'])){
echo "<table border='0'>";
foreach ($this->shipmentfields['fields'] as $field) {
if (!empty($field['value'])) {
echo '<tr><td class="key">' $field['title'] . '</td>'
'<td>' $field['value'] . '</td></tr>';
echo "</table>";
} else {
echo "<br/>".vmText::_('COM_VM_ST_SAME_AS_BT');



This is the code that prints the Billing and Shipping details

So you need to do something different for the elements 'first_name', 'last_name'

You can do this:

1. Create an array list of BT and ST VirtueMart fields you want to print and sequence this list in the sequence you want to print them e.g.

$addressBTOrder = array('first_name', 'last_name{br}', 'company{br}','address_1{br}', 'address_2{br}', 'city{br}', 'zip{br}', 'virtuemart_country_id{br}', 'phone_1{br}', 'email{br}');
$addressSTOrder = array('first_name', 'last_name{br}', 'company{br}','address_1{br}', 'address_2{br}', 'city{br}', 'zip{br}', 'virtuemart_country_id{br}', 'phone_1');

2. Have the code iterate through this list and print each element, doing something different for the elements 'first_name' 'last_name'.

This code shows you how to loop through the 2 arrays - you can do whatever you want to each array field by editing this loop.

foreach ($addressBTOrder as $fieldname) {
$fieldinfo = explode('{',$fieldname);
if (!empty($this->userfields['fields'][$fieldinfo[0]]['value'])) {
echo $this->userfields['fields'][$fieldinfo[0]]['value'];
echo " ";
if (isset($fieldinfo[1]) && $fieldinfo[1] == 'br}') {
echo "<br>";

Modify the foreach loop to handle the ST details ($addressSTOrder as $fieldname)

Joomla 4.4.5
php 8.1