Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add telephone # on the Invoice


lamur

Recommended Posts

Posted

I want to add a customers Telephone # on the invoice. Just right below their address.. I checked out invoice.php and found this:

 

*********

 

<tr>

<td class="main"><?php echo $order->customer['telephone']; ?></td>

</tr>

 

**********

 

Why doesnt it show up? Never the less. How could I do that?

Posted

Look in catalog/admin/includes/classes/order.php There should be "customers_telephone" in the order query. If it's not there, add it.

Posted
Look in catalog/admin/includes/classes/order.php There should be "customers_telephone" in the order query. If it's not there, add it.

Yea it's in there..

Posted
Yea it's in there..

 

 

It works fine in the following code, it may help...

---------------------------------------------------------

 

<?php

/*

$Id: invoice.php,v 1.6 2003/06/20 00:37:30 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

require(DIR_WS_CLASSES . 'currencies.php');

$currencies = new currencies();

 

$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

$orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'");

 

include(DIR_WS_CLASSES . 'order.php');

$order = new order($oID);

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">

 

<!-- body_text //-->

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo nl2br(STORE_NAME_ADDRESS); ?></td>

<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'oscommerce.gif', 'osCommerce', '204', '50'); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><table width="100%" border="0" cellspacing="0" cellpadding="2">

<tr>

<td colspan="2"><?php echo tep_draw_separator(); ?></td>

</tr>

<tr>

<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><b><?php echo ENTRY_SOLD_TO; ?></b></td>

</tr>

<tr>

<td class="main"><?php echo tep_address_format($order->customer['format_id'], $order->customer, 1, '', '<br>'); ?></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>

</tr>

<tr>

<td class="main"><?php echo $order->customer['telephone']; ?></td>

</tr>

<tr>

<td class="main"><?php echo '<a href="mailto:' . $order->customer['email_address'] . '"><u>' . $order->customer['email_address'] . '</u></a>'; ?></td>

</tr>

</table></td>

<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><b><?php echo ENTRY_SHIP_TO; ?></b></td>

</tr>

<tr>

<td class="main"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br>'); ?></td>

</tr>

</table></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td><table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><b><?php echo ENTRY_PAYMENT_METHOD; ?></b></td>

<td class="main"><?php echo $order->info['payment_method']; ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr class="dataTableHeadingRow">

<td class="dataTableHeadingContent" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></td>

<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TAX; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_EXCLUDING_TAX; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_INCLUDING_TAX; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_EXCLUDING_TAX; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_INCLUDING_TAX; ?></td>

</tr>

<?php

for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {

echo ' <tr class="dataTableRow">' . "n" .

' <td class="dataTableContent" valign="top" align="right">' . $order->products[$i]['qty'] . ' x</td>' . "n" .

' <td class="dataTableContent" valign="top">' . $order->products[$i]['name'];

 

if (isset($order->products[$i]['attributes']) && (($k = sizeof($order->products[$i]['attributes'])) > 0)) {

for ($j = 0; $j < $k; $j++) {

echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'];

if ($order->products[$i]['attributes'][$j]['price'] != '0') echo ' (' . $order->products[$i]['attributes'][$j]['prefix'] . $currencies->format($order->products[$i]['attributes'][$j]['price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . ')';

echo '</i></small></nobr>';

}

}

 

echo ' </td>' . "n" .

' <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "n";

echo ' <td class="dataTableContent" align="right" valign="top">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "n" .

' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "n" .

' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "n" .

' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "n" .

' <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "n";

echo ' </tr>' . "n";

}

?>

<tr>

<td align="right" colspan="8"><table border="0" cellspacing="0" cellpadding="2">

<?php

for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {

echo ' <tr>' . "n" .

' <td align="right" class="smallText">' . $order->totals[$i]['title'] . '</td>' . "n" .

' <td align="right" class="smallText">' . $order->totals[$i]['text'] . '</td>' . "n" .

' </tr>' . "n";

}

?>

</table></td>

</tr>

</table></td>

</tr>

</table>

<!-- body_text_eof //-->

 

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Posted

Does the customer listed on the invoice have a phone number on file?

Posted
Does the customer listed on the invoice have a phone number on file?

Yea it's required.

 

I think it is a database error. I run another store and checked it out and the phone number does appear.. So I uploaded all the files from the working store to the other one and it still don't show the #....

 

Not sure what to check in the database...

Posted

Also, I added a modifcation that gives the customer the ability to have a shipping, and billing address. Which also messed with the database only really to add that information.. So i'm just not sure where to look for this..

Posted

Find

<?php echo $order->customer['telephone']; ?>

Replace with

<?php echo $order->delivery['telephone']; ?>

Posted
Find

<?php echo $order->customer['telephone']; ?>

Replace with

<?php echo $order->delivery['telephone']; ?>

Now that was in invoice.php correct?

I did that and no change...

Posted

Now, let me add this... After browsing around my database.. I see that in the "Customers" database, their is a customers_telephone that is blank.. No #'s in there...

 

So I go to "Orders" and since I added those add-ons. I got a customers_telephone a delivery_telephone and a billing_telephone. All of those have a phone #... So I am guessing that it's trying to pull the information from the "Customers" table when it should probably pull it from the "Orders" table... How can I re-arrage that one?

Posted

Did you install the Address Book Enhancer contribution?

Posted
Yea I believe that was the one..

 

would need to see your class for order to decide where it's pulling from and where it's filling it ;-)

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Posted
would need to see your class for order to decide where it's pulling from and where it's filling it ;-)

Sorry I am not very literate in this stuff here. Where would I find the class order so I could show you?

Posted
Sorry I am not very literate in this stuff here. Where would I find the class order so I could show you?

 

please post your

 

admin/includes/classes/order.php

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Posted
please post your

 

admin/includes/classes/order.php

<?php

/*

$Id: order.php,v 1.7 2003/06/20 16:23:08 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

class order {

var $info, $totals, $products, $customer, $delivery;

 

function order($order_id) {

$this->info = array();

$this->totals = array();

$this->products = array();

$this->customer = array();

$this->delivery = array();

 

$this->query($order_id);

}

 

function query($order_id) {

$order_query = tep_db_query("select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, delivery_telephone, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_telephone, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_cvv2, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");

$order = tep_db_fetch_array($order_query);

 

$totals_query = tep_db_query("select title, text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' order by sort_order");

while ($totals = tep_db_fetch_array($totals_query)) {

$this->totals[] = array('title' => $totals['title'],

'text' => $totals['text']);

}

 

$this->info = array('currency' => $order['currency'],

'currency_value' => $order['currency_value'],

'payment_method' => $order['payment_method'],

'cc_type' => $order['cc_type'],

'cc_owner' => $order['cc_owner'],

'cc_number' => $order['cc_number'],

'cc_cvv2' => $order['cc_cvv2'],

'cc_expires' => $order['cc_expires'],

'date_purchased' => $order['date_purchased'],

'orders_status' => $order['orders_status'],

'last_modified' => $order['last_modified']);

 

$this->customer = array('name' => $order['customers_name'],

'company' => $order['customers_company'],

'street_address' => $order['customers_street_address'],

'suburb' => $order['customers_suburb'],

'city' => $order['customers_city'],

'postcode' => $order['customers_postcode'],

'state' => $order['customers_state'],

'country' => $order['customers_country'],

'format_id' => $order['customers_address_format_id'],

'telephone' => $order['customers_telephone'],

'email_address' => $order['customers_email_address']);

 

$this->delivery = array('name' => $order['delivery_name'],

'company' => $order['delivery_company'],

'street_address' => $order['delivery_street_address'],

'suburb' => $order['delivery_suburb'],

'city' => $order['delivery_city'],

'postcode' => $order['delivery_postcode'],

'state' => $order['delivery_state'],

'country' => $order['delivery_country'],

'telephone' => $order['delivery_telephone'],

'format_id' => $order['delivery_address_format_id']);

 

$this->billing = array('name' => $order['billing_name'],

'company' => $order['billing_company'],

'street_address' => $order['billing_street_address'],

'suburb' => $order['billing_suburb'],

'city' => $order['billing_city'],

'postcode' => $order['billing_postcode'],

'state' => $order['billing_state'],

'country' => $order['billing_country'],

'telephone' => $order['billing_telephone'],

'format_id' => $order['billing_address_format_id']);

 

$index = 0;

$orders_products_query = tep_db_query("select orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");

while ($orders_products = tep_db_fetch_array($orders_products_query)) {

$this->products[$index] = array('qty' => $orders_products['products_quantity'],

'name' => $orders_products['products_name'],

'model' => $orders_products['products_model'],

'tax' => $orders_products['products_tax'],

'price' => $orders_products['products_price'],

'final_price' => $orders_products['final_price']);

 

$subindex = 0;

$attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");

if (tep_db_num_rows($attributes_query)) {

while ($attributes = tep_db_fetch_array($attributes_query)) {

$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],

'value' => $attributes['products_options_values'],

'prefix' => $attributes['price_prefix'],

'price' => $attributes['options_values_price']);

 

$subindex++;

}

}

$index++;

}

}

}

?>

Posted

Did you run all of the SQL with the contribution, including the commented at the bottom?

Posted

The file looked ok to me.

 

Please double check your database table ORDERS for the column name for customers_telephone

 

any chance you spelled it minus the s for customers?

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Posted

I backed up the database, and put in the SQL query that was edited out and it didnt display the telephone # then I went to view their profile and their phone # was not in there either so I hurried and restored the backup database.

 

I checked for mispelling and didnt see any....

 

What would be the next step you think?

Posted
I backed up the database, and put in the SQL query that was edited out and it didnt display the telephone # then I went to view their profile and their phone # was not in there either so I hurried and restored the backup database.

 

I checked for mispelling and didnt see any....

 

What would be the next step you think?

 

I re-upped the main files and now for my invoice it looks like this:

 

mikal bently

1451 mary jayne

NULL

rockwall, Texas 55555

United States

 

where did that NULL come from?

Posted

Look over catalog/includes/classes/order.php as well as catalog/checkout_process.php. Compare them with the files included with the ABE contribution. I think you may be missing an array somewhere.

Posted
Look over catalog/includes/classes/order.php as well as catalog/checkout_process.php. Compare them with the files included with the ABE contribution. I think you may be missing an array somewhere.

Just to update this. I couldnt find anything wrong, their is some bug somewhere that is screwing me up that I cannot figure out. So I am having an individual check it out and hopefully get it working for me.

Thanks for the help everyone!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...