Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Insert products with SQL


muligruber

Recommended Posts

I have a client who is using oscommerce. I took it over from another person. The database was changed so that the product_id is not auto increment. This was done I believe to match the part numbers the customer had to the shopping cart. The only way that I can seem to enter product is through SQL in myphpadmin tool.

 

My question is: does anyone know what the correct sql insert would be to insert one product into all the proper tables?

 

And does anyone have a structure table for the databases? how they relate etc.. like a flow chart.

 

I think I am missing some entrys the way I am doing it.

 

thanks

Link to comment
Share on other sites

I believe products are only created by admin/categories.php. If you modify it to work, then you wouldn't need to write SQL by hand.

 

Any ideas on how to modify that code to give me a place to insert the product_id?

 

I believe the code follows

 

f (isset($HTTP_GET_VARS['pID'])) $products_id = tep_db_prepare_input($HTTP_GET_VARS['pID']);

$products_date_available = tep_db_prepare_input($HTTP_POST_VARS['products_date_available']);

 

$products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null';

 

$sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']),

'products_model' => tep_db_prepare_input($HTTP_POST_VARS['products_model']),

'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']),

'products_date_available' => $products_date_available,

'products_weight' => tep_db_prepare_input($HTTP_POST_VARS['products_weight']),

'products_status' => tep_db_prepare_input($HTTP_POST_VARS['products_status']),

'products_tax_class_id' => tep_db_prepare_input($HTTP_POST_VARS['products_tax_class_id']),

'manufacturers_id' => tep_db_prepare_input($HTTP_POST_VARS['manufacturers_id']));

Link to comment
Share on other sites

You said the products_id was changed to match "part numbers." What do you mean by this? Are there rules for how the products_id must be generated? What kinds of IDs exist now? Is it acceptable to generate an integer value as the products_id?

 

 

the product id is determined by the part number: ie.. the product number is 101 the product id is 101 etc. I think i figured out how to insert a sql query to do it all so far it is working I will get back to ya..

Link to comment
Share on other sites

And does anyone have a structure table for the databases? how they relate etc.. like a flow chart.

 

I think I am missing some entrys the way I am doing it.

 

thanks

I uploaded one that I found (forget where :blush:) to contributions:

 

http://www.oscommerce.com/community/contributions,3853

Local: Mac OS X 10.5.8 - Apache 2.2/php 5.3.0/MySQL 5.4.10 • Web Servers: Linux

Tools: BBEdit, Coda, Versions (Subversion), Sequel Pro (db management)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...