Posted: November 11, 2016 at 1:37 pm
|
Hello EE I need to add a custom field (Hospital or Affiliation) to the invoice Bill To Section. I have searched the forums and found this thread, but I am not sure what template they are modifying. https://eventespresso.com/topic/invoice-edit-to-add-a-question-company-name/ I do not find an invoice template in plugins/event-espresso/templates directory. Can you help me add this field? I am using EE Version 3.1.37.9.P Thank you! |
In that particular thread they were modifying the invoice template found in /event-espresso/gateways/invoice/template.php. |
|
|
Ok, there is nothing in that directory. Can you help me add a line to the Bill To section of the invoice? I’m not sure where to locate the template file. Appreciate your help! |
You’ll need to locate the invoice template first, and that’s in wp-content/event-espresso/gateways/invoice/template.php |
|
|
Ok, I’ve located invoice_vars.php. |
You actually don’t change anything in invoice_vars.php, the file you are going to edit is template.php. The changes to make are outlined in Dean’s reply here: https://eventespresso.com/topic/invoice-edit-to-add-a-question-company-name/#post-58301 |
|
|
Thanks Josh – however, the field I need to insert is not organization name, the field label is Hospital or Affiliation. I tried inserting $organization_name but it just created a white space on the invoice. I also tried adding $hospital_or_affiliation and that didn’t work either; it created a white space as well. Not sure how to reference that field… |
You’ll need to follow Dean’s directions carefully. The part where he wrote:
is important because that’s how you reference the Hospital or Affiliation field. If you don’t know the field ID, you can get that field by going to Event Espresso > Questions, then go to edit that field. The field ID will appear in the URL of the page where you edit that question. |
|
|
Ok, I didn’t realize that is how you locate the field ID. |
The actually variable name itself isn’t important as long as it’s unique (not already in use for something else) and it’s also important that you consistently use that name. So to keep things simple, you can use $organization_name and that will follow the code in the other thread more closely. |
|
|
Ok, I am using $organization_name and I still have a white space on my invoice; it isn’t grabbing that field for some reason… |
Can you post the full contents of your modified template into a paste bin or a gist, then post a link to that code here? Then we can take a look at that code. |
|
|
thanks Josh |
The problem is the query to pull in the custom question is commented out. Lines 90 through 98 have:
The When posting code we recommend either creating a gist here: Or you can use something like pastebin: Then post the URL for us to view here as MS Word (and other word processors) adds its own formatting to the code. |
|
|
Thank you very much! That solved the issue! Appreciate your help and guidance with this. |
You actually copy the entire invoice folder over to /wp-content/uploads/espresso/gateways so your changes do not get overwritten on an update. |
|
|
Thank you Josh. However, when I transferred the folder I received a file upload error stating “no such directory” ?? Command: cd “/wp-content/uploads/espresso/gateways/invoice” |
You’ll probably need to contact your host and ask about how to fix the file/folder permissions there. |
|
|
Will do. Thanks again for your help! |
The support post ‘Add field to Bill To section on invoice’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.