Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding Fax Details & adding New Fields


SSCraft

Recommended Posts

Please can someone help me with this query. I've seen adding amending fax details in other posts but nothing quite works for me. Also I want to add a field in oscomm2.2.

 

On my checkout pages I changed the fax field wording for the Customer to 'Your shop/blog'. This was easier as no one used the fax box and I needed a blog field which I couldnt add myself. I want Your shop/blog to appear on the invoice under the Customers email.

 

I've managed to add the following line to iadmin/invoice.php :

 

<tr> <td> Your shop/blog, <?php echo $order->customer['customer_fax']; ?> <?php echo $order->customer['customer_fax']; ?></td> </tr>

 

The above does add the words 'Your shop/blog' to my invoice but no matter what I do I cant get it to autopopulate the fax field ie what the Customer has written in the fax box. If I change ['customer_fax'] to ['telephone'] it DOES add the telephone field. So i'm guessing that I haven't added the right wording for it to pick up the fax field. I dont know where to find that wording.

 

So my queries are:

What do I need to write inbetween the [ ] to get it to pull the fax field?

How can I add a new field to my customer checkout pages which will also appear in the details of the individual orders in oscom?

 

Any help gratefully received. Obviously i'm not a programmer just a shop owner with basic knowledge :)

 

k/r Courtney

Link to comment
Share on other sites

The database query that is being used does not include the fax field. You will have to add it to the database query.

 

find near line 27 in admin/includes/classes/order.php

$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_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");

 

Change to:

$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_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");

 

Then find the customer array in the same file near line 47:

$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 the fax field to the end. Should look like this:

$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'],
						  'fax' => $order['customers_fax']);

 

Then you just need the line from your post like this. There is no need to echo it twice.

<tr><td> Your shop/blog, <?php echo $order->customer['fax']; ?></td></tr>

 

 

As for adding a new field to the customer checkout pages, that will require several changes. You will need to add a field to the database and add the field to whichever pages you want it on. Plus add checks to the users input for bad data.

Link to comment
Share on other sites

  • 2 weeks later...

Hi Adam

 

Thanks very much for the info. I've added it at line 27 and it was already at line 47 but unfortunately it still isnt pulling the fax field into the invoice. Any other ideas?

 

Many thanks

Courtney

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...