Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

CSV to SQL


zeepblok

Recommended Posts

Hi,

 

I made a simple PHP tool that inserts a CSV file into the OScommerce DB. If I look in the DB I see all the added products in the table. only if I look in the catalog I don't see them :S

what could this be ?

Link to comment
Share on other sites

Hi,

 

I made a simple PHP tool that inserts a CSV file into the OScommerce DB. If I look in the DB I see all the added products in the table. only if I look in the catalog I don't see them :S

what could this be ?

Because it takes adding information to three different tables to get the product into the database.

Community Bootstrap Edition, Edge

 

Avoid the most asked question. See How to Secure My Site and How do I...?

Link to comment
Share on other sites

products - holds the basic product info

products_description - holds the extended description of the product

products_to_categories - maps the product to the category

 

A crap the CSV does'nt work with categorie_id. this is gonna be a pain in the ass. but thanks for your help :)

Link to comment
Share on other sites

A crap the CSV does'nt work with categorie_id. this is gonna be a pain in the ass. but thanks for your help :)

 

Can't edit my old post so sorry for the double post.

 

But I added the new product to all 3 tabels and still I can't see it in admin panel or the fronpanel

Link to comment
Share on other sites

Well, no one will be able to help you much without any code or something. but, I will say that when you add a product to the products table it automatically assigns a product_id number. When you then add the product to the product_description table it automatically assigns a product_id number. THESE MUST BE THE SAME. So you must add the product to the products_description table immediately after adding it to the products table so that the product_id is the same in both. Then, you must use that product_id number when you add to the products_to_categories table.

Community Bootstrap Edition, Edge

 

Avoid the most asked question. See How to Secure My Site and How do I...?

Link to comment
Share on other sites

Well, no one will be able to help you much without any code or something. but, I will say that when you add a product to the products table it automatically assigns a product_id number. When you then add the product to the product_description table it automatically assigns a product_id number. THESE MUST BE THE SAME. So you must add the product to the products_description table immediately after adding it to the products table so that the product_id is the same in both. Then, you must use that product_id number when you add to the products_to_categories table.

 

 

This is my insert command

 

for ($c=0; $c < $num; $c++) {
	$sql='INSERT INTO oscommerce_products (`products_id`,`manufacturers_id`,`products_model`, `products_status`, `products_quantity`,`products_price`)
	VALUES (\''.mysql_real_escape_string($data[$c++]).'\',\''.mysql_real_escape_string($data[$c+2]).'\',\''.mysql_real_escape_string($data[$c++]).'\',\''.mysql_real_escape_string($data[$c+4]).'\',\''.mysql_real_escape_string($data[$c+2]).'\',\''.mysql_real_escape_string($data[$c+2]).'\')';
	//echo $sql."<br>";

 

I added it to the other 2 tables manually with the same ID number as the first one.

Link to comment
Share on other sites

I checked the ID's and they are all the same (4137). still no luck :S.

can it be that I dont fill the date added field ?. It defaults it to 00-00-00 so it should work right ?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...