Jump to content

Problem Using CSV Import To Update Product Quantities


Recommended Posts

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

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

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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...