• Resolved macgyverer

    (@macgyverer)


    Hello,

    I would like to display the customer’s address at the top left of the invoice to the customer (invoice_tmpl.php), and not within the table with the services.
    In addition, only the real address data should be displayed there, i.e. only

    First name | Last name
    Street | House number
    Zip code | City

    and not all the labels and data from {customer_info}.

    Is this possible?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author e4jvikwp

    (@e4jvikwp)

    Hello,

    Thanks for your message. We understand what you’re looking for, and as you’ve noticed, the default special tag {customer_info} is a pre-formatted string that contains all the customer information. If you wish to display specific customer details, then you should access the apposite customer record object through the apposite PHP variable available in the template file for the invoice generation.

    By editing the template file from the Configuration page, you will find some useful PHP comments at the top of the file that show how to access the customer object for then displaying only the desired billing/contact information.

    More precisely, the PHP comments in the template file show how the below PHP code will access the customer information record (if any):

    $customer = VikBooking::getCPinInstance()->getCustomerFromBooking($booking_info['id']);

    Then you can print/display the desired information on your preferred section of your HTML template file by using the code below (or similar):

    <?php echo $customer['first_name'] ?? ''; ?>

    You can actually debug the whole content of the customer associative array as explained in the PHP comments. This is the only way to display specific customer details on custom positions/sections of your template file, and this applies of course to any template file (confirmation email, invoice ecc..).

    We hope this helps!

    The VikWP Team

    Thread Starter macgyverer

    (@macgyverer)

    Perfect, thanks for the quick response. It worked very well and now the invoices look the way I wanted them to ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Invoice template: place customer address top left’ is closed to new replies.