Jump to content

Update products with CSV - Category reset ?!


Recommended Posts

Hi to everybody,

I already posted this question in another thread (italian forum), but apparently nobody has got an opinion/solution.

Weel, to update the quantities available and prices for sale I override some existing products through the csv import.

Csv file contains only the id, product name, quantity and the selling price including tax.

The system is working properly and the updates are ok, but product updated change categories and back to being in the category "home". I do not think it is a normal thing, since all other data products are not affected by changes (tags, pictures, cards, etc. ..).

 

In my operations i never use category field, but apparently, this field is overrides with a default value (1).

Does anyone have an opinion ( maybe a solution ) ?

 

Thanks

Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...
  • 7 months later...
hello

my prestashop version is 1.6.0.9

The csv import changes my default category not contain this field in the import.

 

The solution:

In the file /controllers/admin/AdminImportController.php

Change the line 1435



$product->id_category_default = isset($product->id_category[0]) ? (int)$product->id_category[0] : '';


 

for this



if (isset($info['category']))
{
$product->id_category_default = isset($product->id_category[0]) ? (int)$product->id_category[0] : '';
}


 

I hope that works for them.

Link to comment
Share on other sites

  • 2 months later...

 

hello
my prestashop version is 1.6.0.9
The csv import changes my default category not contain this field in the import.
 
The solution:
In the file /controllers/admin/AdminImportController.php
Change the line 1435
$product->id_category_default = isset($product->id_category[0]) ? (int)$product->id_category[0] : '';
 
for this
if (isset($info['category']))
{
$product->id_category_default = isset($product->id_category[0]) ? (int)$product->id_category[0] : '';
}
 
I hope that works for them.

 

 

Great! Now is the question for 1.000.000$! 

 

How to do this in Prestashop Cloud?

 

There is no access to the files in the  /controllers/ folder,

 

Any good ideas? I´ve heard something about using overrides, but I have no idea how that works, and if it would apply in this case.

 

This is a huge problem that needs to be addresses asap!

 

Without this change, it makes it impossible to manage a store that received updates on stock/price from external sources!

 

Thanks.

 

Simonkl

Edited by Simonkl (see edit history)
Link to comment
Share on other sites

  • 1 year later...
  • 2 months later...
When you update product with import, There are two possibilities with category.

 

1. Not having category column.

It will consider top first assigned category as default category. 

For ex. if your product is assigned to categories: 5# xyz, 10#abc, 4# hij; your current default category is 10. Now you are updating some data let's say qty and tax of product; as you haven't added categories it will consider current category tree and from it will get first category in ascending order and that is 4# hij as default category.

 

2. Having category column.

If you add categories in category column you can enter comma separated list of categories and first category in that will be considered as default category of product.

For ex. in category column if you enter "z, x, y, a" as categories of product; category z will be considered as default category of product.

Edited by Divyesh Prajapati (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...