Hello,
how can i display separate fields in invoice?
I checked invoice_order.php file:
Display userfields:
<?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>';
}
}
?>
Display shipmentfields:
<?php echo vmText::_('COM_VIRTUEMART_ORDER_PRINT_SHIP_TO_LBL') ?></strong><br/>
<table border="0"><?php
foreach ($this->shipmentfields['fields'] as $field) {
if (!empty($field['value'])) {
echo '<tr><td class="key">' . $field['title'] . '</td>'
. '<td>' . $field['value'] . '</td></tr>';
}
}
?>
This part of code display ALL shipment- or userfields, i don't need it. I need to display certain fields, which i want. Is it possible to output separate fields?
Thanks!
in the loop use
if($field['title'] == 'xxx') { // display it }
statements to display only what u want
Quote from: GJC Web Design on October 09, 2016, 11:52:39 AM
in the loop use
if($field['title'] == 'xxx') { // display it }
statements to display only what u want
Could you please help with full peace of code for one field? I'm just new at php.
For example, display field with fieldname "patientfirstname" (screenshot: http://joxi.ru/v29QZ6piKEaJ2G)
Many thanks! :)
<?php
foreach ($this->userfields['fields'] as $field) {
if ($field['name'] == 'patientfirstname') {
echo '<tr><td class="key">' . $field['title'] . '</td>'
. '<td>' . $field['value'] . '</td></tr>';
}elseif($field['name'] == 'xxxxxx'){
// keep going
} // add more if needed
}
?>
Quote from: GJC Web Design on October 09, 2016, 13:08:36 PM
<?php
foreach ($this->userfields['fields'] as $field) {
if ($field['name'] == 'patientfirstname') {
echo '<tr><td class="key">' . $field['title'] . '</td>'
. '<td>' . $field['value'] . '</td></tr>';
}elseif($field['name'] == 'xxxxxx'){
// keep going
} // add more if needed
}
?>
It works, GREAT! Many thanks :)