zeepblok Posted May 3, 2010 Share Posted May 3, 2010 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 More sharing options...
♥mdtaylorlrim Posted May 3, 2010 Share Posted May 3, 2010 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 More sharing options...
zeepblok Posted May 3, 2010 Author Share Posted May 3, 2010 Because it takes adding information to three different tables to get the product into the database. And witch 3 are those ? Link to comment Share on other sites More sharing options...
♥mdtaylorlrim Posted May 3, 2010 Share Posted May 3, 2010 And witch 3 are those ? products - holds the basic product info products_description - holds the extended description of the product products_to_categories - maps the product to the category 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 More sharing options...
zeepblok Posted May 4, 2010 Author Share Posted May 4, 2010 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 More sharing options...
zeepblok Posted May 4, 2010 Author Share Posted May 4, 2010 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 More sharing options...
♥mdtaylorlrim Posted May 4, 2010 Share Posted May 4, 2010 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 More sharing options...
zeepblok Posted May 4, 2010 Author Share Posted May 4, 2010 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 More sharing options...
zeepblok Posted May 6, 2010 Author Share Posted May 6, 2010 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 More sharing options...
MrPhil Posted May 7, 2010 Share Posted May 7, 2010 Why are you re-inventing the wheel? Have you looked at using the EasyPopulate add-on to add products via CSV file? Link to comment Share on other sites More sharing options...
zeepblok Posted May 7, 2010 Author Share Posted May 7, 2010 Its an external CSV file. It also deliveres different colomn types. (for group ID a string instead of an INT) and some other none default things :) Link to comment Share on other sites More sharing options...
zeepblok Posted May 10, 2010 Author Share Posted May 10, 2010 It might be a smart idea to put status on available >< i feel stupid now. but thnx for all the help :) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.