Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Order update table help needed


Guest

Recommended Posts

Posted

Hi All, Below is the code used to update the products ordered under checkout_process.php , I added some code at the bottom having already added the fields to the table needed. my problem is that I know the statement marked within the *'s is wrong as I need the product description added to the orders_products table without increasing any order id. I am not a php programmer and I am learning by trial and error but I need to sort this out. Any takers?

 

// Update products_ordered (for bestsellers list)

tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

 

$sql_data_array = array('orders_id' => $insert_id,

'products_id' => tep_get_prid($order->products[$i]['id']),

'products_model' => $order->products[$i]['model'],

'products_name' => $order->products[$i]['name'],

'products_description' => $order->products[$i]['description'],

'products_price' => $order->products[$i]['price'],

'final_price' => $order->products[$i]['final_price'],

'products_tax' => $order->products[$i]['tax'],

'products_quantity' => $order->products[$i]['qty']);

tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);

$order_products_id = tep_db_insert_id();

******************************************************************

tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

$sql_data_array = array('orders_id' => $insert_id,

'products_description' => $order->products[$i]['description'],);

tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);

$order_products_id = tep_db_insert_id();

******************************************************************

Posted

Ummm, the code:

$sql_data_array = array('orders_id' => $insert_id,

'products_id' => tep_get_prid($order->products[$i]['id']),

'products_model' => $order->products[$i]['model'],

'products_name' => $order->products[$i]['name'],

'products_description' => $order->products[$i]['description'],

'products_price' => $order->products[$i]['price'],

'final_price' => $order->products[$i]['final_price'],

'products_tax' => $order->products[$i]['tax'],

'products_quantity' => $order->products[$i]['qty']);

tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);

$order_products_id = tep_db_insert_id();

 

Will already add the product description to the order_products table, or is this code you want to replace?

 

What exactly are you trying to do?

Posted

Tjnaks for replying, I thought that the code should work but in reality it did not, so I asumed I needed to add the extra code in. I have added the fields into the table and as you pointed out, the code should work bt does not, any ideas where to look?. I am trying to add the description to the order email sent to the customer.

 

Ummm, the code:

$sql_data_array = array('orders_id' => $insert_id,

'products_id' => tep_get_prid($order->products[$i]['id']),

'products_model' => $order->products[$i]['model'],

'products_name' => $order->products[$i]['name'],

'products_description' => $order->products[$i]['description'],

'products_price' => $order->products[$i]['price'],

'final_price' => $order->products[$i]['final_price'],

'products_tax' => $order->products[$i]['tax'],

'products_quantity' => $order->products[$i]['qty']);

tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);

$order_products_id = tep_db_insert_id();

 

Will already add the product description to the order_products table, or is this code you want to replace?

 

What exactly are you trying to do?

Archived

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

×
×
  • Create New...