Adding Fax Number Field to Packing/Invoice
Hi!
I am trying to get the Fax Number field to show on my Packing and Invoice Slips.
I know I have to edit invoice.php and packingslip.php from the admin folder but I don't know to get the fax number to show.
I'd like it to go below:
HTML Code:
<tr><td class="main"><?php echo $order->customer['telephone']; ?></td></tr>
So it prints:
Fax Number: (whatever the customer entered)
I thought I might have gotten away with it as
HTML Code:
<tr>
<td class="main"><?php echo $order->customer['fax']; ?></td>
</tr>
but no.
Thanks
Ernie
Re: Adding Fax Number Field to Packing/Invoice
The fax is not stored with the order ...
Either you would need to re-write the way the orders table entry is made and add this field or you would need to call the field from the customers table ...
Re: Adding Fax Number Field to Packing/Invoice
So is there an easy way to `call the field from the customers table' so that it will display/print on the invoice and packing slip.
Re: Adding Fax Number Field to Packing/Invoice
You might make your own function that can call the customers and customers_info tables similar to the function zen_products_lookup in the functions_lookups.php and retrieve the contents of any field you like ...
Makes it a little more useful than a single function for just 1 peice of information ... :smile:
Re: Adding Fax Number Field to Packing/Invoice
Quote:
Originally Posted by
esugrue
So is there an easy way to `call the field from the customers table' so that it will display/print on the invoice and packing slip.
Quote:
You might make your own function that can call the customers and customers_info tables similar to the function zen_products_lookup in the functions_lookups.php and retrieve the contents of any field you like ...
Makes it a little more useful than a single function for just 1 peice of information ...
So for somone who doesn't write pages of code for a living, that would be a no, since unless you can understand how all those function calls and lookups etc are coded and work together, it's not easy.
Re: Adding Fax Number Field to Packing/Invoice
I wanted to do the same thing. I was pretty shocked to find that the zen_orders table doesn't capture the customer's fax number! It manages to capture everything else BUT the fax number. So, aside from having a good understanding of the schema and writing some code, there is no way to add the customer's fax number to the invoice. It's insane.
If anyone out there could post a sql query that pulls customers_fax from the zen_customers table for the given order id and can be pasted into the invoice.php file, it would be very useful for a lot of people!
:shocking:
Re: Adding Fax Number Field to Packing/Invoice
A quick way to do this on invoice.php is to change:
PHP Code:
$oID = zen_db_prepare_input($_GET['oID']);
To read:
PHP Code:
$oID = zen_db_prepare_input($_GET['oID']);
$sql = "SELECT o.customers_id, c.customers_fax from " . TABLE_ORDERS . " o, " . TABLE_CUSTOMERS . " c WHERE c.customers_id= o.customers_id and o.orders_id = '" . $oID . "'";
$chk_customers_fax = $db->Execute($sql);
$customers_fax = $chk_customers_fax->fields['customers_fax'];
Now you can use:
$customers_fax
anywhere you want on the invoice.php
The same thing can be done on the packingslip.php ...
Re: Adding Fax Number Field to Packing/Invoice
Excellent. The code you posted was just what I needed. I have also been able to make other changes to the invoice.php file by expanding upon the example you provided.
Thanks!
Coffee donation is on the way.
Re: Adding Fax Number Field to Packing/Invoice
Glad this was able to help you out! :smile:
Thanks for the support ... the Zen Cart Team greatly appreciates the donations so that we can continue to provide the software for you to run your store and the Free support forum ...
Re: Adding Fax Number Field to Packing/Invoice
Hello sorry but i triad to put the code in my orders.php (in admin section) and don’t work. Can you help me