Damon Myrax Posted October 1, 2011 Share Posted October 1, 2011 Hello, I am trying to update the quantities for all of the products in my catalog using the import csv file with just the fields: Product ID; Quantity; Reference; Active(0/1) and Name. The problem that I get is that when I import the csv file, several new categories are created under the home category and all of the products in my catalog are put into these new categories and "lost" from the categories they should be in. Does anyone know why this is happening and how I can get around it. Thanks for any help Damon Link to comment Share on other sites More sharing options...
gianvi Posted October 2, 2011 Share Posted October 2, 2011 for sure you have something mismatching between your CSV and the data into PS. My suggestion is not to import product only but rebuild all the csv files : categories, product, combination, manufacturer. Pls check this post where we are deeply discussion on CSV http://www.prestashop.com/forums/topic/97127-guide-import-products-by-csv-prestashop-14x/page__st__180__gopid__642653#entry642653 Link to comment Share on other sites More sharing options...
Damon Myrax Posted October 2, 2011 Author Share Posted October 2, 2011 Hello Gianvi, Thank you for your reply. I really want to avoid uploading the whole product csv file as my intention is to update my product quantities every day and by importing the whole file it just creates more chance of importing an error. I'll keep trying and let you know if I find anything useful. Damon Link to comment Share on other sites More sharing options...
Optim'Informatique Posted October 2, 2011 Share Posted October 2, 2011 Hello, There is a bug on the import, categories are not correctly set if they are not in the csv file. Here is my fix : in AdminImport.php, in productImport function ( after line 586 for 1.4.3 version ). if (array_key_exists('id', $info) AND (int)($info['id']) AND Product::existsInDatabase((int)($info['id']))) { $product = new Product((int)($info['id'])); $categoryData = Product::getProductCategories((int)($product->id)); //DEBUG_OPTIMINFO $def_sql = 'SELECT id_category_default FROM '._DB_PREFIX_.'product WHERE id_product='.$product->id; $def_cat = Db::getInstance()->ExecuteS($def_sql); $product->id_category_default = $def_cat[0]['id_category_default']; $product->id_category[] = $def_cat[0]['id_category_default']; $cat_sql = 'SELECT id_category FROM '._DB_PREFIX_.'category_product WHERE id_product='.$product->id; $cat_order = Db::getInstance()->ExecuteS($cat_sql); foreach($cat_order AS $cat){ $product->id_category[] = $cat['id_category']; } //END OPTIMINFO Link to comment Share on other sites More sharing options...
Damon Myrax Posted October 3, 2011 Author Share Posted October 3, 2011 Hello Marie-Claire, Thank you for your reply and bug-fix. I have tried running it with my shop but it didn't work. I am not sure if this is because I am running version 1.4.4.1 or if I have made a mistake inserting your code. I'll keep trying. Thanks again DM Link to comment Share on other sites More sharing options...
bluecafe Posted October 3, 2011 Share Posted October 3, 2011 If you have uploaded a csv file the first option for import is importing categories. Could it be that you forgot to change this setting from "categories" to "products" after uploading the csv file? This would explain why you got several new categories. Link to comment Share on other sites More sharing options...
Damon Myrax Posted October 3, 2011 Author Share Posted October 3, 2011 Hi bluecafe, Thank you for your reply, but no that is not the problem. DM Link to comment Share on other sites More sharing options...
Optim'Informatique Posted October 10, 2011 Share Posted October 10, 2011 Did you finally fix your bug ? Link to comment Share on other sites More sharing options...
Damon Myrax Posted October 11, 2011 Author Share Posted October 11, 2011 Hello Marie-Claire, I wasn't able to get it to work so am currently updating the database directly while I educate myself better on php and sql, then I will try again. Thanks again for your help. DM Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now