Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to add fax number to admin/orders.php?


JoeWoodworker

Recommended Posts

I'd like to include the customer's fax number on the admin/orders.php page. It may have been there in the stock installation and I may have removed it.

 

Any ideas on the coding for adding back?

 

I tried

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

 

But its not showing anything.

 

 

Thanks

Evil will always triumph over good...

Because good is dumb.

- D.H.

Link to comment
Share on other sites

I'd like to include the customer's fax number on the admin/orders.php page. It may have been there in the stock installation and I may have removed it.

 

Any ideas on the coding for adding back?

 

I tried

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

 

But its not showing anything.

Thanks

 

 

it's not, because it's not currently in the order class!!!

 

but that's really a quick change:

 

admin/includes/classes/order.php

 

line 26

 

find this

    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, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_checknumber, 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);

 

and add the term for fax to it

    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_fax, 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, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_checknumber, 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);

 

then in line 48 you see the array for customers

      $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']);

 

add fax there too!

$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'],

'fax' => $order['customers_fax'],

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

:-)

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 ...

Link to comment
Share on other sites

now you can use

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

and it will be found too :-)

:-)

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 ...

Link to comment
Share on other sites

First, thank you for the help. I appreciate it.

 

After I added the code you mentioned, I get this error...

 

1054 - Unknown column 'customers_fax' in 'field list'

 

select customers_fax, 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, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, comments, currency, currency_value, date_purchased, orders_status, last_modified from orders where orders_id = '(edit)'

 

 

Any ideas?

Evil will always triumph over good...

Because good is dumb.

- D.H.

Link to comment
Share on other sites

woopsie, ya, my bad, I need to join here ... back in a sec with new code

:-)

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 ...

Link to comment
Share on other sites

woopsie, ya, my bad, I need to join here ... back in a sec with new code

 

 

lol ok, this was not that easy ... so please try it and double check in database if it gives you the right fax numbers, ok? I had to use outer join as not all orders have a fax number.

 

function query($order_id) {
$order_query = tep_db_query("select o.customers_name, o.customers_company, o.customers_street_address, o.customers_suburb, o.customers_city, o.customers_postcode, o.customers_state, o.customers_country, o.customers_telephone, c.customers_fax, o.customers_email_address, customers_address_format_id, o.delivery_name, o.delivery_company, o.delivery_street_address, o.delivery_suburb, o.delivery_city, o.delivery_postcode, o.delivery_state, o.delivery_country, o.delivery_address_format_id, o.billing_name, o.billing_company, o.billing_street_address, o.billing_suburb, o.billing_city, o.billing_postcode, o.billing_state, o.billing_country, o.billing_address_format_id, o.payment_method, o.cc_type, o.cc_owner, o.cc_number, o.cc_checknumber, o.cc_expires, o.currency, o.currency_value, o.date_purchased, o.orders_status, o.last_modified from " . TABLE_ORDERS . " o right outer join  " . TABLE_CUSTOMERS . "  c on o.customers_id where o.customers_id = c.customers_id and orders_id = '" . (int)$order_id . "'");

:-)

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 ...

Link to comment
Share on other sites

Before I make this change...

 

Isn't there some coding that could be lifted off the account_details.php page? I noticed that the fax info was showing up there perfectly.

Evil will always triumph over good...

Because good is dumb.

- D.H.

Link to comment
Share on other sites

Before I make this change...

 

Isn't there some coding that could be lifted off the account_details.php page? I noticed that the fax info was showing up there perfectly.

 

 

account details only references the customers table, and fax is in that table ... for some very weird reason phone and email and all crap has been added to the orders class, but not class ... not even a column for it in orders table, or I have gone that way.

:-)

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 ...

Link to comment
Share on other sites

Anyway that I can add Telephone # for Shipping and Billing?

 

FedEx requires tel # on all overnight shipments so if the customer wants to send to another person then there is no way we can ask them to provide that info....except adding a tel field in the address_book page and all other referenced pages.

 

Anyone knows how to mod this?

Link to comment
Share on other sites

Anyway that I can add Telephone # for Shipping and Billing?

 

FedEx requires tel # on all overnight shipments so if the customer wants to send to another person then there is no way we can ask them to provide that info....except adding a tel field in the address_book page and all other referenced pages.

 

Anyone knows how to mod this?

 

do you need one for shipping and billing or only one for shipping?

:-)

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 ...

Link to comment
Share on other sites

do you need one for shipping and billing or only one for shipping?

 

checkout_shipping_address.php allow you to enter a new shipping address. I need to add a telephone entry there. (add telephone field in the form or display telephone number for each address book listing)

 

checkout_payment_address.php allow you to enter a new billing address. I need to add a telephone entry there.(add telephone field in the form or display telephone number for each address book listing)

 

Both of the above pages are in reference to address_book.php where you can add/delete/edit additional people in your address book. I need to allow people to modify telephone numbers there.

Link to comment
Share on other sites

Just for future reference, the coding working perfectly but its missing one key component... the reference to the order 'comments'.

 

I just added

 

o.comments

 

and it seems to work fine.

Evil will always triumph over good...

Because good is dumb.

- D.H.

Link to comment
Share on other sites

Just for future reference, the coding working perfectly but its missing one key component... the reference to the order 'comments'.

 

I just added

 

o.comments

 

and it seems to work fine.

 

 

yup, I have comments in my website too, as it specifies personalization input :-)

:-)

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 ...

Link to comment
Share on other sites

checkout_shipping_address.php allow you to enter a new shipping address. I need to add a telephone entry there. (add telephone field in the form or display telephone number for each address book listing)

 

checkout_payment_address.php allow you to enter a new billing address. I need to add a telephone entry there.(add telephone field in the form or display telephone number for each address book listing)

 

Both of the above pages are in reference to address_book.php where you can add/delete/edit additional people in your address book. I need to allow people to modify telephone numbers there.

 

osC stores the phone number in the customers table only, but firstname and lastname of the customer in both tables.

 

So what you can do is take the entry_firstname expression as an example, add a field entry_telephone to your databse (table address book) and change all address book references in all your files - make a full osc folder search - to include the new line for entry_telephone. If you do not find it in the contribs, I'm afraid it will be a puzzle work, as there is a bunch of files to change, including classes.

 

here the original tables so you can see what I mean:

 

DROP TABLE IF EXISTS customers;
CREATE TABLE customers (
  customers_id int NOT NULL auto_increment,
  customers_gender char(1) NOT NULL,
  customers_firstname varchar(32) NOT NULL,
  customers_lastname varchar(32) NOT NULL,
  customers_dob datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
  customers_email_address varchar(96) NOT NULL,
  customers_default_address_id int NOT NULL,
  customers_telephone varchar(32) NOT NULL,
  customers_fax varchar(32),
  customers_password varchar(40) NOT NULL,
  customers_newsletter char(1),
  PRIMARY KEY (customers_id)
);

 

DROP TABLE IF EXISTS address_book;
CREATE TABLE address_book (
  address_book_id int NOT NULL auto_increment,
  customers_id int NOT NULL,
  entry_gender char(1) NOT NULL,
  entry_company varchar(32),
  entry_firstname varchar(32) NOT NULL,
  entry_lastname varchar(32) NOT NULL,
  entry_street_address varchar(64) NOT NULL,
  entry_suburb varchar(32),
  entry_postcode varchar(10) NOT NULL,
  entry_city varchar(32) NOT NULL,
  entry_state varchar(32),
  entry_country_id int DEFAULT '0' NOT NULL,
  entry_zone_id int DEFAULT '0' NOT NULL,
  PRIMARY KEY (address_book_id),
  KEY idx_address_book_customers_id (customers_id)
);

:-)

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 ...

Link to comment
Share on other sites

osC stores the phone number in the customers table only, but firstname and lastname of the customer in both tables.

 

So what you can do is take the entry_firstname expression as an example, add a field entry_telephone to your databse (table address book) and change all address book references in all your files - make a full osc folder search - to include the new line for entry_telephone. If you do not find it in the contribs, I'm afraid it will be a puzzle work, as there is a bunch of files to change, including classes.

 

here the original tables so you can see what I mean:

 

DROP TABLE IF EXISTS customers;
CREATE TABLE customers (
  customers_id int NOT NULL auto_increment,
  customers_gender char(1) NOT NULL,
  customers_firstname varchar(32) NOT NULL,
  customers_lastname varchar(32) NOT NULL,
  customers_dob datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
  customers_email_address varchar(96) NOT NULL,
  customers_default_address_id int NOT NULL,
  customers_telephone varchar(32) NOT NULL,
  customers_fax varchar(32),
  customers_password varchar(40) NOT NULL,
  customers_newsletter char(1),
  PRIMARY KEY (customers_id)
);

 

DROP TABLE IF EXISTS address_book;
CREATE TABLE address_book (
  address_book_id int NOT NULL auto_increment,
  customers_id int NOT NULL,
  entry_gender char(1) NOT NULL,
  entry_company varchar(32),
  entry_firstname varchar(32) NOT NULL,
  entry_lastname varchar(32) NOT NULL,
  entry_street_address varchar(64) NOT NULL,
  entry_suburb varchar(32),
  entry_postcode varchar(10) NOT NULL,
  entry_city varchar(32) NOT NULL,
  entry_state varchar(32),
  entry_country_id int DEFAULT '0' NOT NULL,
  entry_zone_id int DEFAULT '0' NOT NULL,
  PRIMARY KEY (address_book_id),
  KEY idx_address_book_customers_id (customers_id)
);

 

 

Thanks for the advice but what about if I simplify to just adding telephone number to shipping address only. I dont think I will need the original account holder's telephone number in there since they already have that when they register. All I need is to add a telephone number when they input a different shipping address. Does this make sense?

 

Any help appreciated...I'm new to this OSC.

Link to comment
Share on other sites

Thanks for the advice but what about if I simplify to just adding telephone number to shipping address only. I dont think I will need the original account holder's telephone number in there since they already have that when they register. All I need is to add a telephone number when they input a different shipping address. Does this make sense?

 

Any help appreciated...I'm new to this OSC.

 

sorry, but that will maybe save 20 minutes of work. You still need to touch all files ... a bit too much to explain it all here. Did you check if there is a contribution for 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 ...

Link to comment
Share on other sites

sorry, but that will maybe save 20 minutes of work. You still need to touch all files ... a bit too much to explain it all here. Did you check if there is a contribution for it?

 

Hi Monika, I'm receiveing this error

1054 - Unknown column 'comments' in 'field list'

insert into orders (customers_id, 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, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, date_purchased, last_modified, orders_status, comments, currency, currency_value) values .......................etc

[TEP STOP]

 

This happens when I click the Confirm Order button. Would you help please?

 

Trev

Link to comment
Share on other sites

Hi Monika, I'm receiveing this error

1054 - Unknown column 'comments' in 'field list'

insert into orders (customers_id, 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, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, date_purchased, last_modified, orders_status, comments, currency, currency_value) values .......................etc

[TEP STOP]

 

This happens when I click the Confirm Order button. Would you help please?

 

Trev

 

Hi,

 

not sure what you changed, but the table orders does not have a column comments (check this stuff in phpmyadmin always), comments go to order_status_history.

:-)

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 ...

Link to comment
Share on other sites

Hi,

 

not sure what you changed, but the table orders does not have a column comments (check this stuff in phpmyadmin always), comments go to order_status_history.

 

I checked the database and the field comments is there as you said in order_status_history. This all came about after I installed the DownloadsControllerV5 contribution. It would appear that a lot of people have a problem with this contribution.

Link to comment
Share on other sites

  • 1 year later...

This is an old thread but I fount it useful when I was trying to add the faxnumber to my invoice and packingslip etc.

 

I also need to add the fax number to the order e-mail that is being sent to the customer.

 

Anybody know how this can be done?

 

I tried to add:

EMAIL_TEXT_CUSTOMER_FAX . ' ' . $order->customer['fax'] . "\n" .

 

to the checkout_process.php but it gave me the following error:

 

1054 - Unknown column 'customers_fax' in 'field list'

 

Any help is aprreciated.

Link to comment
Share on other sites

  • 4 years later...

i was wanting to add a column for the company name, is this straight forward? I managed it in customers.php, seemed to be easier to inject the a.entry_company field into the query there and then call $customers['entry_company']. In orders.php I was unable to pull of the same trick, I think because I don't have the necessary acumen with the query syntax and the address book table isn't linked in?

Link to comment
Share on other sites

  • 11 months later...

Archived

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

×
×
  • Create New...