News:

Looking for documentation? Take a look on our wiki

Main Menu

How to display separate fields in invoice

Started by Milada, October 09, 2016, 11:50:24 AM

Previous topic - Next topic

Milada

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!

GJC Web Design

in the loop use
if($field['title'] == 'xxx') { // display it }
statements to display only what u want
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Milada

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!  :)

GJC Web Design



<?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
    }
    ?>


GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Milada

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  :)