Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

new fields in table_orders filled with coupon info


Tom172

Recommended Posts

Posted

Hi everybody.

 

oscommerce 2.2 rca

 

 

I added three new fields to table orders which I would like to fill with information gathered on checkout_process.php and come from a discount coupon contribution (7397)

 

The fields are:

 

discount_codes_id

discount_codes

discount_code_text

 

As I have only very limited php skills I tried the following:

 

 

I added the following code right above the sql_data_array (for table_orders) in checkout_process.php

 

if (!empty($discount)) {
  $discount_codes_query = tep_db_query("select discount_codes_id, discount_codes, discount_code_text from " . TABLE_DISCOUNT_CODES . " where discount_codes = '" . tep_db_input($sess_discount_code) . "'");
  $discount_codes = $discount_codes_query;
  }

 

and then added the following lines to that array further down

 

					  'date_purchased' => 'now()',
					  'orders_status' => $order->info['order_status'],
					  'currency' => $order->info['currency'],
					  'currency_value' => $order->info['currency_value'],

// BOF Mod to include more info into table orders
	'discount_codes_id' => $discount_codes_id,
	  'discount_codes' => $discount_codes,
	  'discount_code_text' => $discount_code_text,
// EOF Mod to include more info into table orders		

// BOF 2138 Order IP Recorder	  
					  'ipaddy' => $ip,
					  'ipisp' => $isp);
// EOF 2138 Order IP Recorder	  
 tep_db_perform(TABLE_ORDERS, $sql_data_array);
 $insert_id = tep_db_insert_id();
 for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {
$sql_data_array = array('orders_id' => $insert_id,
						'title' => $order_totals[$i]['title'],
						'text' => $ord

 

 

 

Well, obviously This does not work as the data is not stored into the table orders. Can anyone give a hint why this is not working? or what I might try to include that information into orders table?

 

Any help is appreciated. Thank you

tom

Archived

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

×
×
  • Create New...